MGH_BLOCKMEAN
Name
MGH_BLOCKMEAN
Description
Given (x,y,z) data--where x & y are vectors representing position
on a 2D plane and z is a matching vector representing a scalar
value at each position--and a 2D rectilinear or curvilinear grid,
this function filters the input data and returns a reduced set of
(x,y,z) values, where locations lying within the same grid cell
have been combined into an average.
This function is inspired by the GMT blockmean command:
http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/man/blockmean.html
The grid is defined by a combination of the conventional DELTA,
DIMENSION, START, XOUT and YOUT keywords (as used by GRIDDATA,
except that the GRID keyword is omitted here because it can be
inferred from the dimensionality of XOUT and YOUT). In the
present case these define the positions of the cell vertices
and the averaging is done over the cells, i.e we are using
pixel node registration:
http://gmt.soest.hawaii.edu/gmt/html/GMT_Docs.html#x1-188000B.2.2
Calling Sequence
result = mgh_blockmean(x, y, z, w)
Positional Parameters
x,y (input, numeric vector)
Horizontal position of data.
z (input, numeric vector)
Horizontal position
w (input, numeric vector, optional)
Weights for weighted averaging
Keyword Parameters
COUNT (output, integer scalar)
Number of output values.
DELTA (input, 1 or 2-element numeric vector)
Grid spacing in the X & Y directions. This keyword, along with
DIMENSION and START, can be used to define uniformly spaced
rectilinear grids.
DIMENSION (input, 1 or 2-element integer vector)
Grid dimensions (number of vertices) in the X & Y
directions. This keyword, along with DELTA and START, can be
used to define uniformly spaced rectilinear grids.
START (input, 1 or 2-element numeric vector)
Grid origin in the X & Y directions. This keyword, along with
DELTA and DIMENSION, can be used to define uniformly spaced
rectilinear grids.
XOUT, YOUT (input, 1-D or 2-D numeric arrays)
Grid vertex positions, allowing grids with non-uniform spacing
and curvilinear grids.
Return Value
The function returns a [3,n] array containing the filtered
(x,y,z) data. Note that the order of the original data will
be lost.
Modification History
Mark Hadfield, 2011-07:
Written