14
14
from pygmt .exceptions import GMTInvalidInput
15
15
from pygmt .helpers .utils import is_nonstr_iter
16
16
17
- COMMON_OPTIONS = {
18
- "R " : r"""
17
+ COMMON_DOCSTRINGS = {
18
+ "region " : r"""
19
19
region : str or list
20
20
*xmin/xmax/ymin/ymax*\ [**+r**][**+u**\ *unit*].
21
21
Specify the :doc:`region </tutorials/basics/regions>` of interest.""" ,
22
- "J " : r"""
22
+ "projection " : r"""
23
23
projection : str
24
24
*projcode*\[*projparams*/]\ *width*.
25
25
Select map :doc:`projection </projections/index>`.""" ,
26
- "A " : r"""
26
+ "area_thresh " : r"""
27
27
area_thresh : int or float or str
28
28
*min_area*\ [/*min_level*/*max_level*][**+a**\[**g**\|\ **i**]\
29
29
[**s**\|\ **S**]][**+l**\|\ **r**][**+p**\ *percent*].
30
30
Features with an area smaller than *min_area* in km\ :sup:`2` or of
31
31
hierarchical level that is lower than *min_level* or higher than
32
32
*max_level* will not be plotted [Default is 0/0/4 (all
33
33
features)].""" ,
34
- "B " : r"""
34
+ "frame " : r"""
35
35
frame : bool or str or list
36
36
Set map boundary
37
37
:doc:`frame and axes attributes </tutorials/basics/frames>`. """ ,
38
- "U " : """\
38
+ "timestamp " : """\
39
39
timestamp : bool or str
40
40
Draw GMT time stamp logo on plot.""" ,
41
- "CPT " : r"""
41
+ "cmap " : r"""
42
42
cmap : str
43
43
File name of a CPT file or a series of comma-separated colors
44
44
(e.g., *color1*,\ *color2*,\ *color3*) to build a linear continuous
45
45
CPT from those colors automatically.""" ,
46
- "G " : """\
46
+ "color " : """\
47
47
color : str or 1d array
48
48
Select color or pattern for filling of symbols or polygons. Default
49
49
is no fill.""" ,
50
- "I " : r"""
50
+ "spacing " : r"""
51
51
spacing : str
52
52
*x_inc*\ [**+e**\|\ **n**][/\ *y_inc*\ [**+e**\|\ **n**]].
53
53
*x_inc* [and optionally *y_inc*] is the grid spacing.
78
78
**Note**: If ``region=grdfile`` is used then the grid spacing and
79
79
the registration have already been initialized; use ``spacing`` and
80
80
``registration`` to override these values.""" ,
81
- "V " : """\
81
+ "verbose " : """\
82
82
verbose : bool or str
83
83
Select verbosity level [Default is **w**], which modulates the messages
84
84
written to stderr. Choose among 7 levels of verbosity:
90
90
- **i** - Informational messages (same as ``verbose=True``)
91
91
- **c** - Compatibility warnings
92
92
- **d** - Debugging messages""" ,
93
- "W " : """\
93
+ "pen " : """\
94
94
pen : str
95
95
Set pen attributes for lines or the outline of symbols.""" ,
96
- "XY " : r"""
96
+ "xyshift " : r"""
97
97
xshift : str
98
98
[**a**\|\ **c**\|\ **f**\|\ **r**\][*xshift*].
99
99
Shift plot origin in x-direction.
102
102
Shift plot origin in y-direction. Full documentation is at
103
103
:gmt-docs:`gmt.html#xy-full`.
104
104
""" ,
105
- "a " : r"""
105
+ "aspatial " : r"""
106
106
aspatial : bool or str
107
107
[*col*\ =]\ *name*\ [,...].
108
108
Control how aspatial data are handled during input and output.
109
109
Full documentation is at :gmt-docs:`gmt.html#aspatial-full`.
110
110
""" ,
111
- "b " : r"""
111
+ "binary " : r"""
112
112
binary : bool or str
113
113
**i**\|\ **o**\ [*ncols*][*type*][**w**][**+l**\|\ **b**].
114
114
Select native binary input (using ``binary="i"``) or output
136
136
be read as little- or big-endian, respectively.
137
137
138
138
Full documentation is at :gmt-docs:`gmt.html#bi-full`.""" ,
139
- "d " : r"""
139
+ "nodata " : r"""
140
140
nodata : str
141
141
**i**\|\ **o**\ *nodata*.
142
142
Substitute specific values with NaN (for tabular data). For
143
143
example, ``d="-9999"`` will replace all values equal to -9999 with
144
144
NaN during input and all NaN values with -9999 during output.
145
145
Prepend **i** to the *nodata* value for input columns only. Prepend
146
146
**o** to the *nodata* value for output columns only.""" ,
147
- "c " : r"""
147
+ "panel " : r"""
148
148
panel : bool or int or list
149
149
[*row,col*\|\ *index*].
150
150
Select a specific subplot panel. Only allowed when in subplot
154
154
when the subplot was defined. **Note**: *row*, *col*, and *index*
155
155
all start at 0.
156
156
""" ,
157
- "e " : r"""
157
+ "find " : r"""
158
158
find : str
159
159
[**~**]\ *"pattern"* \| [**~**]/\ *regexp*/[**i**].
160
160
Only pass records that match the given *pattern* or regular
161
161
expressions [Default processes all records]. Prepend **~** to
162
162
the *pattern* or *regexp* to instead only pass data expressions
163
163
that do not match the pattern. Append **i** for case insensitive
164
164
matching. This does not apply to headers or segment headers.""" ,
165
- "f " : r"""
165
+ "coltypes " : r"""
166
166
coltypes : str
167
167
[**i**\|\ **o**]\ *colinfo*.
168
168
Specify data types of input and/or output columns (time or
169
169
geographical data). Full documentation is at
170
170
:gmt-docs:`gmt.html#f-full`.""" ,
171
- "g " : r"""
171
+ "gap " : r"""
172
172
gap : str or list
173
173
**x**\|\ **y**\|\ **z**\|\ **d**\|\ **X**\|\ **Y**\|\
174
174
**D**\ *gap*\ [**u**][**+a**][**+c**\ *col*][**+n**\|\ **p**].
209
209
column value must exceed *gap* for a break to be imposed.
210
210
- **+p** - specify that the current value minus the previous
211
211
value must exceed *gap* for a break to be imposed.""" ,
212
- "h " : r"""
212
+ "header " : r"""
213
213
header : str
214
214
[**i**\|\ **o**][*n*][**+c**][**+d**][**+m**\ *segheader*][**+r**\
215
215
*remark*][**+t**\ *title*].
231
231
line-breaks.
232
232
233
233
Blank lines and lines starting with \# are always skipped.""" ,
234
- "i " : r"""
234
+ "incols " : r"""
235
235
incols : str or 1d array
236
236
Specify data columns for primary input in arbitrary order. Columns
237
237
can be repeated and columns not listed will be skipped [Default
261
261
[Default is 1].
262
262
- **+o** to add the given *offset* to the input values [Default
263
263
is 0].""" ,
264
- "j " : r"""
264
+ "distcalc " : r"""
265
265
distcalc : str
266
266
**e**\|\ **f**\|\ **g**.
267
267
Determine how spherical distances are calculated.
275
275
(:gmt-term:`PROJ_MEAN_RADIUS`), and the specification of latitude type
276
276
(:gmt-term:`PROJ_AUX_LATITUDE`). Geodesic distance calculations is also
277
277
controlled by method (:gmt-term:`PROJ_GEODESIC`).""" ,
278
- "l " : r"""
278
+ "label " : r"""
279
279
label : str
280
280
Add a legend entry for the symbol or line being plotted. Full
281
281
documentation is at :gmt-docs:`gmt.html#l-full`.""" ,
282
- "n " : r"""
282
+ "interpolation " : r"""
283
283
interpolation : str
284
284
[**b**\|\ **c**\|\ **l**\|\ **n**][**+a**][**+b**\ *BC*][**+c**][**+t**\ *threshold*].
285
285
Select interpolation mode for grids. You can select the type of
289
289
- **c** for bicubic [Default]
290
290
- **l** for bilinear
291
291
- **n** for nearest-neighbor""" ,
292
- "o " : r"""
292
+ "outcols " : r"""
293
293
outcols : str or 1d array
294
294
*cols*\ [,...][,\ **t**\ [*word*]].
295
295
Specify data columns for primary output in arbitrary order. Columns
312
312
input and skip trailing text. **Note**: If ``incols`` is also
313
313
used then the columns given to ``outcols`` correspond to the
314
314
order after the ``incols`` selection has taken place.""" ,
315
- "p " : r"""
315
+ "perspective " : r"""
316
316
perspective : list or str
317
317
[**x**\|\ **y**\|\ **z**]\ *azim*\[/*elev*\[/*zlevel*]]\
318
318
[**+w**\ *lon0*/*lat0*\[/*z0*]][**+v**\ *x0*/*y0*].
319
319
Select perspective view and set the azimuth and elevation angle of
320
320
the viewpoint. Default is [180, 90]. Full documentation is at
321
321
:gmt-docs:`gmt.html#perspective-full`.
322
322
""" ,
323
- "r " : r"""
323
+ "registration " : r"""
324
324
registration : str
325
325
**g**\|\ **p**.
326
326
Force gridline (**g**) or pixel (**p**) node registration.
327
327
[Default is **g**\ (ridline)].
328
328
""" ,
329
- "s " : r"""
329
+ "skiprows " : r"""
330
330
skiprows : bool or str
331
331
[*cols*][**+a**][**+r**].
332
332
Suppress output for records whose *z*-value equals NaN [Default
342
342
- **+a** to suppress the output of the record if just one or
343
343
more of the columns equal NaN [Default skips record only
344
344
if values in all specified *cols* equal NaN].""" ,
345
- "t " : """\
345
+ "transparency " : """\
346
346
transparency : int or float
347
347
Set transparency level, in [0-100] percent range.
348
348
Default is 0, i.e., opaque.
349
349
Only visible when PDF or raster format output is selected.
350
350
Only the PNG format selection adds a transparency layer
351
351
in the image (for further processing). """ ,
352
- "w " : r"""
352
+ "wrap " : r"""
353
353
wrap : str
354
354
**y**\|\ **a**\|\ **w**\|\ **d**\|\ **h**\|\ **m**\|\ **s**\|\
355
355
**c**\ *period*\ [/*phase*][**+c**\ *col*].
367
367
- **c** - custom cycle (normalized)
368
368
369
369
Full documentation is at :gmt-docs:`gmt.html#w-full`.""" ,
370
- "x " : r"""
370
+ "cores " : r"""
371
371
cores : bool or int
372
372
[[**-**]\ *n*].
373
373
Limit the number of cores to be used in any OpenMP-enabled
@@ -391,17 +391,6 @@ def fmt_docstring(module_func):
391
391
* ``{aliases}``: Insert a section listing the parameter aliases defined by
392
392
decorator ``use_alias``.
393
393
394
- The following are places for common parameter descriptions:
395
-
396
- * ``{R}``: region (bounding box as west, east, south, north)
397
- * ``{J}``: projection (coordinate system to use)
398
- * ``{B}``: frame (map frame and axes parameters)
399
- * ``{U}``: timestamp (insert time stamp logo)
400
- * ``{CPT}``: cmap (the color palette table)
401
- * ``{G}``: color
402
- * ``{W}``: pen
403
- * ``{n}``: interpolation
404
-
405
394
Parameters
406
395
----------
407
396
module_func : function
@@ -426,8 +415,8 @@ def fmt_docstring(module_func):
426
415
... data : str or {table-like}
427
416
... Pass in either a file name to an ASCII data table, a 2D
428
417
... {table-classes}.
429
- ... {R }
430
- ... {J }
418
+ ... {region }
419
+ ... {projection }
431
420
...
432
421
... {aliases}
433
422
... '''
@@ -481,7 +470,7 @@ def fmt_docstring(module_func):
481
470
" tabular data"
482
471
)
483
472
484
- for marker , text in COMMON_OPTIONS .items ():
473
+ for marker , text in COMMON_DOCSTRINGS .items ():
485
474
# Remove the indentation and the first line break from the multiline
486
475
# strings so that it doesn't mess up the original docstring
487
476
filler_text [marker ] = textwrap .dedent (text .lstrip ("\n " ))
0 commit comments