- ←Prev
- ARY
A Subroutine Library for Accessing
ARRAY Data Structures - Next→
- TOC ↑
Description:
The routine creates a
copy of the supplied array stored in DELTA form, which provides a lossless compression scheme for
integer data. This scheme assumes that adjacent integer values in the input array tend to be close in
value, and so differences between adjacent values can be represented in fewer bits than the absolute
values themselves. The differences are taken along a nominated pixel axis within the supplied array
(specified by argument ZAXIS).
In practice, the scheme is limited currently to representing differences between adjacent values using a
HDS integer data type (specified by argyument TYPE) - that is, arbitrary bit length is not yet
supported. So for instance an _INTEGER input array can be compressed by storing differences as
_WORD or _BYTE values, but a _WORD input array can only be compressed by storing differences as
_BYTE values.
Any input value that differs from its earlier neighbour by more than the data range of the selected
data type is stored explicitly using the data type of the input array.
Further compression is achieved by replacing runs of equal input values by a single occurrence of the
value with a correspsonding repetition count.
It should be noted that the degree of compression achieved is dependent on the nature of the data, and
it is possible for the compressed array to occupy more space than the uncompressed array. The
compression factor actually achieved is returned in argument ZRATIO (the ratio of the supplied array
size to the compressed array size). A minmum allowed compression ratio may be specified
via argument MINRAT. If the compression ratio is less than this value, then the returned
copy is left uncompressed.
Invocation
CALL ARY_DELTA( IARY1, ZAXIS, TYPE, MINRAT,
PLACE, ZRATIO, IARY2, STATUS )
Arguments
IARY1 = INTEGER (Given)
The input
array identifier. This can be stored in any form. If it is already stored in DELTA form, it is
uncompressed and then re-compressed using the supplied compression parameters. If is is stored in
SCALED form, the internal integer values are compressed and the scale and zero terms
are copied into the DELTA array.
ZAXIS = INTEGER (Given)
The index of the pixel
axis along which differences are to be taken. If this is zero, a default value will be selected
that gives the greatest compression. An error will be reported if a value less than zero or
greater than the number of axes in the input array is supplied.
TYPE = CHARACTER
∗ (
∗ )
(Given)
The data type in which to store the differences between adjacent input values. This must be
one of ’
_BYTE’
, ’
_WORD’
or ’
_INTEGER’
. Additionally, a blank string may be supplied in which
case a default value will be selected that gives the greatest compression.
MINRAT = REAL (Given)
The minimum allowed ZRATIO value. If compressing the input array results in a ZRATIO value
smaller than or equal to MINRAT, then the returned array is left uncompressed. If the
supplied value is zero or negative, then the array will be compressed regardless of the
compression ratio.
PLACE = INTEGER (Given and Returned)
An array placeholder (e.g.
generated by the ARY_PLACE routine) which indicates the position in the data system
where the new array will reside. The placeholder is annulled by this routine, and a value
of ARY__NOPL will be returned (as defined in the include file ARY_PAR).
ZRATIO =
REAL (Returned)
The compression factor actually achieved (the ratio of the supplied
array size to the compressed array size). Genuine compressions are represented by values
more than 1.0, but values less than 1.0 may be returned if the input data is not suited to
delta compression (i.e. if the "
compression"
actually expands the array storage). Note, the
returned value of ZRATIO may be smaller than MINRAT, in which case the supplied array is
left unchanged. The returned compression factor is approximate as it does not take into
account the space occupied by the HDS metadata describing the extra components of a
DELTA array (i.e. the component names, data types, dimensions, etc). This will only be
significant for very small arrays.
IARY2 = INTEGER (Returned)
Identifier for the new
DELTA array.
STATUS = INTEGER (Given and Returned)
The global status.
Notes:
-
An error will be reported if the supplied array does not hold integer values. In the case of a SCALED
array, the internal (scaled) values must be integers, but the external (unscaled) values can be of any
data type.
-
The compression axis and compressed data type actually used can be determined by passing the
returned array to ARY_GTDLT.
-
An error will result if the array, or any part of it, is currently mapped for access (e.g. through another
identifier).
-
An error will result if the array holds complex values.
- ←Prev
- ARY
A Subroutine Library for Accessing
ARRAY Data Structures - Next→
- TOC ↑