Skip to content

Commit

Permalink
Merge pull request #13 from kthyng/main
Browse files Browse the repository at this point in the history
Docs fixes for sphinx compilation
  • Loading branch information
kthyng authored May 24, 2021
2 parents 3d3da10 + 13c41e1 commit e983eae
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
12 changes: 12 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:mod:`API`
----------------------------

`extract_model` Python API
==========================


.. automodule:: extract_model.extract_model
:members:
:inherited-members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Use `extract_model` to read select output from model output files by time and/or
:maxdepth: 2

models

api


Indices and tables
Expand Down
40 changes: 21 additions & 19 deletions extract_model/extract_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
def get_var_cf(ds, varname):
"""Match colloquial name to model name.
Inputs
------
Parameters
----------
ds: Dataset
Dataset containing variable.
varname: str
Options: 'ssh', 'u', 'v', 'salt', 'temp'
Notes
-----
The standard_names used for variables in model output are not the same.
This function with the lists above connect colloquial names to the list of
possible variable names above. Then, the name found in the dataset ds is
Expand Down Expand Up @@ -99,8 +102,8 @@ def select(
):
"""Extract output from ds at location(s).
Inputs
------
Parameters
----------
ds: Dataset
Property to take gradients of.
longitude, latitude: int, float, list, array (1D or 2D), DataArray, optional
Expand Down Expand Up @@ -137,28 +140,27 @@ def select(
or as `extra_value` if input.
locstream: boolean, optional
Which type of interpolation to do:
* False: 2D array of points with 1 dimension the lons and
the other dimension the lats.
* True: lons/lats as unstructured coordinate pairs
(in xESMF language, LocStream).
* False: 2D array of points with 1 dimension the lons and the other dimension the lats.
* True: lons/lats as unstructured coordinate pairs (in xESMF language, LocStream).
Returns
-------
DataArray of interpolated and/or selected values from ds.
Example usage
-------------
Example
-------
Select a single grid point.
```
longitude = 100
latitude = 10
iZ = 0
iT = 0
varname = 'u'
kwargs = dict(ds=ds, longitude=longitude, latitude=latitude, iT=T, iz=Z, varname=varname)
dr = select(**kwargs)
```
>>> longitude = 100
>>> latitude = 10
>>> iZ = 0
>>> iT = 0
>>> varname = 'u'
>>> kwargs = dict(ds=ds, longitude=longitude, latitude=latitude, iT=T, iz=Z, varname=varname)
>>> dr = select(**kwargs)
"""

# can't run in both Z and iZ mode, same for T/iT
Expand Down

0 comments on commit e983eae

Please sign in to comment.