Next: concat, Previous: complex, Up: Internal Routines [Contents][Index]

`compress(`

`data` [, `dimensions`], `factors`)

Returns a compressed copy of array

, which may have an
arbitrary number of dimensions. The positive integer compression
factors are taken from `data`

and the dimensions that
these factors are applied to are taken from `factors`

,
which defaults to `dimensions``indgen(`

. If `factors`)

contains a single number and `factors`

is not specified,
then the compression factor is applied to all dimensions.
`dimensions`

The result is of the same data type as

. Each element
of the result contains the average of a fixed number of neighboring
elements of `data`

indicated by `data`

and
`fctors`

. Of each dimension of `dimensions`

, 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 `data`

contains the numbers 4 and 2,
then the result will have dimensions 2 (= `factors``fix(11/4)`

) by 3 (=
`fix(7/2)`

), and the part of

that is treated is
indicated by the range `data``(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 (
```

where `data`, `xfac` [, `yfac`])

and
`xfac`

were the compression factors for the first and second
dimensions, respectively, and `yfac`

defaulted to
`yfac`

.
`xfac`