Next: concat, Previous: complex, Up: Internal Routines [Contents][Index]
compress(data [, dimensions], factors)
Returns a compressed copy of array data
, which may have an
arbitrary number of dimensions. The positive integer compression
factors are taken from factors
and the dimensions that
these factors are applied to are taken from dimensions
,
which defaults to indgen(factors)
. If factors
contains a single number and dimensions
is not specified,
then the compression factor is applied to all dimensions.
The result is of the same data type as data
. Each element
of the result contains the average of a fixed number of neighboring
elements of data
indicated by fctors
and
dimensions
. Of each dimension of data
, the
first part is treated that has a size equal to the greatest multiple of
the compression factor for that dimension that fits the dimension of
data
. For example, if data
is an array of 11
by 7 elements and factors
contains the numbers 4 and 2,
then the result will have dimensions 2 (= fix(11/4)
) by 3 (=
fix(7/2)
), and the part of data
that is treated is
indicated by the range (0:7,0:5)
. The first element of the
result will be equal to the average of data(0:3,0:1)
.
See also: expand, regrid, regrid3, Interpolation, Array Manipulation
Note: The invocation of this version of compress
is not
backwardly compatible with the old one, which treated two-dimensional
data only. The old version was called like this: compress (
data, xfac [, yfac])
where xfac
and
yfac
were the compression factors for the first and second
dimensions, respectively, and yfac
defaulted to
xfac
.