### NDF_ZDELT

Create a compressed copy of an NDF using DELTA compression

#### Description:

The routine creates a copy of the supplied NDF, and then compresses selected array components within the copy using delta compression. This compression is lossless, but only operates on arrays holding integer values. It assumes that adjacent integer values in each 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). 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 a compressed array to occupy more space than the uncompressed array. The mean compression factor actually achieved is returned in argument ZRATIO (the ratio of the supplied NDF size to the compressed NDF size).

#### Invocation

CALL NDF_ZDELT( INDF1, COMP, MINRAT, ZAXIS, TYPE, PLACE, INDF2, ZRATIO, STATUS )

#### Arguments

##### INDF1 = INTEGER (Given)
Identifier for the input NDF.
##### COMP = CHARACTER $\ast$ ( $\ast$ ) (Given)
A comma-separated list of component names to be compressed. These may be selected from ’DATA, ’VARIANCE’ or ’QUALITY’. Additionally, if ’$\ast$’ is supplied all three components will be compressed.
##### MINRAT = REAL (Given)
The minimum allowed compression ratio for an array (the ratio of the supplied array size to the compressed array size). If compressing an array results in a compression ratio smaller than or equal to MINRAT, then the array is left uncompressed in the returned NDF. If the supplied value is zero or negative, then each array will be compressed regardless of the compression ratio.
##### 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 for each array 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 $\ast$ ( $\ast$ ) (Given)
The data type in which to store the differences between adjacent array 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 for each array that gives the greatest compression.
##### PLACE = INTEGER (Given and Returned)
An NDF placeholder (e.g. generated by the NDF_PLACE routine) which indicates the position in the data system where the new NDF will reside. The placeholder is annulled by this routine, and a value of NDF__NOPL will be returned (as defined in the include file NDF_PAR).
##### INDF2 = INTEGER (Returned)
Identifier for the new NDF.
##### ZRATIO = _REAL (Returned)
The mean compression ratio actually achieved for the array components specified by COMP. The compression ratio for an array is the ratio of the number of bytes needed to hold the numerical values in the supplied array, to the number of bytes needed to hold the numerical values in the compressed array. It does not include the small overheads associated with the extra labels, etc, needed to store compressed data, and so may be inaccurate for small arrays. Additionally, this ratio only takes the specified array components into account. If the NDF contains significant quantities of data in other components, then the overall compression of the whole NDF will be less.
##### STATUS = INTEGER (Given and Returned)
The global status.

#### Notes:

• An error is reported if any of the arrays to be compressed holds floating point values. The exception is that floating point values that are stored as scaled integers (see NDF_ZSCAL) are accepted.

• If the input NDF is already stored in DELTA format, it will be uncompressed and then recompressed using the supplied parameter values.

• An error will result if any of the specified array components of the input NDF are currently mapped for access.

• Complex arrays cannot be compressed using this routine. An error will be reported if the input NDF has a complex type, or if "TYPE" represents a complex data type.

• Delta compressed arrays are read-only. An error will be reported if an attempt is made to map a delta compressed array for WRITE or UPDATE access.

• When delta compressed arrays are mapped for READ access, uncompression occurs automatically. The pointer returned by NDF_MAP provides access to the uncompressed array values.

• The result of copying a compressed NDF (for instance, using NDF_PROP, etc.) will be an equivalent uncompressed NDF.

• When applied to a compressed NDF, the NDF_TYPE and NDF_FTYPE routines return information about the data type of the uncompressed NDF.

• If this routine is called with STATUS set, then a value of NDF__NOID will be returned for the INDF2 argument, although no further processing will occur. The same value will also be returned if the routine should fail for any reason. In either event, the placeholder will still be annulled. The NDF__NOID constant is defined in the include file NDF_PAR.