From ddf2b4d39bf13a1420c60cf5f311a09d1c1f0bee Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 24 May 2021 14:44:21 +1200 Subject: [PATCH 1/4] Add common alias spacing (-I) for specifying grid increments Used to specify the grid spacing. See also https://github.com/GenericMappingTools/gmt/blob/6.2.0rc1/doc/rst/source/explain_-I.rst_. --- pygmt/helpers/decorators.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index d3d66a6cb98..79b3a50a341 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -40,6 +40,37 @@ color : str or 1d array Select color or pattern for filling of symbols or polygons. Default is no fill.""", + "I": """\ + spacing : str + *xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]]. + *x_inc* [and optionally *y_inc*] is the grid spacing. + + - **Geographical (degrees) coordinates**: Optionally, append an + increment unit. Choose among **m** to indicate arc minutes or + **s** to indicate arc seconds. If one of the units **e**, **f**, + **k**, **M**, **n** or **u** is appended instead, the increment + is assumed to be given in meter, foot, km, mile, nautical mile or + US survey foot, respectively, and will be converted to the + equivalent degrees longitude at the middle latitude of the region + (the conversion depends on :gmt-term:`PROJ_ELLIPSOID`). If + *y_inc* is given but set to 0 it will be reset equal to *x_inc*; + otherwise it will be converted to degrees latitude. + + - **All coordinates**: If **+e** is appended then the corresponding + max *x* (*east*) or *y* (*north*) may be slightly adjusted to fit + exactly the given increment [by default the increment may be + adjusted slightly to fit the given domain]. Finally, instead of + giving an increment you may specify the *number of nodes* desired + by appending **+n** to the supplied integer argument; the + increment is then recalculated from the number of nodes, the + *registration*, and the domain. The resulting increment value + depends on whether you have selected a gridline-registered or + pixel-registered grid; see :gmt-docs:`GMT File Formats + ` for details. + + **Note**: If ``region=grdfile`` is used then the grid spacing and + the registration have already been initialized; use ``spacing`` and + ``registration`` to override these values.""", "V": """\ verbose : bool or str Select verbosity level [Default is **w**], which modulates the messages From 531c3a808909660a62fcc8df0e154a0f2d827899 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 24 May 2021 14:47:45 +1200 Subject: [PATCH 2/4] Use standardized spacing (I) docstring in blockm, grdfilter and surface --- pygmt/src/blockm.py | 10 ++-------- pygmt/src/grdfilter.py | 5 +---- pygmt/src/surface.py | 5 +---- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/pygmt/src/blockm.py b/pygmt/src/blockm.py index a9cf45f4616..b22a46477a1 100644 --- a/pygmt/src/blockm.py +++ b/pygmt/src/blockm.py @@ -100,10 +100,7 @@ def blockmean(table, outfile=None, **kwargs): elevation) values in the first three columns, or a file name to an ASCII data table. - spacing : str - *xinc*\[\ *unit*\][**+e**\|\ **n**] - [/*yinc*\ [*unit*][**+e**\|\ **n**]]. - *xinc* [and optionally *yinc*] is the grid spacing. + {I} region : str or list *xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*]. @@ -161,10 +158,7 @@ def blockmedian(table, outfile=None, **kwargs): elevation) values in the first three columns, or a file name to an ASCII data table. - spacing : str - *xinc*\[\ *unit*\][**+e**\|\ **n**] - [/*yinc*\ [*unit*][**+e**\|\ **n**]]. - *xinc* [and optionally *yinc*] is the grid spacing. + {I} region : str or list *xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*]. diff --git a/pygmt/src/grdfilter.py b/pygmt/src/grdfilter.py index a9876a1bb35..46debc21534 100644 --- a/pygmt/src/grdfilter.py +++ b/pygmt/src/grdfilter.py @@ -97,10 +97,7 @@ def grdfilter(grid, **kwargs): 5: grid (x,y) in Mercator ``projection='m1'`` img units, *width* in km, Spherical distance calculation. - spacing : str - *xinc*\[\ *unit*\][**+e**\|\ **n**] - [/*yinc*\ [*unit*][**+e**\|\ **n**]]. - *xinc* [and optionally *yinc*] is the grid spacing. + {I} nans : str or float **i**\|\ **p**\|\ **r**. Determine how NaN-values in the input grid affects the filtered output. diff --git a/pygmt/src/surface.py b/pygmt/src/surface.py index 70bee5978f5..1d24a438595 100644 --- a/pygmt/src/surface.py +++ b/pygmt/src/surface.py @@ -54,10 +54,7 @@ def surface(x=None, y=None, z=None, data=None, **kwargs): data : str or 2d array Either a data file name or a 2d numpy array with the tabular data. - spacing : str - *xinc*\[\ *unit*\][**+e**\|\ **n**]\ - [/*yinc*\ [*unit*][**+e**\|\ **n**]]. - *xinc* [and optionally *yinc*] is the grid spacing. + {I} region : str or list *xmin/xmax/ymin/ymax*\[**+r**][**+u**\ *unit*]. From 4cbd03ad47fcc52eb0cbb7bfeab932a977c5119a Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 24 May 2021 15:02:36 +1200 Subject: [PATCH 3/4] Use raw-string for spacing (-I) docstring --- pygmt/helpers/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 79b3a50a341..b1cf08767d6 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -40,7 +40,7 @@ color : str or 1d array Select color or pattern for filling of symbols or polygons. Default is no fill.""", - "I": """\ + "I": r"""\ spacing : str *xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]]. *x_inc* [and optionally *y_inc*] is the grid spacing. From cab6ac1904c716e83bdd0cea95e0b1dbe448a5ff Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 25 May 2021 09:07:05 +1200 Subject: [PATCH 4/4] Remove backslash in spacing (I) docstring Co-authored-by: Dongdong Tian --- pygmt/helpers/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index b1cf08767d6..96ad7687456 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -40,7 +40,7 @@ color : str or 1d array Select color or pattern for filling of symbols or polygons. Default is no fill.""", - "I": r"""\ + "I": r""" spacing : str *xinc*\ [**+e**\|\ **n**][/\ *yinc*\ [**+e**\|\ **n**]]. *x_inc* [and optionally *y_inc*] is the grid spacing.