diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 43e9f05458c..6e770e08479 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -2,8 +2,7 @@ Decorators to help wrap the GMT modules. Apply them to functions wrapping GMT modules to automate: alias generation for -arguments, insert common text into docstrings, transform arguments to strings, -etc. +arguments, insert common text into docstrings, transform arguments to strings, etc. """ import functools @@ -22,14 +21,12 @@ [**s**\|\ **S**]][**+l**\|\ **r**][**+p**\ *percent*]. Features with an area smaller than *min_area* in km\ :sup:`2` or of hierarchical level that is lower than *min_level* or higher than - *max_level* will not be plotted [Default is ``"0/0/4"`` (all - features)].""", + *max_level* will not be plotted [Default is ``"0/0/4"`` (all features)].""", "aspatial": r""" aspatial : bool or str [*col*\ =]\ *name*\ [,...]. Control how aspatial data are handled during input and output. - Full documentation is at :gmt-docs:`gmt.html#aspatial-full`. - """, + Full documentation is at :gmt-docs:`gmt.html#aspatial-full`.""", "binary": r""" binary : bool or str **i**\|\ **o**\ [*ncols*][*type*][**w**][**+l**\|\ **b**]. @@ -37,25 +34,25 @@ (using ``binary="o"``), where *ncols* is the number of data columns of *type*, which must be one of: - - **c**: int8_t (1-byte signed char) - - **u**: uint8_t (1-byte unsigned char) - - **h**: int16_t (2-byte signed int) - - **H**: uint16_t (2-byte unsigned int) - - **i**: int32_t (4-byte signed int) - - **I**: uint32_t (4-byte unsigned int) - - **l**: int64_t (8-byte signed int) - - **L**: uint64_t (8-byte unsigned int) - - **f**: 4-byte single-precision float - - **d**: 8-byte double-precision float - - **x**: use to skip *ncols* anywhere in the record + - **c**: int8_t (1-byte signed char) + - **u**: uint8_t (1-byte unsigned char) + - **h**: int16_t (2-byte signed int) + - **H**: uint16_t (2-byte unsigned int) + - **i**: int32_t (4-byte signed int) + - **I**: uint32_t (4-byte unsigned int) + - **l**: int64_t (8-byte signed int) + - **L**: uint64_t (8-byte unsigned int) + - **f**: 4-byte single-precision float + - **d**: 8-byte double-precision float + - **x**: use to skip *ncols* anywhere in the record For records with mixed types, append additional comma-separated combinations of *ncols* *type* (no space). The following modifiers are supported: - - **w** after any item to force byte-swapping. - - **+l**\|\ **b** to indicate that the entire data file should - be read as little- or big-endian, respectively. + - **w** after any item to force byte-swapping. + - **+l**\|\ **b** to indicate that the entire data file should be + read as little- or big-endian, respectively. Full documentation is at :gmt-docs:`gmt.html#bi-full`.""", "cmap": r""" @@ -66,9 +63,8 @@ "coltypes": r""" coltypes : str [**i**\|\ **o**]\ *colinfo*. - Specify data types of input and/or output columns (time or - geographical data). Full documentation is at - :gmt-docs:`gmt.html#f-full`.""", + Specify data types of input and/or output columns (time or geographical + data). Full documentation is at :gmt-docs:`gmt.html#f-full`.""", "cores": r""" cores : bool or int Specify the number of active cores to be used in any OpenMP-enabled @@ -95,7 +91,7 @@ "frame": r""" frame : bool, str, or list Set map boundary - :doc:`frame and axes attributes `. """, + :doc:`frame and axes attributes `.""", "gap": r""" gap : str or list **x**\|\ **y**\|\ **z**\|\ **d**\|\ **X**\|\ **Y**\|\ @@ -105,38 +101,34 @@ a list with each item containing a string describing one set of criteria. - - **x**\|\ **X**: define a gap when there is a large enough - change in the x coordinates (uppercase to use projected - coordinates). - - **y**\|\ **Y**: define a gap when there is a large enough - change in the y coordinates (uppercase to use projected - coordinates). - - **d**\|\ **D**: define a gap when there is a large enough - distance between coordinates (uppercase to use projected - coordinates). - - **z**: define a gap when there is a large enough change in - the z data. Use **+c**\ *col* to change the z data column - [Default *col* is 2 (i.e., 3rd column)]. + - **x**\|\ **X**: define a gap when there is a large enough + change in the x coordinates (uppercase to use projected coordinates). + - **y**\|\ **Y**: define a gap when there is a large enough + change in the y coordinates (uppercase to use projected coordinates). + - **d**\|\ **D**: define a gap when there is a large enough + distance between coordinates (uppercase to use projected coordinates). + - **z**: define a gap when there is a large enough change in + the z data. Use **+c**\ *col* to change the z data column + [Default *col* is 2 (i.e., 3rd column)]. A unit **u** may be appended to the specified *gap*: - - For geographic data (**x**\|\ **y**\|\ **d**), the unit may - be arc- **d**\ (egrees), **m**\ (inutes), and **s**\ (econds) - , or (m)\ **e**\ (ters), **f**\ (eet), **k**\ (ilometers), - **M**\ (iles), or **n**\ (autical miles) [Default is - (m)\ **e**\ (ters)]. - - For projected data (**X**\|\ **Y**\|\ **D**), the unit may be - **i**\ (nches), **c**\ (entimeters), or **p**\ (oints). + - For geographic data (**x**\|\ **y**\|\ **d**), the unit may + be arc- **d**\ (egrees), **m**\ (inutes), and **s**\ (econds), + or (m)\ **e**\ (ters), **f**\ (eet), **k**\ (ilometers), + **M**\ (iles), or **n**\ (autical miles) [Default is (m)\ **e**\ (ters)]. + - For projected data (**X**\|\ **Y**\|\ **D**), the unit may be + **i**\ (nches), **c**\ (entimeters), or **p**\ (oints). Append modifier **+a** to specify that *all* the criteria must be met [default imposes breaks if any one criterion is met]. One of the following modifiers can be appended: - - **+n**: specify that the previous value minus the current - column value must exceed *gap* for a break to be imposed. - - **+p**: specify that the current value minus the previous - value must exceed *gap* for a break to be imposed.""", + - **+n**: specify that the previous value minus the current + column value must exceed *gap* for a break to be imposed. + - **+p**: specify that the current value minus the previous + value must exceed *gap* for a break to be imposed.""", "grid": r""" grid Name of the input grid file or the grid loaded as a @@ -153,17 +145,17 @@ header records. Prepend **o** to control the writing of header records, with the following modifiers supported: - - **+d** to remove existing header records. - - **+c** to add a header comment with column names to the - output [Default is no column names]. - - **+m** to add a segment header *segheader* to the output - after the header block [Default is no segment header]. - - **+r** to add a *remark* comment to the output [Default is no - comment]. The *remark* string may contain \\n to indicate - line-breaks. - - **+t** to add a *title* comment to the output [Default is no - title]. The *title* string may contain \\n to indicate - line-breaks. + - **+d** to remove existing header records. + - **+c** to add a header comment with column names to the + output [Default is no column names]. + - **+m** to add a segment header *segheader* to the output + after the header block [Default is no segment header]. + - **+r** to add a *remark* comment to the output [Default is no + comment]. The *remark* string may contain \\n to indicate + line-breaks. + - **+t** to add a *title* comment to the output [Default is no + title]. The *title* string may contain \\n to indicate + line-breaks. Blank lines and lines starting with \# are always skipped.""", "incols": r""" @@ -189,18 +181,14 @@ following modifiers to any column or column range to transform the input columns: - - **+l** to take the *log10* of the input values. - - **+d** to divide the input values by the factor *divisor* - [Default is 1]. - - **+s** to multiple the input values by the factor *scale* - [Default is 1]. - - **+o** to add the given *offset* to the input values [Default - is 0].""", + - **+l** to take the *log10* of the input values. + - **+d** to divide the input values by the factor *divisor* [Default is 1]. + - **+s** to multiple the input values by the factor *scale* [Default is 1]. + - **+o** to add the given *offset* to the input values [Default is 0].""", "interpolation": r""" interpolation : str [**b**\|\ **c**\|\ **l**\|\ **n**][**+a**][**+b**\ *BC*][**+c**][**+t**\ *threshold*]. - Select interpolation mode for grids. You can select the type of - spline used: + Select interpolation mode for grids. You can select the type of spline used: - **b** for B-spline - **c** for bicubic [Default] @@ -258,8 +246,7 @@ Name of the output netCDF grid file. If not specified, will return an :class:`xarray.DataArray` object. For writing a specific grid file format or applying basic data operations to the output grid, see - :gmt-docs:`gmt.html#grd-inout-full` for the available modifiers. - """, + :gmt-docs:`gmt.html#grd-inout-full` for the available modifiers.""", "panel": r""" panel Select a specific subplot panel. Only allowed when used in @@ -280,8 +267,7 @@ [**+w**\ *lon0*/*lat0*\[/*z0*]][**+v**\ *x0*/*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`. - """, + :gmt-docs:`gmt.html#perspective-full`.""", "projection": r""" projection : str *projcode*\[*projparams*/]\ *width*\|\ *scale*. @@ -294,8 +280,7 @@ registration : str **g**\|\ **p**. Force gridline (**g**) or pixel (**p**) node registration - [Default is **g**\ (ridline)]. - """, + [Default is **g**\ (ridline)].""", "skiprows": r""" skiprows : bool or str [*cols*][**+a**][**+r**]. @@ -307,11 +292,11 @@ *inc* defaults to 1 if not specified. The following modifiers are supported: - - **+r** to reverse the suppression, i.e., only output the - records whose *z*-value equals NaN. - - **+a** to suppress the output of the record if just one or - more of the columns equal NaN [Default skips record only - if values in all specified *cols* equal NaN].""", + - **+r** to reverse the suppression, i.e., only output the + records whose *z*-value equals NaN. + - **+a** to suppress the output of the record if just one or + more of the columns equal NaN [Default skips record only + if values in all specified *cols* equal NaN].""", "spacing": r""" spacing : float, str, or list *x_inc*\ [**+e**\|\ **n**][/\ *y_inc*\ [**+e**\|\ **n**]]. @@ -349,7 +334,7 @@ [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). """, + in the image (for further processing).""", "verbose": r""" verbose : bool or str Select verbosity level [:term:`Full usage `].""", @@ -361,14 +346,14 @@ different column if selected via **+c**\ *col*. The following cyclical coordinate transformations are supported: - - **y**: yearly cycle (normalized) - - **a**: annual cycle (monthly) - - **w**: weekly cycle (day) - - **d**: daily cycle (hour) - - **h**: hourly cycle (minute) - - **m**: minute cycle (second) - - **s**: second cycle (second) - - **c**: custom cycle (normalized) + - **y**: yearly cycle (normalized) + - **a**: annual cycle (monthly) + - **w**: weekly cycle (day) + - **d**: daily cycle (hour) + - **h**: hourly cycle (minute) + - **m**: minute cycle (second) + - **s**: second cycle (second) + - **c**: custom cycle (normalized) Full documentation is at :gmt-docs:`gmt.html#w-full`.""", }