Skip to content

Commit c7736c1

Browse files
Meghan Jonesseisman
Meghan Jones
andauthored
Update docstrings links for return classes (#954)
This PR adds links to xarray, pandas, and numpy classes in the Returns section of the docstrings. It also includes a few small fixes according to the conventions set in #631. Co-authored-by: Dongdong Tian <[email protected]>
1 parent 328b998 commit c7736c1

File tree

5 files changed

+32
-26
lines changed

5 files changed

+32
-26
lines changed

pygmt/src/blockmedian.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ def blockmedian(table, outfile=None, **kwargs):
5656
Returns
5757
-------
5858
output : pandas.DataFrame or None
59-
Return type depends on whether the outfile parameter is set:
59+
Return type depends on whether the ``outfile`` parameter is set:
6060
61-
- pandas.DataFrame table with (x, y, z) columns if outfile is not set
62-
- None if outfile is set (filtered output will be stored in outfile)
61+
- :class:`pandas.DataFrame` table with (x, y, z) columns if ``outfile``
62+
is not set
63+
- None if ``outfile`` is set (filtered output will be stored in file
64+
set by ``outfile``)
6365
"""
6466
kind = data_kind(table)
6567
with GMTTempFile(suffix=".csv") as tmpfile:

pygmt/src/grdcut.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ def grdcut(grid, **kwargs):
3232
Extract subregion from a grid.
3333
3434
Produce a new ``outgrid`` file which is a subregion of ``grid``. The
35-
subregion is specified with *region*; the specified range must not exceed
36-
the range of *grid* (but see *extend*). If in doubt, run
35+
subregion is specified with ``region``; the specified range must not exceed
36+
the range of ``grid`` (but see ``extend``). If in doubt, run
3737
:meth:`pygmt.grdinfo` to check range. Alternatively, define the subregion
3838
indirectly via a range check on the node values or via distances from a
39-
given point. Finally, you can give *projection* for oblique projections to
40-
determine the corresponding rectangular *region* setting that will give a
41-
grid that fully covers the oblique domain.
39+
given point. Finally, you can give ``projection`` for oblique projections
40+
to determine the corresponding rectangular ``region`` that will give a grid
41+
that fully covers the oblique domain.
4242
4343
Full option list at :gmt-docs:`grdcut.html`
4444
@@ -83,10 +83,11 @@ def grdcut(grid, **kwargs):
8383
Returns
8484
-------
8585
ret: xarray.DataArray or None
86-
Return type depends on whether the *outgrid* parameter is set:
86+
Return type depends on whether the ``outgrid`` parameter is set:
8787
88-
- xarray.DataArray if *outgrid* is not set
89-
- None if *outgrid* is set (grid output will be stored in *outgrid*)
88+
- :class:`xarray.DataArray` if ``outgrid`` is not set
89+
- None if ``outgrid`` is set (grid output will be stored in file set by
90+
``outgrid``)
9091
"""
9192
kind = data_kind(grid)
9293

pygmt/src/grdfilter.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ def grdfilter(grid, **kwargs):
115115
Returns
116116
-------
117117
ret: xarray.DataArray or None
118-
Return type depends on whether the *outgrid* parameter is set:
119-
- xarray.DataArray if *outgrid* is not set
120-
- None if *outgrid* is set (grid output will be stored in *outgrid*)
118+
Return type depends on whether the ``outgrid`` parameter is set:
119+
120+
- :class:`xarray.DataArray` if ``outgrid`` is not set
121+
- None if ``outgrid`` is set (grid output will be stored in file set by
122+
``outgrid``)
121123
122124
Examples
123125
--------

pygmt/src/grdtrack.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs):
2626
table with the interpolated values added as (one or more) new columns. A
2727
bicubic [Default], bilinear, B-spline or nearest-neighbor interpolation is
2828
used, requiring boundary conditions at the limits of the region (see
29-
*interpolation*; Default uses “natural” conditions (second partial
29+
``interpolation``; Default uses “natural” conditions (second partial
3030
derivative normal to edge is zero) unless the grid is automatically
3131
recognized as periodic.)
3232
@@ -46,12 +46,12 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs):
4646
format).
4747
4848
newcolname : str
49-
Required if 'points' is a pandas.DataFrame. The name for the new column
50-
in the track pandas.DataFrame table where the sampled values will be
51-
placed.
49+
Required if ``points`` is a :class:`pandas.DataFrame`. The name for the
50+
new column in the track :class:`pandas.DataFrame` table where the
51+
sampled values will be placed.
5252
5353
outfile : str
54-
Required if 'points' is a file. The file name for the output ASCII
54+
Required if ``points`` is a file. The file name for the output ASCII
5555
file.
5656
5757
{V}
@@ -61,11 +61,12 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs):
6161
Returns
6262
-------
6363
track: pandas.DataFrame or None
64-
Return type depends on whether the outfile parameter is set:
64+
Return type depends on whether the ``outfile`` parameter is set:
6565
66-
- pandas.DataFrame table with (x, y, ..., newcolname) if outfile is not
67-
set
68-
- None if outfile is set (track output will be stored in outfile)
66+
- :class:`pandas.DataFrame` table with (x, y, ..., newcolname) if
67+
``outfile`` is not set
68+
- None if ``outfile`` is set (track output will be stored in file set
69+
by ``outfile``)
6970
"""
7071

7172
with GMTTempFile(suffix=".csv") as tmpfile:

pygmt/src/info.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def info(table, **kwargs):
3030
and *dy* are needed). If the ``per_column`` parameter is combined with
3131
``spacing``, then the numpy.ndarray output will be rounded up/down for as
3232
many columns as there are increments provided in ``spacing``. A similar
33-
parameter ``nearest_multiple`` option will provide a numpy.ndarray in the
34-
form of [*zmin*, *zmax*, *dz*]`` for makecpt.
33+
parameter ``nearest_multiple`` will provide a numpy.ndarray in the form
34+
of [*zmin*, *zmax*, *dz*] for makecpt.
3535
3636
Full option list at :gmt-docs:`gmtinfo.html`
3737
@@ -63,7 +63,7 @@ def info(table, **kwargs):
6363
Return type depends on whether any of the ``per_column``,
6464
``spacing``, or ``nearest_multiple`` parameters are set.
6565
66-
- np.ndarray if either of the above parameters are used.
66+
- :class:`numpy.ndarray` if either of the above parameters are used.
6767
- str if none of the above parameters are used.
6868
"""
6969
kind = data_kind(table)

0 commit comments

Comments
 (0)