Next: Primitive Storage Form
Up: ARRAY COMPONENT STORAGE FORM
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.
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. Instead, a simple array
must first be created (e.g. using NDF_NEW), and this can then be
converted to a scaled array by assigning scale and zero values to it
using NDF_PTSZ<T>. So a typical program could create a simple array, map
it for write access, store the scaled data values in the mapped simple
array, unmap the array, and then associate scale and zero values with the
array, thus converting it to a scaled array.
- 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: Primitive Storage Form
Up: ARRAY COMPONENT STORAGE FORM
Previous: Simple Storage Form
NDF [1ex
Starlink User Note 33
R.F. Warren-Smith & D.S. Berry
5th January 2009
E-mail:ussc@star.rl.ac.uk
Copyright © 2010 Science and Technology Facilities Council