Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import functools
import string
import textwrap
import warnings
from inspect import Parameter, signature
Expand Down Expand Up @@ -410,11 +411,11 @@ def fmt_docstring(module_func):
... ----------
... data
... Pass in either a file name to an ASCII data table, a 2-D
... {table-classes}.
... {region}
... {projection}
... $table_classes.
... $region
... $projection
...
... {aliases}
... $aliases
... '''
... pass
>>> print(gmtinfo.__doc__)
Expand Down Expand Up @@ -456,7 +457,7 @@ def fmt_docstring(module_func):
aliases.append(f" - {arg} = {alias}")
filler_text["aliases"] = "\n".join(aliases)

filler_text["table-classes"] = (
filler_text["table_classes"] = (
":class:`numpy.ndarray`, a :class:`pandas.DataFrame`, an\n"
" :class:`xarray.Dataset` made up of 1-D :class:`xarray.DataArray`\n"
" data variables, or a :class:`geopandas.GeoDataFrame` containing the\n"
Expand All @@ -471,8 +472,7 @@ def fmt_docstring(module_func):
# Dedent the docstring to make it all match the option text.
docstring = textwrap.dedent(module_func.__doc__)

module_func.__doc__ = docstring.format(**filler_text)

module_func.__doc__ = string.Template(docstring).safe_substitute(**filler_text)
return module_func


Expand Down
18 changes: 9 additions & 9 deletions pygmt/src/basemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def basemap(

Full GMT docs at :gmt-docs:`basemap.html`.

{aliases}
$aliases
- B = frame
- J = projection
- Jz = zscale
Expand All @@ -58,12 +58,12 @@ def basemap(

Parameters
----------
{projection}
$projection
zscale/zsize
Set z-axis scaling or z-axis size.
{region}
$region
*Required if this is the first plot command.*
{frame}
$frame
map_scale : str
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
**+w**\ *length*.
Expand Down Expand Up @@ -92,11 +92,11 @@ def basemap(
compass : str
Draw a map magnetic rose on the map at the location defined by the
reference and anchor points.
{verbose}
{panel}
{coltypes}
{perspective}
{transparency}
$verbose
$panel
$coltypes
$perspective
$transparency
"""
self._activate_figure()

Expand Down
22 changes: 11 additions & 11 deletions pygmt/src/binstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def binstats(

Full GMT docs at :gmt-docs:`gmtbinstats.html`.

{aliases}
$aliases
- C = statistic
- I = spacing
- R = region
Expand All @@ -76,8 +76,8 @@ def binstats(
Parameters
----------
data
A file name of an ASCII data table or a 2-D {table-classes}.
{outgrid}
A file name of an ASCII data table or a 2-D $table_classes.
$outgrid
statistic
Choose the statistic that will be computed per node based on the points that are
within *radius* distance of the node. Select one of:
Expand Down Expand Up @@ -116,14 +116,14 @@ def binstats(
computed while the count will be the sum of the weights instead of
number of points. If the weights are actually uncertainties
(one sigma) then append **+s** and weight = 1/sigma.
{spacing}
{region}
{verbose}
{aspatial}
{binary}
{header}
{incols}
{registration}
$spacing
$region
$verbose
$aspatial
$binary
$header
$incols
$registration

Returns
-------
Expand Down
102 changes: 51 additions & 51 deletions pygmt/src/blockm.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def blockmean( # noqa: PLR0913
Full GMT docs at :gmt-docs:`blockmean.html`.
{aliases}
$aliases
- I = spacing
- R = region
- V = verbose
Expand All @@ -124,12 +124,12 @@ def blockmean( # noqa: PLR0913
data
Pass in (x, y, z) or (longitude, latitude, elevation) values by
providing a file name to an ASCII data table, a 2-D
{table-classes}.
$table_classes.
x/y/z : 1-D arrays
Arrays of x and y coordinates and values z of the data points.
{output_type}
{outfile}
{spacing}
$output_type
$outfile
$spacing
summary : str
[**m**\|\ **n**\|\ **s**\|\ **w**].
Type of summary values calculated by blockmean.
Expand All @@ -138,18 +138,18 @@ def blockmean( # noqa: PLR0913
- **n**: report the number of input points inside each block
- **s**: report the sum of all z-values inside a block
- **w**: report the sum of weights
{region}
{verbose}
{aspatial}
{binary}
{nodata}
{find}
{incols}
{coltypes}
{header}
{outcols}
{registration}
{wrap}
$region
$verbose
$aspatial
$binary
$nodata
$find
$incols
$coltypes
$header
$outcols
$registration
$wrap
Returns
-------
Expand Down Expand Up @@ -226,7 +226,7 @@ def blockmedian( # noqa: PLR0913
Full GMT docs at :gmt-docs:`blockmedian.html`.
{aliases}
$aliases
- I = spacing
- R = region
- V = verbose
Expand All @@ -239,24 +239,24 @@ def blockmedian( # noqa: PLR0913
data
Pass in (x, y, z) or (longitude, latitude, elevation) values by
providing a file name to an ASCII data table, a 2-D
{table-classes}.
$table_classes.
x/y/z : 1-D arrays
Arrays of x and y coordinates and values z of the data points.
{output_type}
{outfile}
{spacing}
{region}
{verbose}
{aspatial}
{binary}
{nodata}
{find}
{coltypes}
{header}
{incols}
{outcols}
{registration}
{wrap}
$output_type
$outfile
$spacing
$region
$verbose
$aspatial
$binary
$nodata
$find
$coltypes
$header
$incols
$outcols
$registration
$wrap
Returns
-------
Expand Down Expand Up @@ -341,7 +341,7 @@ def blockmode( # noqa: PLR0913
Full GMT docs at :gmt-docs:`blockmode.html`.
{aliases}
$aliases
- I = spacing
- R = region
- V = verbose
Expand All @@ -354,24 +354,24 @@ def blockmode( # noqa: PLR0913
data
Pass in (x, y, z) or (longitude, latitude, elevation) values by
providing a file name to an ASCII data table, a 2-D
{table-classes}.
$table_classes.
x/y/z : 1-D arrays
Arrays of x and y coordinates and values z of the data points.
{output_type}
{outfile}
{spacing}
{region}
{verbose}
{aspatial}
{binary}
{nodata}
{find}
{coltypes}
{header}
{incols}
{outcols}
{registration}
{wrap}
$output_type
$outfile
$spacing
$region
$verbose
$aspatial
$binary
$nodata
$find
$coltypes
$header
$incols
$outcols
$registration
$wrap
Returns
-------
Expand Down
18 changes: 9 additions & 9 deletions pygmt/src/coast.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def coast(

Full GMT docs at :gmt-docs:`coast.html`.

{aliases}
$aliases
- B = frame
- D = resolution
- F = box
Expand All @@ -79,11 +79,11 @@ def coast(

Parameters
----------
{projection}
{region}
$projection
$region
*Required if this is the first plot command.*
{area_thresh}
{frame}
$area_thresh
$frame
lakes : str or list
*fill*\ [**+l**\|\ **+r**].
Set the shade, color, or pattern for lakes and river-lakes. The
Expand Down Expand Up @@ -172,10 +172,10 @@ def coast(
to any of the continent codes (e.g. ``"=EU"`` for Europe). Append
**+p**\ *pen* to draw polygon outlines [Default is no outline] and
**+g**\ *fill* to fill them [Default is no fill].
{panel}
{perspective}
{transparency}
{verbose}
$panel
$perspective
$transparency
$verbose

Example
-------
Expand Down
14 changes: 7 additions & 7 deletions pygmt/src/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def colorbar(
.. note::
For GMT >=6.5.0, the fontsizes of the colorbar x-label, x-annotations,
and y-label are scaled based on the width of the colorbar following
:math:`\sqrt{{colorbar\_width / 15}}`. To set a desired fontsize via the
:math:`\sqrt{colorbar\_width / 15}`. To set a desired fontsize via the
GMT default parameters :gmt-term:`FONT_ANNOT_PRIMARY`,
:gmt-term:`FONT_ANNOT_SECONDARY`, and :gmt-term:`FONT_LABEL` (or jointly
:gmt-term:`FONT`) users have to divide the desired fontsize by the value
Expand All @@ -56,7 +56,7 @@ def colorbar(

Full GMT docs at :gmt-docs:`colorbar.html`.

{aliases}
$aliases
- B = frame
- F = box
- I = shading
Expand All @@ -71,7 +71,7 @@ def colorbar(
----------
frame : str or list
Set colorbar boundary frame, labels, and axes attributes.
{cmap}
$cmap
position : str
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
[**+w**\ *length*\ [/\ *width*]]\ [**+e**\ [**b**\|\ **f**][*length*]]\
Expand Down Expand Up @@ -135,10 +135,10 @@ def colorbar(
may be in plot distance units or given as relative fractions and will
be automatically scaled so that the sum of the widths equals the
requested colorbar length.
{verbose}
{panel}
{perspective}
{transparency}
$verbose
$panel
$perspective
$transparency

Example
-------
Expand Down
Loading
Loading