12
12
)
13
13
14
14
15
- def _blockm (block_method , table , outfile , ** kwargs ):
15
+ def _blockm (block_method , table , outfile , x , y , z , ** kwargs ):
16
16
r"""
17
17
Block average (x,y,z) data tables by mean or median estimation.
18
18
@@ -41,7 +41,9 @@ def _blockm(block_method, table, outfile, **kwargs):
41
41
with GMTTempFile (suffix = ".csv" ) as tmpfile :
42
42
with Session () as lib :
43
43
# Choose how data will be passed into the module
44
- table_context = lib .virtualfile_from_data (check_kind = "vector" , data = table )
44
+ table_context = lib .virtualfile_from_data (
45
+ check_kind = "vector" , data = table , x = x , y = y , z = z
46
+ )
45
47
# Run blockm* on data table
46
48
with table_context as infile :
47
49
if outfile is None :
@@ -73,14 +75,18 @@ def _blockm(block_method, table, outfile, **kwargs):
73
75
r = "registration" ,
74
76
)
75
77
@kwargs_to_strings (R = "sequence" )
76
- def blockmean (table , outfile = None , ** kwargs ):
78
+ def blockmean (table = None , outfile = None , * , x = None , y = None , z = None , ** kwargs ):
77
79
r"""
78
80
Block average (x,y,z) data tables by mean estimation.
79
81
80
82
Reads arbitrarily located (x,y,z) triples [or optionally weighted
81
- quadruples (x,y,z,w)] from a table and writes to the output a mean
82
- position and value for every non-empty block in a grid region defined by
83
- the ``region`` and ``spacing`` parameters.
83
+ quadruples (x,y,z,w)] and writes to the output a mean position and value
84
+ for every non-empty block in a grid region defined by the ``region`` and
85
+ ``spacing`` parameters.
86
+
87
+ Takes a matrix, xyz triplets, or a file name as input.
88
+
89
+ Must provide either ``table`` or ``x``, ``y``, and ``z``.
84
90
85
91
Full option list at :gmt-docs:`blockmean.html`
86
92
@@ -92,12 +98,12 @@ def blockmean(table, outfile=None, **kwargs):
92
98
Pass in (x, y, z) or (longitude, latitude, elevation) values by
93
99
providing a file name to an ASCII data table, a 2D
94
100
{table-classes}.
101
+ x/y/z : 1d arrays
102
+ Arrays of x and y coordinates and values z of the data points.
95
103
96
104
{I}
97
105
98
- region : str or list
99
- *xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*].
100
- Specify the region of interest.
106
+ {R}
101
107
102
108
outfile : str
103
109
The file name for the output ASCII file.
@@ -114,11 +120,13 @@ def blockmean(table, outfile=None, **kwargs):
114
120
Return type depends on whether the ``outfile`` parameter is set:
115
121
116
122
- :class:`pandas.DataFrame` table with (x, y, z) columns if ``outfile``
117
- is not set
123
+ is not set.
118
124
- None if ``outfile`` is set (filtered output will be stored in file
119
- set by ``outfile``)
125
+ set by ``outfile``).
120
126
"""
121
- return _blockm (block_method = "blockmean" , table = table , outfile = outfile , ** kwargs )
127
+ return _blockm (
128
+ block_method = "blockmean" , table = table , outfile = outfile , x = x , y = y , z = z , ** kwargs
129
+ )
122
130
123
131
124
132
@fmt_docstring
@@ -132,14 +140,18 @@ def blockmean(table, outfile=None, **kwargs):
132
140
r = "registration" ,
133
141
)
134
142
@kwargs_to_strings (R = "sequence" )
135
- def blockmedian (table , outfile = None , ** kwargs ):
143
+ def blockmedian (table = None , outfile = None , * , x = None , y = None , z = None , ** kwargs ):
136
144
r"""
137
145
Block average (x,y,z) data tables by median estimation.
138
146
139
147
Reads arbitrarily located (x,y,z) triples [or optionally weighted
140
- quadruples (x,y,z,w)] from a table and writes to the output a median
141
- position and value for every non-empty block in a grid region defined by
142
- the ``region`` and ``spacing`` parameters.
148
+ quadruples (x,y,z,w)] and writes to the output a median position and value
149
+ for every non-empty block in a grid region defined by the ``region`` and
150
+ ``spacing`` parameters.
151
+
152
+ Takes a matrix, xyz triplets, or a file name as input.
153
+
154
+ Must provide either ``table`` or ``x``, ``y``, and ``z``.
143
155
144
156
Full option list at :gmt-docs:`blockmedian.html`
145
157
@@ -151,12 +163,12 @@ def blockmedian(table, outfile=None, **kwargs):
151
163
Pass in (x, y, z) or (longitude, latitude, elevation) values by
152
164
providing a file name to an ASCII data table, a 2D
153
165
{table-classes}.
166
+ x/y/z : 1d arrays
167
+ Arrays of x and y coordinates and values z of the data points.
154
168
155
169
{I}
156
170
157
- region : str or list
158
- *xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*].
159
- Specify the region of interest.
171
+ {R}
160
172
161
173
outfile : str
162
174
The file name for the output ASCII file.
@@ -173,8 +185,16 @@ def blockmedian(table, outfile=None, **kwargs):
173
185
Return type depends on whether the ``outfile`` parameter is set:
174
186
175
187
- :class:`pandas.DataFrame` table with (x, y, z) columns if ``outfile``
176
- is not set
188
+ is not set.
177
189
- None if ``outfile`` is set (filtered output will be stored in file
178
- set by ``outfile``)
190
+ set by ``outfile``).
179
191
"""
180
- return _blockm (block_method = "blockmedian" , table = table , outfile = outfile , ** kwargs )
192
+ return _blockm (
193
+ block_method = "blockmedian" ,
194
+ table = table ,
195
+ outfile = outfile ,
196
+ x = x ,
197
+ y = y ,
198
+ z = z ,
199
+ ** kwargs
200
+ )
0 commit comments