From 8913b4f1bbd79884cb31563d6c091d8df5c2f6e1 Mon Sep 17 00:00:00 2001 From: Meghan Jones Date: Mon, 22 Feb 2021 07:34:14 -1000 Subject: [PATCH 1/2] Update docstrings links for return classes --- pygmt/src/blockmedian.py | 8 +++++--- pygmt/src/grdcut.py | 17 +++++++++-------- pygmt/src/grdfilter.py | 8 +++++--- pygmt/src/grdtrack.py | 19 ++++++++++--------- pygmt/src/info.py | 6 +++--- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/pygmt/src/blockmedian.py b/pygmt/src/blockmedian.py index 0af32ff714f..1a5f80337dd 100644 --- a/pygmt/src/blockmedian.py +++ b/pygmt/src/blockmedian.py @@ -56,10 +56,12 @@ def blockmedian(table, outfile=None, **kwargs): Returns ------- output : pandas.DataFrame or None - Return type depends on whether the outfile parameter is set: + Return type depends on whether the ``outfile`` parameter is set: - - pandas.DataFrame table with (x, y, z) columns if outfile is not set - - None if outfile is set (filtered output will be stored in outfile) + - :class:`pandas.DataFrame` table with (x, y, z) columns if ``outfile`` + is not set + - None if ``outfile`` is set (filtered output will be stored in file + set by ``outfile``) """ kind = data_kind(table) with GMTTempFile(suffix=".csv") as tmpfile: diff --git a/pygmt/src/grdcut.py b/pygmt/src/grdcut.py index 2f5277d1535..5c33abbdb3b 100644 --- a/pygmt/src/grdcut.py +++ b/pygmt/src/grdcut.py @@ -32,13 +32,13 @@ def grdcut(grid, **kwargs): Extract subregion from a grid. Produce a new ``outgrid`` file which is a subregion of ``grid``. The - subregion is specified with *region*; the specified range must not exceed - the range of *grid* (but see *extend*). If in doubt, run + subregion is specified with ``region``; the specified range must not exceed + the range of ``grid`` (but see ``extend``). If in doubt, run :meth:`pygmt.grdinfo` to check range. Alternatively, define the subregion indirectly via a range check on the node values or via distances from a - given point. Finally, you can give *projection* for oblique projections to - determine the corresponding rectangular *region* setting that will give a - grid that fully covers the oblique domain. + given point. Finally, you can give ``projection`` for oblique projections + to determine the corresponding rectangular ``region`` that will give a grid + that fully covers the oblique domain. Full option list at :gmt-docs:`grdcut.html` @@ -83,10 +83,11 @@ def grdcut(grid, **kwargs): Returns ------- ret: xarray.DataArray or None - Return type depends on whether the *outgrid* parameter is set: + Return type depends on whether the ``outgrid`` parameter is set: - - xarray.DataArray if *outgrid* is not set - - None if *outgrid* is set (grid output will be stored in *outgrid*) + - :class:`xarray.DataArray` if ``outgrid`` is not set + - None if ``outgrid`` is set (grid output will be stored in file set by + ``outgrid``) """ kind = data_kind(grid) diff --git a/pygmt/src/grdfilter.py b/pygmt/src/grdfilter.py index 702ed009742..55de5cbb020 100644 --- a/pygmt/src/grdfilter.py +++ b/pygmt/src/grdfilter.py @@ -115,9 +115,11 @@ def grdfilter(grid, **kwargs): Returns ------- ret: xarray.DataArray or None - Return type depends on whether the *outgrid* parameter is set: - - xarray.DataArray if *outgrid* is not set - - None if *outgrid* is set (grid output will be stored in *outgrid*) + Return type depends on whether the ``outgrid`` parameter is set: + + - :class:`xarray.DataArray` if ``outgrid`` is not set + - None if ``outgrid`` is set (grid output will be stored in file set by + ``outgrid``) Examples -------- diff --git a/pygmt/src/grdtrack.py b/pygmt/src/grdtrack.py index 6c3ce18bd8b..5630795e25f 100644 --- a/pygmt/src/grdtrack.py +++ b/pygmt/src/grdtrack.py @@ -26,7 +26,7 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): table with the interpolated values added as (one or more) new columns. A bicubic [Default], bilinear, B-spline or nearest-neighbor interpolation is used, requiring boundary conditions at the limits of the region (see - *interpolation*; Default uses “natural” conditions (second partial + ``interpolation``; Default uses “natural” conditions (second partial derivative normal to edge is zero) unless the grid is automatically recognized as periodic.) @@ -46,12 +46,12 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): format). newcolname : str - Required if 'points' is a pandas.DataFrame. The name for the new column - in the track pandas.DataFrame table where the sampled values will be - placed. + Required if ``points`` is a :class:`pandas.DataFrame`. The name for the + new column in the track :class:`pandas.DataFrame` table where the + sampled values will be placed. outfile : str - Required if 'points' is a file. The file name for the output ASCII + Required if ``points`` is a file. The file name for the output ASCII file. {V} @@ -61,11 +61,12 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): Returns ------- track: pandas.DataFrame or None - Return type depends on whether the outfile parameter is set: + Return type depends on whether the ``outfile`` parameter is set: - - pandas.DataFrame table with (x, y, ..., newcolname) if outfile is not - set - - None if outfile is set (track output will be stored in outfile) + - :class:`pandas.DataFrame` table with (x, y, ..., newcolname) if + ``outfile`` is not set + - None if ``outfile`` is set (track output will be stored in file set + by ``outfile``) """ with GMTTempFile(suffix=".csv") as tmpfile: diff --git a/pygmt/src/info.py b/pygmt/src/info.py index 490f820abc1..8699a11edfd 100644 --- a/pygmt/src/info.py +++ b/pygmt/src/info.py @@ -30,8 +30,8 @@ def info(table, **kwargs): and *dy* are needed). If the ``per_column`` parameter is combined with ``spacing``, then the numpy.ndarray output will be rounded up/down for as many columns as there are increments provided in ``spacing``. A similar - parameter ``nearest_multiple`` option will provide a numpy.ndarray in the - form of [*zmin*, *zmax*, *dz*]`` for makecpt. + parameter ``nearest_multiple`` will provide a numpy.ndarray in the form + of ``[zmin, zmax, dz]`` for makecpt. Full option list at :gmt-docs:`gmtinfo.html` @@ -63,7 +63,7 @@ def info(table, **kwargs): Return type depends on whether any of the ``per_column``, ``spacing``, or ``nearest_multiple`` parameters are set. - - np.ndarray if either of the above parameters are used. + - :class:`numpy.ndarray` if either of the above parameters are used. - str if none of the above parameters are used. """ kind = data_kind(table) From 31ae57dbe549795a76f8a6d7b0c803c9fa25c95b Mon Sep 17 00:00:00 2001 From: Meghan Jones Date: Mon, 22 Feb 2021 12:54:11 -0500 Subject: [PATCH 2/2] Update pygmt/src/info.py Co-authored-by: Dongdong Tian --- pygmt/src/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/info.py b/pygmt/src/info.py index 8699a11edfd..e8d3730aeb3 100644 --- a/pygmt/src/info.py +++ b/pygmt/src/info.py @@ -31,7 +31,7 @@ def info(table, **kwargs): ``spacing``, then the numpy.ndarray output will be rounded up/down for as many columns as there are increments provided in ``spacing``. A similar parameter ``nearest_multiple`` will provide a numpy.ndarray in the form - of ``[zmin, zmax, dz]`` for makecpt. + of [*zmin*, *zmax*, *dz*] for makecpt. Full option list at :gmt-docs:`gmtinfo.html`