Next: Delta compressed Storage Form
Up: ARRAY COMPONENT STORAGE FORM AND COMPRESSION
Previous: Simple Storage Form
Scaled Storage Form
In this form of storage, the values stored internally within an NDF's array
component are a scaled form of the external values of interest to
application code. Specifically, the internal scaled values are related to
the external unscaled values via:
(unscaled value) = ZERO + (scaled value) * SCALE
where ZERO and SCALE are two constant values stored with the array. In
all other respects, a scaled array is exactly like a simple array.
This storage form is commonly used as a means of compressing the data
into a smaller disk file by selecting a data type for the scaled values
that uses fewer bytes per value than the unscaled data values (for
instance, scaling four byte _REALs into two byte integer _WORDS). Note,
information is lost in this process as the original unscaled values
cannot be recreated exactly from the scaled value.
Support for scaled arrays is currently limited, since it is anticipated
that they will only be of interest as an archive format. The following
details should be noted:
- Scaled arrays are ``read-only''. An error will be reported if an
attempt is made to map a scaled array for WRITE or UPDATE access. When
mapped for READ access, the pointer returned by NDF_MAP provides access
to the unscaled data values - that is, the mapped values are the
result of applying the scale and zero terms to the stored (scaled) values.
Currently, the scaled (i.e. stored) data values cannot be accessed
directly. If you want to change the array values in a scaled array, first
take a copy of the NDF and then modify the array values in the
copy11.
- The result of copying a scaled array (for instance, using
NDF_PROP, etc.) will be an equivalent simple array.
- Scaled arrays cannot be created directly. To create an NDF with
scaled arrays, first create an NDF with simple arrays, and then copy it
using NDF_ZSCAL. The output NDF created by NDF_ZSCAL is a copy
of the input NDF, but stored with scaled storage form12.
- The NDF_GTSZx routine can be used to determine the scale and zero
values of an existing scaled array.
- Scaled arrays cannot have complex data types. An error will be
reported if an attempt is made to to import an HDS structure describing a
complex scaled array, or to assign scale and zero values to an array with
complex data values.
- When applied to a scaled array, the NDF_TYPE and NDF_FTYPE routines
return information about the data type of the unscaled data values. In
practice, this means that they return the data type of the SCALE and ZERO
constants, rather than the data type of the array holding the stored
(scaled) data values. To get the data type of the stored (scaled) values,
use NDF_SCTYP.
Next: Delta compressed Storage Form
Up: ARRAY COMPONENT STORAGE FORM AND COMPRESSION
Previous: Simple Storage Form
NDF [1ex
Starlink User Note 33
R.F. Warren-Smith & D.S. Berry
16th July 2012
E-mail:starlink@jiscmail.ac.uk
Copyright © 2013 Science and Technology Facilities Council