diff --git a/docs/api.rst b/docs/api.rst deleted file mode 100644 index 620e781..0000000 --- a/docs/api.rst +++ /dev/null @@ -1,10 +0,0 @@ -:mod:`API` - ---------------------------- - - Example For Autogenerated API Documentation - =========================================== - - .. automodule:: extract_model.dummy - :members: - :undoc-members: - :show-inheritance: \ No newline at end of file diff --git a/docs/environment.yml b/docs/environment.yml index 59e93d8..fe83841 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -4,6 +4,12 @@ dependencies: # If your docs code examples depend on other packages add them here - numpy - xarray + - cf-xarray + - matplotlib + - cmocean + # use mac dependencies + - esmf=8.1.1=mpi_openmpi_h047fafc_0 + - esmpy=8.1.1=mpi_openmpi_py38hf504846_0 # These are needed for the docs themselves - numpydoc - sphinx @@ -13,11 +19,15 @@ dependencies: - nbformat - ipykernel - pandoc + - recommonmark - pip - pip: + - git+https://github.com/axiom-data-science/extract_model.git#egg=extract_model + - git+https://github.com/pangeo-data/xESMF.git#egg=xESMF + - xcmocean - docrep<=0.2.7 - nbsphinx - jupyter_client - sphinx_pangeo_theme - sphinx-copybutton - - sphinxcontrib-srclinks \ No newline at end of file + - sphinxcontrib-srclinks diff --git a/docs/index.rst b/docs/index.rst index c29080b..f5a50ad 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,22 +3,15 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to extract_model's documentation! -======================================= +`extract_model` +=============== -This is an awesome description of extract_model, written in `reStructuredText`_. - -You can contribute new sections by either adding a new file (see ``new_section.rst``) or just putting a jupyter notebook -in the ``docs`` folder (see ``new_section_notebook.ipynb``). - -In either case, make sure to add an entry in the ``.. toctree::``. Check out ``index.rst`` how it was done for the above examples. +Use `extract_model` to read select output from model output files by time and/or space. Output will be selected using `xarray` by a combination of interpolation and index selection. Horizontal interpolation is accomplished using `xESMF` and time interpolation is done with `xarray`'s native 1D interpolation. Currently vertical interpolation is only possible using `xarray`'s 1D interpolation too and is not set up to interpolate in 4D as would be required for ROMS output if not simply selecting the surface layer. .. toctree:: :maxdepth: 2 - new_section - new_section_notebook - api + models @@ -28,5 +21,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - -.. _reStructuredText: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html \ No newline at end of file diff --git a/docs/models.ipynb b/docs/models.ipynb index d73cc06..342c44f 100644 --- a/docs/models.ipynb +++ b/docs/models.ipynb @@ -10,8 +10,6 @@ "import cf_xarray\n", "import numpy as np\n", "import xarray as xr\n", - "import xgcm\n", - "import xesmf as xe\n", "import matplotlib.pyplot as plt\n", "import xcmocean\n", "import cmocean.cm as cmo\n", @@ -26,20 +24,12 @@ "# Generically access model output" ] }, - { - "cell_type": "markdown", - "id": "231623aa-e963-4f16-86b7-0ffdfa104f0e", - "metadata": {}, - "source": [ - "## Test" - ] - }, { "cell_type": "markdown", "id": "1ed06a35-45ab-4ee7-8039-ff11f164caed", "metadata": {}, "source": [ - "### MOM6" + "## MOM6" ] }, { @@ -70,7 +60,7 @@ "id": "579965a6-086c-4a52-8e40-a1ed321b2198", "metadata": {}, "source": [ - "#### grid point" + "### grid point" ] }, { @@ -78,7 +68,7 @@ "id": "3a1eea02-288d-40b4-bed5-9b60051f27ed", "metadata": {}, "source": [ - "##### horizontal interp, vertical and time isel" + "#### horizontal interp, vertical and time isel" ] }, { @@ -129,7 +119,7 @@ "id": "e833f054-c0ac-4866-81b8-36ac2db7d822", "metadata": {}, "source": [ - "##### horizontal and vertical interp, time isel" + "#### horizontal and vertical interp, time isel" ] }, { @@ -178,7 +168,7 @@ "id": "a139e03b-3219-4283-9863-745b59890ff1", "metadata": {}, "source": [ - "#### not grid point" + "### not grid point" ] }, { @@ -186,7 +176,7 @@ "id": "292eab46-3d23-4c85-8d45-f8cd22c72675", "metadata": {}, "source": [ - "##### inside domain" + "#### inside domain" ] }, { @@ -260,7 +250,7 @@ "id": "513df367-84bd-450b-b7d3-fa258b2bc75f", "metadata": {}, "source": [ - "##### outside domain" + "#### outside domain" ] }, { @@ -380,7 +370,7 @@ "id": "4531d5bd-7746-4ade-843e-bc0be3a52433", "metadata": {}, "source": [ - "#### points (locstream)\n", + "### points (locstream)\n", "\n", "Unstructured pairs of lon/lat locations instead of grids of lon/lat locations, using `locstream`." ] @@ -438,7 +428,7 @@ "id": "e0940537-0911-4f77-92d5-5bf3b81ea055", "metadata": {}, "source": [ - "#### grid of known locations" + "### grid of known locations" ] }, { @@ -487,7 +477,7 @@ "id": "9158bffd-4a87-4db4-927e-0a5d8dc7370c", "metadata": {}, "source": [ - "#### grid of new locations" + "### grid of new locations" ] }, { @@ -561,7 +551,7 @@ "id": "01ed35fe-cd31-44b0-90d2-423dc14f3393", "metadata": {}, "source": [ - "### HYCOM" + "## HYCOM" ] }, { @@ -589,7 +579,7 @@ "id": "c79341d1-492e-4896-8c49-aa8db06a7aba", "metadata": {}, "source": [ - "#### grid point" + "### grid point" ] }, { @@ -629,7 +619,7 @@ "id": "40f3ca75-f2af-43bf-9f8c-0818b7072d2a", "metadata": {}, "source": [ - "#### not grid point" + "### not grid point" ] }, { @@ -637,7 +627,7 @@ "id": "caf72205-aec3-42dc-b77f-b12a931be41c", "metadata": {}, "source": [ - "##### inside domain" + "#### inside domain" ] }, { @@ -678,7 +668,7 @@ "id": "c2abd653-de42-44f9-8350-6827657dae47", "metadata": {}, "source": [ - "##### outside domain" + "#### outside domain" ] }, { @@ -819,7 +809,7 @@ "id": "86bce0f5-0be3-4f9d-a097-c7f39e7f8788", "metadata": {}, "source": [ - "#### points (locstream)\n", + "### points (locstream)\n", "\n", "Unstructured pairs of lon/lat locations instead of grids of lon/lat locations, using `locstream`." ] @@ -878,7 +868,7 @@ "id": "5aee17b6-55f7-43bf-b1ce-0040fe6506a0", "metadata": {}, "source": [ - "#### grid of known locations" + "### grid of known locations" ] }, { @@ -931,7 +921,7 @@ "id": "dc123ada-7da4-4a43-8da0-5b905dd61e19", "metadata": {}, "source": [ - "#### grid of new locations" + "### grid of new locations" ] }, { @@ -1015,7 +1005,7 @@ "id": "d12ac238-33ac-42ed-bcdc-9c7e18322e69", "metadata": {}, "source": [ - "### ROMS" + "## ROMS" ] }, { @@ -1782,7 +1772,7 @@ "id": "99752714-ac31-423f-812c-fd403cfd944f", "metadata": {}, "source": [ - "#### grid point" + "### grid point" ] }, { @@ -1833,7 +1823,7 @@ "id": "e52cbf63-f0cb-4674-b799-f9922cf2ede3", "metadata": {}, "source": [ - "#### not grid point" + "### not grid point" ] }, { @@ -1841,7 +1831,7 @@ "id": "9c872e5d-8096-4967-83ec-d39740cedda5", "metadata": {}, "source": [ - "##### inside domain" + "#### inside domain" ] }, { @@ -1914,7 +1904,7 @@ "id": "0157430c-f673-4166-b982-87ef9e886fa3", "metadata": {}, "source": [ - "##### outside domain" + "#### outside domain" ] }, { @@ -2044,7 +2034,7 @@ "id": "0b61c634-853c-4d74-9ae8-52525c978d3a", "metadata": {}, "source": [ - "#### points (locstream)\n", + "### points (locstream)\n", "\n", "Unstructured pairs of lon/lat locations instead of grids of lon/lat locations, using `locstream`." ] @@ -2106,7 +2096,7 @@ "id": "2a12dafa-7997-4a16-9bab-4afab1c4d869", "metadata": {}, "source": [ - "#### grid of known locations" + "### grid of known locations" ] }, { @@ -2155,7 +2145,7 @@ "id": "c1ad2d87-2f7a-4b7b-8654-207803f5e935", "metadata": {}, "source": [ - "#### grid of new locations" + "### grid of new locations" ] }, { @@ -2241,7 +2231,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/docs/new_section.rst b/docs/new_section.rst deleted file mode 100644 index 9139482..0000000 --- a/docs/new_section.rst +++ /dev/null @@ -1,2 +0,0 @@ -Some new exciting Section -========================= \ No newline at end of file diff --git a/docs/new_section_notebook.ipynb b/docs/new_section_notebook.ipynb deleted file mode 100644 index 73b77f9..0000000 --- a/docs/new_section_notebook.ipynb +++ /dev/null @@ -1,71 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Another section, but this is actually a Notebook 🤗\n", - "\n", - "This makes it super easy to wrap complex examples into the documentation. \n", - "\n", - "It supports\n", - "\n", - "- Markdown cells\n", - "\n", - "- Code\n", - "\n", - " Both `inline` and separate cells" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Some pseudo code\n", - "\n", - "from cool_module import cool_function\n", - "\n", - "cool_function(a, b, b)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "And all the other fun stuff, like GIFs (absolutely essential to any of my workflows)\n", - "\n", - "![](https://media.giphy.com/media/q1MeAPDDMb43K/giphy.gif)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} \ No newline at end of file diff --git a/tests/test_em.py b/tests/test_em.py index 3d54761..d68ab7a 100644 --- a/tests/test_em.py +++ b/tests/test_em.py @@ -6,13 +6,8 @@ models = [] -# base_path = Path.home() / "tests/" -# Path(em.__file__).parent.parent / 'tests' / 'test_mom6.nc' - # MOM6 inputs -# url = base_path / "test_mom6.nc" url = Path(__file__).parent / 'test_mom6.nc' -# url = 'tests/test_mom6.nc' ds = xr.open_dataset(url) varname = 'u' cf_var = em.get_var_cf(ds, varname) @@ -30,8 +25,6 @@ # HYCOM inputs url = Path(__file__).parent / 'test_hycom.nc' -# url = base_path / "test_hycom.nc" -# url = 'test_hycom.nc' ds = xr.open_dataset(url) varname = 'u' cf_var = em.get_var_cf(ds, varname) @@ -49,8 +42,6 @@ # Second HYCOM example inputs, from Heather url = Path(__file__).parent / 'test_hycom2.nc' -# url = base_path / "test_hycom2.nc" -# url = 'test_hycom2.nc' ds = xr.open_dataset(url) varname = 'u' cf_var = em.get_var_cf(ds, varname) @@ -67,9 +58,7 @@ models += [hycom2] # ROMS inputs -# url = base_path / "test_roms.nc" url = Path(__file__).parent / 'test_roms.nc' -# url = 'test_roms.nc' ds = xr.open_dataset(url) varname = 'ssh' cf_var = em.get_var_cf(ds, varname)