Skip to content

Commit 09bbd13

Browse files
authored
Merge branch 'master' into plot-depr-columns
2 parents 43e772b + 5aefe73 commit 09bbd13

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

doc/maintenance.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,21 @@ When making incompatible changes, we should follow the process:
173173
3-12 months.
174174
- Remove the old usage and warning when reaching the declared version.
175175

176-
To rename a function parameter, add the `@deprecated_parameter` decorator
177-
before the function definition (but after the `@use_alias` decorator if it exists).
178-
Here is an example:
176+
To rename a function parameter, add the `@deprecate_parameter` decorator near
177+
the top after the `@fmt_docstring` decorator but before the `@use_alias`
178+
decorator (if those two exists). Here is an example:
179179

180180
```
181181
@fmt_docstring
182-
@use_alias(J="projection", R="region", V="verbose")
183-
@kwargs_to_strings(R="sequence")
184-
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0")
182+
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
183+
@use_alias(J="projection", R="region", V="verbose", i="incols")
184+
@kwargs_to_strings(R="sequence", i='sequence_comma')
185185
def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs):
186186
pass
187187
```
188188

189-
In this case, the old parameter name `sizes` is deprecated since v0.4.0, and will be
190-
fully removed in v0.6.0. The new parameter name is `size`.
189+
In this case, the old parameter name `columns` is deprecated since v0.4.0, and
190+
will be fully removed in v0.6.0. The new parameter name is `incols`.
191191

192192

193193
## Making a Release

pygmt/helpers/decorators.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,36 @@
118118
geographical data). Full documentation is at
119119
:gmt-docs:`gmt.html#f-full`.
120120
""",
121+
"i": r"""
122+
incols : str or 1d array
123+
Specify data columns for primary input in arbitrary order. Columns
124+
can be repeated and columns not listed will be skipped [Default
125+
reads all columns in order, starting with the first (i.e., column
126+
0)].
127+
128+
- For *1d array*: specify individual columns in input order (e.g.,
129+
``incols=[1,0]`` for the 2nd column followed by the 1st column).
130+
- For :py:class:`str`: specify individual columns or column
131+
ranges in the format *start*\ [:*inc*]:*stop*, where *inc*
132+
defaults to 1 if not specified, with columns and/or column ranges
133+
separated by commas (e.g., ``incols='0:2,4+l'`` to input the
134+
first three columns followed by the log-transformed 5th column).
135+
To read from a given column until the end of the record, leave
136+
off *stop* when specifying the column range. To read trailing
137+
text, add the column **t**. Append the word number to **t** to
138+
ingest only a single word from the trailing text. Instead of
139+
specifying columns, use ``incols='n'`` to simply read numerical
140+
input and skip trailing text. Optionally, append one of the
141+
following modifiers to any column or column range to transform
142+
the input columns:
143+
144+
- **+l** to take the *log10* of the input values.
145+
- **+d** to divide the input values by the factor *divisor*
146+
[default is 1].
147+
- **+s** to multiple the input values by the factor *scale*
148+
[default is 1].
149+
- **+o** to add the given *offset* to the input values [default
150+
is 0].""",
121151
"j": r"""
122152
distcalc : str
123153
**e**\|\ **f**\|\ **g**.
@@ -505,7 +535,7 @@ def deprecate_parameter(oldname, newname, deprecate_version, remove_version):
505535
name, and users will receive a FutureWarning to inform them of the pending
506536
deprecation.
507537
508-
Use this decorator below the ``use_alias`` decorator.
538+
Use this decorator above the ``use_alias`` decorator.
509539
510540
Parameters
511541
----------

pygmt/src/blockm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def _blockm(block_method, table, outfile, **kwargs):
6969
V="verbose",
7070
a="aspatial",
7171
f="coltypes",
72+
i="incols",
7273
r="registration",
7374
)
7475
@kwargs_to_strings(R="sequence")
@@ -103,6 +104,7 @@ def blockmean(table, outfile=None, **kwargs):
103104
104105
{V}
105106
{a}
107+
{i}
106108
{f}
107109
{r}
108110
@@ -126,6 +128,7 @@ def blockmean(table, outfile=None, **kwargs):
126128
V="verbose",
127129
a="aspatial",
128130
f="coltypes",
131+
i="incols",
129132
r="registration",
130133
)
131134
@kwargs_to_strings(R="sequence")
@@ -161,6 +164,7 @@ def blockmedian(table, outfile=None, **kwargs):
161164
{V}
162165
{a}
163166
{f}
167+
{i}
164168
{r}
165169
166170
Returns

0 commit comments

Comments
 (0)