Skip to content

Commit 44efccc

Browse files
author
Meghan Jones
authored
Add incols to COMMON_OPTIONS, blockmean, and blockmedian (#1300)
* Add incols to COMMON_OPTIONS in decorators.py * Add incols to blockm.py
1 parent 46f739a commit 44efccc

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

pygmt/helpers/decorators.py

Lines changed: 30 additions & 0 deletions
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**.

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)