Skip to content

Commit

Permalink
Update documentation and fix docstrings
Browse files Browse the repository at this point in the history
Also fixed spacing issues with MOC docstrings
  • Loading branch information
xylar committed Jul 28, 2020
1 parent 2329d1d commit 00f2431
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
21 changes: 21 additions & 0 deletions conda_package/docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ Ocean Tools
make_moc_basins_and_transects
build_moc_basins

.. currentmodule:: mpas_tools.ocean.transects

.. autosummary::
:toctree: generated/

find_transect_levels_and_weights
interp_mpas_to_transect_triangles
interp_mpas_to_transect_triangle_nodes
interp_transect_grid_to_transect_triangle_nodes
get_outline_segments

Visualization
=============

Expand All @@ -89,3 +100,13 @@ Visualization
:toctree: generated/

extract_vtk

.. currentmodule:: mpas_tools.viz.transects

.. autosummary::
:toctree: generated/

make_triangle_tree
find_transect_cells_and_weights
subdivide_great_circle
cartesian_to_great_circle_distance
2 changes: 2 additions & 0 deletions conda_package/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
# Otherwise, the Attributes parameter list looks different from the Parameters
# list
napoleon_use_ivar = True
# Make sure multiple variable on the same line show up right
napoleon_use_param = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
2 changes: 2 additions & 0 deletions conda_package/mpas_tools/ocean/moc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def make_moc_basins_and_transects(gf, mesh_filename,
"""
Builds features defining the ocean basins and southern transects used in
computing the meridional overturning circulation (MOC)
Parameters
----------
gf : ``GeometricFeatures``
Expand Down Expand Up @@ -72,6 +73,7 @@ def build_moc_basins(gf, logger=None):
"""
Builds features defining the ocean basins used in computing the meridional
overturning circulation (MOC)
Parameters
----------
gf : ``GeometricFeatures``
Expand Down
13 changes: 7 additions & 6 deletions conda_package/mpas_tools/ocean/transects.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ def find_transect_levels_and_weights(dsTransect, layerThickness, bottomDepth,
"""
Construct a vertical coordinate for a transect produced by
``mpas_tools.viz.transects.find_transect_cells_and_weights()``, then break
each resulting quadrilateral into 2 triangles that can later be visualized
with functions like ``tripcolor`` and ``tricontourf``. Also, compute
interpolation weights such that observations at points on the original
transect and with vertical cooridinate ``transectZ`` can be bilinearly
interpolated to the nodes of the transect.
each resulting quadrilateral into 2 triangles that can later be visualized
with functions like ``tripcolor`` and ``tricontourf``. Also, compute
interpolation weights such that observations at points on the original
transect and with vertical coordinate ``transectZ`` can be bilinearly
interpolated to the nodes of the transect.
Parameters
----------
dsTransect : xarray.Dataset
Expand Down Expand Up @@ -64,7 +65,7 @@ def find_transect_levels_and_weights(dsTransect, layerThickness, bottomDepth,
- interpCellIndices, interpLevelIndices: the MPAS-Ocean cells and
levels from which the value at a given triangle node are
interpolated. This can involve up to `nWeights = 12` different
interpolated. This can involve up to ``nWeights = 12`` different
cells and levels.
- interpCellWeights: the weight to multiply each field value by
to perform interpolation to a triangle node.
Expand Down
11 changes: 4 additions & 7 deletions conda_package/mpas_tools/viz/transects.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,11 @@ def subdivide_great_circle(x, y, z, maxRes, earthRadius): # {{{
Uses a formula for interpolating unit vectors on the sphere from
https://en.wikipedia.org/wiki/Slerp
Parameters
----------
x : numpy.array
y : numpy.array
z : numpy.array
The cartsian coordinates of a transect, where the number of segments
x, y, z : numpy.array
The Cartesian coordinates of a transect, where the number of segments
is ``len(x) - 1``. ``x``, ``y`` and ``z`` are of the same length.
maxRes : float
Expand All @@ -408,9 +407,7 @@ def subdivide_great_circle(x, y, z, maxRes, earthRadius): # {{{
Returns
-------
xOut : numpy.array
yOut : numpy.array
zOut : numpy.array
xOut, yOut, zOut : numpy.array
The transect subdivided into segments with segment length at most
``maxRes``. All the points in ``x``, ``y`` and ``z`` are guaranteed
to be included.
Expand Down

0 comments on commit 00f2431

Please sign in to comment.