Skip to content

Commit 6d915a4

Browse files
weiji14seisman
andauthored
Add common alias spacing (-I) for specifying grid increments (#1288)
Used to specify the grid spacing. See also https://github.com/GenericMappingTools/gmt/blob/6.2.0rc1/doc/rst/source/explain_-I.rst_. * Use standardized spacing (I) docstring in blockmean, blockmedian, grdfilter and surface Co-authored-by: Dongdong Tian <[email protected]>
1 parent d2a43b6 commit 6d915a4

File tree

4 files changed

+35
-16
lines changed

4 files changed

+35
-16
lines changed

pygmt/helpers/decorators.py

+31
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,37 @@
4040
color : str or 1d array
4141
Select color or pattern for filling of symbols or polygons. Default
4242
is no fill.""",
43+
"I": r"""
44+
spacing : str
45+
*xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]].
46+
*x_inc* [and optionally *y_inc*] is the grid spacing.
47+
48+
- **Geographical (degrees) coordinates**: Optionally, append an
49+
increment unit. Choose among **m** to indicate arc minutes or
50+
**s** to indicate arc seconds. If one of the units **e**, **f**,
51+
**k**, **M**, **n** or **u** is appended instead, the increment
52+
is assumed to be given in meter, foot, km, mile, nautical mile or
53+
US survey foot, respectively, and will be converted to the
54+
equivalent degrees longitude at the middle latitude of the region
55+
(the conversion depends on :gmt-term:`PROJ_ELLIPSOID`). If
56+
*y_inc* is given but set to 0 it will be reset equal to *x_inc*;
57+
otherwise it will be converted to degrees latitude.
58+
59+
- **All coordinates**: If **+e** is appended then the corresponding
60+
max *x* (*east*) or *y* (*north*) may be slightly adjusted to fit
61+
exactly the given increment [by default the increment may be
62+
adjusted slightly to fit the given domain]. Finally, instead of
63+
giving an increment you may specify the *number of nodes* desired
64+
by appending **+n** to the supplied integer argument; the
65+
increment is then recalculated from the number of nodes, the
66+
*registration*, and the domain. The resulting increment value
67+
depends on whether you have selected a gridline-registered or
68+
pixel-registered grid; see :gmt-docs:`GMT File Formats
69+
<cookbook/file-formats.html#gmt-file-formats>` for details.
70+
71+
**Note**: If ``region=grdfile`` is used then the grid spacing and
72+
the registration have already been initialized; use ``spacing`` and
73+
``registration`` to override these values.""",
4374
"V": """\
4475
verbose : bool or str
4576
Select verbosity level [Default is **w**], which modulates the messages

pygmt/src/blockm.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ def blockmean(table, outfile=None, **kwargs):
9292
providing a file name to an ASCII data table, a 2D
9393
{table-classes}.
9494
95-
spacing : str
96-
*xinc*\[\ *unit*\][**+e**\|\ **n**]
97-
[/*yinc*\ [*unit*][**+e**\|\ **n**]].
98-
*xinc* [and optionally *yinc*] is the grid spacing.
95+
{I}
9996
10097
region : str or list
10198
*xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*].
@@ -152,10 +149,7 @@ def blockmedian(table, outfile=None, **kwargs):
152149
providing a file name to an ASCII data table, a 2D
153150
{table-classes}.
154151
155-
spacing : str
156-
*xinc*\[\ *unit*\][**+e**\|\ **n**]
157-
[/*yinc*\ [*unit*][**+e**\|\ **n**]].
158-
*xinc* [and optionally *yinc*] is the grid spacing.
152+
{I}
159153
160154
region : str or list
161155
*xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*].

pygmt/src/grdfilter.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ def grdfilter(grid, **kwargs):
9797
5: grid (x,y) in Mercator ``projection='m1'`` img units, *width* in km,
9898
Spherical distance calculation.
9999
100-
spacing : str
101-
*xinc*\[\ *unit*\][**+e**\|\ **n**]
102-
[/*yinc*\ [*unit*][**+e**\|\ **n**]].
103-
*xinc* [and optionally *yinc*] is the grid spacing.
100+
{I}
104101
nans : str or float
105102
**i**\|\ **p**\|\ **r**.
106103
Determine how NaN-values in the input grid affects the filtered output.

pygmt/src/surface.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ def surface(x=None, y=None, z=None, data=None, **kwargs):
5454
data : str or 2d array
5555
Either a data file name or a 2d numpy array with the tabular data.
5656
57-
spacing : str
58-
*xinc*\[\ *unit*\][**+e**\|\ **n**]\
59-
[/*yinc*\ [*unit*][**+e**\|\ **n**]].
60-
*xinc* [and optionally *yinc*] is the grid spacing.
57+
{I}
6158
6259
region : str or list
6360
*xmin/xmax/ymin/ymax*\[**+r**][**+u**\ *unit*].

0 commit comments

Comments
 (0)