Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update COMMON_OPTIONS arguments to GMT standard #783

Closed
Changes from 18 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7e0892b
Update region arguments docstring in decorators.py
willschlitzer Jan 2, 2021
62e8aad
Merge branch 'master' into common-options-doc-update
willschlitzer Jan 21, 2021
6c870fe
Removing raw string from COMMON_OPTIONS
willschlitzer Jan 21, 2021
3793b78
Update region doc string
willschlitzer Jan 21, 2021
81d4653
Update projection doc string
willschlitzer Jan 21, 2021
75c8c83
Merge branch 'master' into common-options-doc-update
willschlitzer Jan 22, 2021
cd28c78
Update pygmt/helpers/decorators.py
willschlitzer Jan 22, 2021
0d6180f
Add full-stop period
willschlitzer Jan 22, 2021
96acac0
Fix formatting typo
willschlitzer Jan 22, 2021
ccae62b
Updating COMMON_OPTIONS test
willschlitzer Jan 22, 2021
30993fd
Fix trailing whitespaces
willschlitzer Jan 22, 2021
a0d3c77
Merge branch 'master' into common-options-doc-update
seisman Feb 7, 2021
9d207c0
Update pygmt/helpers/decorators.py
willschlitzer Feb 8, 2021
15b66c0
Merge branch 'master' into common-options-doc-update
willschlitzer Feb 8, 2021
dafc436
Update common options to use raw strings
willschlitzer Feb 8, 2021
3a7e4ec
Change remaining COMMON_OPTIONS to use raw strings
willschlitzer Feb 8, 2021
e432f2e
Fix style errors
willschlitzer Feb 8, 2021
d35d7d7
Fix style errors
willschlitzer Feb 8, 2021
2fe9720
Update XY doc
willschlitzer Feb 9, 2021
6393047
Update distcalc doc
willschlitzer Feb 9, 2021
09bfb6d
Update interpolation doc
willschlitzer Feb 9, 2021
e6ef47d
Update perspective doc
willschlitzer Feb 9, 2021
a82bf6c
Update cores doc; remove unnecessary raw strings
willschlitzer Feb 9, 2021
c0a096d
Merge branch 'master' into common-options-doc-update
willschlitzer Feb 9, 2021
af72e6f
Fix trailing whitespace
willschlitzer Feb 9, 2021
5459dd5
Apply suggestions from code review
willschlitzer Feb 10, 2021
bc6f1e8
Add blank lines to change render
willschlitzer Feb 10, 2021
5609b6e
Merge remote-tracking branch 'origin/common-options-doc-update' into …
willschlitzer Feb 10, 2021
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
193 changes: 87 additions & 106 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,111 +13,91 @@
from pygmt.helpers.utils import is_nonstr_iter

