1212)
1313
1414
15- def _blockm (block_method , table , outfile , ** kwargs ):
15+ def _blockm (block_method , table , outfile , x , y , z , ** kwargs ):
1616 r"""
1717 Block average (x,y,z) data tables by mean or median estimation.
1818
@@ -41,7 +41,9 @@ def _blockm(block_method, table, outfile, **kwargs):
4141 with GMTTempFile (suffix = ".csv" ) as tmpfile :
4242 with Session () as lib :
4343 # 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+ )
4547 # Run blockm* on data table
4648 with table_context as infile :
4749 if outfile is None :
@@ -73,14 +75,18 @@ def _blockm(block_method, table, outfile, **kwargs):
7375 r = "registration" ,
7476)
7577@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 ):
7779 r"""
7880 Block average (x,y,z) data tables by mean estimation.
7981
8082 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``.
8490
8591 Full option list at :gmt-docs:`blockmean.html`
8692
@@ -92,12 +98,12 @@ def blockmean(table, outfile=None, **kwargs):
9298 Pass in (x, y, z) or (longitude, latitude, elevation) values by
9399 providing a file name to an ASCII data table, a 2D
94100 {table-classes}.
101+ x/y/z : 1d arrays
102+ Arrays of x and y coordinates and values z of the data points.
95103
96104 {I}
97105
98- region : str or list
99- *xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*].
100- Specify the region of interest.
106+ {R}
101107
102108 outfile : str
103109 The file name for the output ASCII file.
@@ -114,11 +120,13 @@ def blockmean(table, outfile=None, **kwargs):
114120 Return type depends on whether the ``outfile`` parameter is set:
115121
116122 - :class:`pandas.DataFrame` table with (x, y, z) columns if ``outfile``
117- is not set
123+ is not set.
118124 - None if ``outfile`` is set (filtered output will be stored in file
119- set by ``outfile``)
125+ set by ``outfile``).
120126 """
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+ )
122130
123131
124132@fmt_docstring
@@ -132,14 +140,18 @@ def blockmean(table, outfile=None, **kwargs):
132140 r = "registration" ,
133141)
134142@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 ):
136144 r"""
137145 Block average (x,y,z) data tables by median estimation.
138146
139147 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``.
143155
144156 Full option list at :gmt-docs:`blockmedian.html`
145157
@@ -151,12 +163,12 @@ def blockmedian(table, outfile=None, **kwargs):
151163 Pass in (x, y, z) or (longitude, latitude, elevation) values by
152164 providing a file name to an ASCII data table, a 2D
153165 {table-classes}.
166+ x/y/z : 1d arrays
167+ Arrays of x and y coordinates and values z of the data points.
154168
155169 {I}
156170
157- region : str or list
158- *xmin/xmax/ymin/ymax*\[\ **+r**\][**+u**\ *unit*].
159- Specify the region of interest.
171+ {R}
160172
161173 outfile : str
162174 The file name for the output ASCII file.
@@ -173,8 +185,16 @@ def blockmedian(table, outfile=None, **kwargs):
173185 Return type depends on whether the ``outfile`` parameter is set:
174186
175187 - :class:`pandas.DataFrame` table with (x, y, z) columns if ``outfile``
176- is not set
188+ is not set.
177189 - None if ``outfile`` is set (filtered output will be stored in file
178- set by ``outfile``)
190+ set by ``outfile``).
179191 """
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