6
6
from pygmt .helpers import (
7
7
GMTTempFile ,
8
8
build_arg_string ,
9
+ check_data_input_order ,
9
10
fmt_docstring ,
10
11
kwargs_to_strings ,
11
12
use_alias ,
12
13
)
13
14
14
15
15
- def _blockm (block_method , table , outfile , x , y , z , ** kwargs ):
16
+ def _blockm (block_method , data , x , y , z , outfile , ** kwargs ):
16
17
r"""
17
18
Block average (x,y,z) data tables by mean, median, or mode estimation.
18
19
@@ -38,12 +39,11 @@ def _blockm(block_method, table, outfile, x, y, z, **kwargs):
38
39
- None if ``outfile`` is set (filtered output will be stored in file
39
40
set by ``outfile``)
40
41
"""
41
-
42
42
with GMTTempFile (suffix = ".csv" ) as tmpfile :
43
43
with Session () as lib :
44
44
# Choose how data will be passed into the module
45
45
table_context = lib .virtualfile_from_data (
46
- check_kind = "vector" , data = table , x = x , y = y , z = z , required_z = True
46
+ check_kind = "vector" , data = data , x = x , y = y , z = z , required_z = True
47
47
)
48
48
# Run blockm* on data table
49
49
with table_context as infile :
@@ -55,7 +55,7 @@ def _blockm(block_method, table, outfile, x, y, z, **kwargs):
55
55
# Read temporary csv output to a pandas table
56
56
if outfile == tmpfile .name : # if user did not set outfile, return pd.DataFrame
57
57
try :
58
- column_names = table .columns .to_list ()
58
+ column_names = data .columns .to_list ()
59
59
result = pd .read_csv (tmpfile .name , sep = "\t " , names = column_names )
60
60
except AttributeError : # 'str' object has no attribute 'columns'
61
61
result = pd .read_csv (tmpfile .name , sep = "\t " , header = None , comment = ">" )
@@ -66,6 +66,7 @@ def _blockm(block_method, table, outfile, x, y, z, **kwargs):
66
66
67
67
68
68
@fmt_docstring
69
+ @check_data_input_order ("v0.5.0" , remove_version = "v0.7.0" )
69
70
@use_alias (
70
71
I = "spacing" ,
71
72
R = "region" ,
@@ -82,7 +83,7 @@ def _blockm(block_method, table, outfile, x, y, z, **kwargs):
82
83
w = "wrap" ,
83
84
)
84
85
@kwargs_to_strings (R = "sequence" , i = "sequence_comma" , o = "sequence_comma" )
85
- def blockmean (table = None , outfile = None , * , x = None , y = None , z = None , ** kwargs ):
86
+ def blockmean (data = None , x = None , y = None , z = None , outfile = None , ** kwargs ):
86
87
r"""
87
88
Block average (x,y,z) data tables by mean estimation.
88
89
@@ -93,15 +94,15 @@ def blockmean(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
93
94
94
95
Takes a matrix, xyz triplets, or a file name as input.
95
96
96
- Must provide either ``table `` or ``x``, ``y``, and ``z``.
97
+ Must provide either ``data `` or ``x``, ``y``, and ``z``.
97
98
98
99
Full option list at :gmt-docs:`blockmean.html`
99
100
100
101
{aliases}
101
102
102
103
Parameters
103
104
----------
104
- table : str or {table-like}
105
+ data : str or {table-like}
105
106
Pass in (x, y, z) or (longitude, latitude, elevation) values by
106
107
providing a file name to an ASCII data table, a 2D
107
108
{table-classes}.
@@ -138,11 +139,12 @@ def blockmean(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
138
139
set by ``outfile``).
139
140
"""
140
141
return _blockm (
141
- block_method = "blockmean" , table = table , outfile = outfile , x = x , y = y , z = z , ** kwargs
142
+ block_method = "blockmean" , data = data , x = x , y = y , z = z , outfile = outfile , ** kwargs
142
143
)
143
144
144
145
145
146
@fmt_docstring
147
+ @check_data_input_order ("v0.5.0" , remove_version = "v0.7.0" )
146
148
@use_alias (
147
149
I = "spacing" ,
148
150
R = "region" ,
@@ -159,7 +161,7 @@ def blockmean(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
159
161
w = "wrap" ,
160
162
)
161
163
@kwargs_to_strings (R = "sequence" , i = "sequence_comma" , o = "sequence_comma" )
162
- def blockmedian (table = None , outfile = None , * , x = None , y = None , z = None , ** kwargs ):
164
+ def blockmedian (data = None , x = None , y = None , z = None , outfile = None , ** kwargs ):
163
165
r"""
164
166
Block average (x,y,z) data tables by median estimation.
165
167
@@ -170,15 +172,15 @@ def blockmedian(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
170
172
171
173
Takes a matrix, xyz triplets, or a file name as input.
172
174
173
- Must provide either ``table `` or ``x``, ``y``, and ``z``.
175
+ Must provide either ``data `` or ``x``, ``y``, and ``z``.
174
176
175
177
Full option list at :gmt-docs:`blockmedian.html`
176
178
177
179
{aliases}
178
180
179
181
Parameters
180
182
----------
181
- table : str or {table-like}
183
+ data : str or {table-like}
182
184
Pass in (x, y, z) or (longitude, latitude, elevation) values by
183
185
providing a file name to an ASCII data table, a 2D
184
186
{table-classes}.
@@ -215,17 +217,12 @@ def blockmedian(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
215
217
set by ``outfile``).
216
218
"""
217
219
return _blockm (
218
- block_method = "blockmedian" ,
219
- table = table ,
220
- outfile = outfile ,
221
- x = x ,
222
- y = y ,
223
- z = z ,
224
- ** kwargs
220
+ block_method = "blockmedian" , data = data , x = x , y = y , z = z , outfile = outfile , ** kwargs
225
221
)
226
222
227
223
228
224
@fmt_docstring
225
+ @check_data_input_order ("v0.5.0" , remove_version = "v0.7.0" )
229
226
@use_alias (
230
227
I = "spacing" ,
231
228
R = "region" ,
@@ -242,7 +239,7 @@ def blockmedian(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
242
239
w = "wrap" ,
243
240
)
244
241
@kwargs_to_strings (R = "sequence" , i = "sequence_comma" , o = "sequence_comma" )
245
- def blockmode (table = None , outfile = None , * , x = None , y = None , z = None , ** kwargs ):
242
+ def blockmode (data = None , x = None , y = None , z = None , outfile = None , ** kwargs ):
246
243
r"""
247
244
Block average (x,y,z) data tables by mode estimation.
248
245
@@ -253,15 +250,15 @@ def blockmode(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
253
250
254
251
Takes a matrix, xyz triplets, or a file name as input.
255
252
256
- Must provide either ``table `` or ``x``, ``y``, and ``z``.
253
+ Must provide either ``data `` or ``x``, ``y``, and ``z``.
257
254
258
255
Full option list at :gmt-docs:`blockmode.html`
259
256
260
257
{aliases}
261
258
262
259
Parameters
263
260
----------
264
- table : str or {table-like}
261
+ data : str or {table-like}
265
262
Pass in (x, y, z) or (longitude, latitude, elevation) values by
266
263
providing a file name to an ASCII data table, a 2D
267
264
{table-classes}.
@@ -298,5 +295,5 @@ def blockmode(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
298
295
set by ``outfile``).
299
296
"""
300
297
return _blockm (
301
- block_method = "blockmode" , table = table , outfile = outfile , x = x , y = y , z = z , ** kwargs
298
+ block_method = "blockmode" , data = data , x = x , y = y , z = z , outfile = outfile , ** kwargs
302
299
)
0 commit comments