COMMON_OPTIONS = {
"R": """\
region : str or list
*Required if this is the first plot command*.
``'xmin/xmax/ymin/ymax[+r][+uunit]'``.
Specify the region of interest.""",
"J": """\
projection : str
*Required if this is the first plot command*.
Select map projection.""",
"B": """\
frame : str or list
Set map boundary frame and axes attributes.""",
"U": """\
timestamp : bool or str
Draw GMT time stamp logo on plot.""",
"CPT": """\
cmap : str
File name of a CPT file or ``C='color1,color2[,color3,...]'`` to
build a linear continuous CPT from those colors automatically.""",
"G": """\
color : str
Select color or pattern for filling of symbols or polygons. Default
is no fill.""",
"V": """\
verbose : str
Select verbosity level [Default is w], which modulates the messages
written to stderr. Choose among 7 levels of verbosity:

- **q** - Quiet, not even fatal error messages are produced
- **e** - Error messages only
- **w** - Warnings [Default]
- **t** - Timings (report runtimes for time-intensive algorthms);
- **i** - Informational messages (same as "verbose=True")
- **c** - Compatibility warnings
- **d** - Debugging messages""",
"W": """\
pen : str
Set pen attributes for lines or the outline of symbols.""",
"XY": """\
xshift : str
``[a|c|f|r][xshift]``.
Shift plot origin in x-direction.
yshift : str
``[a|c|f|r][yshift]``.
Shift plot origin in y-direction. Full documentation is at
:gmt-docs:`gmt.html#xy-full`.
""",
"j": """\
distcalc : str
``e|f|g``.
Determine how spherical distances are calculated.

- **e** - Ellipsoidal (or geodesic) mode
- **f** - Flat Earth mode
- **g** - Great circle distance [Default]

All spherical distance calculations depend on the current ellipsoid
(PROJ_ELLIPSOID), the definition of the mean radius
(PROJ_MEAN_RADIUS), and the specification of latitude type
(PROJ_AUX_LATITUDE). Geodesic distance calculations is also
controlled by method (PROJ_GEODESIC).""",
"n": """\
interpolation : str
``[b|c|l|n][+a][+bBC][+c][+tthreshold]``
Select interpolation mode for grids. You can select the type of
spline used:

- 'b' for B-spline
- 'c' for bicubic [Default]
- 'l' for bilinear
- 'n' for nearest-neighbor""",
"p": """\
perspective : list or str
``'[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]'``.
Select perspective view and set the azimuth and elevation angle of
the viewpoint. Default is [180, 90]. Full documentation is at
:gmt-docs:`gmt.html#perspective-full`.
""",
"registration": """\
registration : str
``[g|p]``
Force output grid to be gridline (g) or pixel (p) node registered.
Default is gridline (g).""",
"t": """\
transparency : float
Set transparency level, in [0-100] percent range.
Default is 0, i.e., opaque.
Only visible when PDF or raster format output is selected.
Only the PNG format selection adds a transparency layer
in the image (for further processing). """,
"x": """\
cores : int
``[[-]n]``.
Limit the number of cores to be used in any OpenMP-enabled
multi-threaded algorithms. By default we try to use all available
cores. Set a number *n* to only use n cores (if too large it will
be truncated to the maximum cores available). Finally, give a
negative number *-n* to select (all - n) cores (or at least 1 if
n equals or exceeds all).
""",
"R": r"""region : str or list
*xmin/xmax/ymin/ymax*\ [**+r**\ ][**+u**\ *unit*].
Specify the region of interest. This is a required argument if this
is the first plot command.""",
"J": r"""projection : str
*projection*\ [*projection-specific arguments*\ ]\ *figure size*.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-J option is very difficult to read.
image

Select map projection. This is a required argument if this
is the first plot command.""",
"B": r"""frame : str or list
Set map boundary frame and axes attributes.""",
"U": r"""timestamp : bool or str
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
Draw GMT time stamp logo on plot.""",
"CPT": r"""cmap : str
File name of a CPT file or ``C='color1,color2[,color3,...]'`` to
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
build a linear continuous CPT from those colors automatically.""",
"G": r"""color : str
Select color or pattern for filling of symbols or polygons. Default
is no fill.""",
"V": r"""verbose : str
Select verbosity level [Default is w], which modulates the messages
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
written to stderr. Choose among 7 levels of verbosity:
- **q** - Quiet, not even fatal error messages are produced
- **e** - Error messages only
- **w** - Warnings [Default]
- **t** - Timings (report runtimes for time-intensive algorthms);
- **i** - Informational messages (same as "verbose=True")
- **c** - Compatibility warnings
- **d** - Debugging messages""",
"W": r"""pen : str
Set pen attributes for lines or the outline of symbols.""",
"XY": r"""xshift : str
``[a|c|f|r][xshift]``.
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
Shift plot origin in x-direction.
yshift : str
``[a|c|f|r][yshift]``.
Shift plot origin in y-direction. Full documentation is at
:gmt-docs:`gmt.html#xy-full`.""",
"j": r"""distcalc : str
``e|f|g``.
Determine how spherical distances are calculated.
- **e** - Ellipsoidal (or geodesic) mode
- **f** - Flat Earth mode
- **g** - Great circle distance [Default]

All spherical distance calculations depend on the current ellipsoid
(PROJ_ELLIPSOID), the definition of the mean radius
(PROJ_MEAN_RADIUS), and the specification of latitude type
(PROJ_AUX_LATITUDE). Geodesic distance calculations is also
controlled by method (PROJ_GEODESIC).""",
"n": r"""interpolation : str
``[b|c|l|n][+a][+bBC][+c][+tthreshold]``
Select interpolation mode for grids. You can select the type of
spline used:
- 'b' for B-spline
- 'c' for bicubic [Default]
- 'l' for bilinear
- 'n' for nearest-neighbor""",
"p": r"""perspective : list or str
``'[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]'``.
Select perspective view and set the azimuth and elevation angle of
the viewpoint. Default is [180, 90]. Full documentation is at
:gmt-docs:`gmt.html#perspective-full`.""",
"registration": r"""registration : str
``[g|p]``
Force output grid to be gridline (g) or pixel (p) node registered.
Default is gridline (g).""",
"t": r"""transparency : float
Set transparency level, in [0-100] percent range.
Default is 0, i.e., opaque.
Only visible when PDF or raster format output is selected.
Only the PNG format selection adds a transparency layer
in the image (for further processing).""",
"x": r"""cores : int
``[[-]n]``.
Limit the number of cores to be used in any OpenMP-enabled
multi-threaded algorithms. By default we try to use all available
cores. Set a number *n* to only use n cores (if too large it will
be truncated to the maximum cores available). Finally, give a
negative number *-n* to select (all - n) cores (or at least 1 if
n equals or exceeds all).""",
}


def fmt_docstring(module_func):
"""
r"""
Decorator to insert common text into module docstrings.

Should be the last decorator (at the top).
Expand Down Expand Up @@ -172,12 +152,13 @@ def fmt_docstring(module_func):
Parameters
----------
region : str or list
*Required if this is the first plot command*.
``'xmin/xmax/ymin/ymax[+r][+uunit]'``.
Specify the region of interest.
*xmin/xmax/ymin/ymax*\ [**+r**\ ][**+u**\ *unit*].
Specify the region of interest. This is a required argument if this
is the first plot command.
projection : str
*Required if this is the first plot command*.
Select map projection.
*projection*\ [*projection-specific arguments*\ ]\ *figure size*.
Select map projection. This is a required argument if this
is the first plot command.
<BLANKLINE>
**Aliases:**
<BLANKLINE>
Expand Down