Each of an NDF's array components (i.e. its data, quality and variance) has an attribute termed its numeric type, which refers to the numerical precision used to store its pixel values. The NDF_ system allows array components to be stored using any of seven numeric types which correspond with the seven primitive numeric types provided by the underlying data system HDS. It also uses the same character strings as HDS to refer to these types, as follows:
Character String
Numeric Type
Fortran Type
'_DOUBLE'
Double-precision
DOUBLE PRECISION
'_REAL'
Single-precision
REAL
'_INTEGER'
Integer
INTEGER
'_WORD'
Word
INTEGER * 2
'_UWORD'
Unsigned word
INTEGER * 2
'_BYTE'
Byte
BYTE
'_UBYTE'
Unsigned byte
BYTE
The HDS documentation should be consulted for details of the range and precision of each of these numeric types, which may depend on the computer hardware in use. Note that character and logical types are not provided.
The numeric type of an array component is defined regardless of the
component's state.
The numeric type of the data component is specified when the NDF is
created and the numeric type of its variance component will normally
default to the same value, although both of these types may subsequently be
altered (see §).
In contrast, the numeric type of the quality component is
always `_UBYTE' and cannot be changed.
The numeric type of any NDF array component can be determined using the routine NDF_TYPE. For instance:
INCLUDE 'NDF_PAR'
CHARACTER * ( NDF__SZTYP ) TYPE
...
CALL NDF_TYPE( INDF, 'Data', TYPE, STATUS )
will return the numeric type of an NDF's data component as an upper case character string via the TYPE argument. Note how the symbolic constant NDF__SZTYP (defined in the include file NDF_PAR) should be used to declare the size of the character variable which is to receive the returned numeric type string.
The NDF_TYPE routine will also accept a list of array components. In this case, it will determine the numeric type of each component in the list and return the lowest-precision numeric type to which all these components can be converted without unnecessary loss of information. For instance, if values from the data and variance components of an NDF were to be combined, then a suitable numeric type for performing the processing could be obtained as follows:
CALL NDF_TYPE( INDF, 'Data,Variance', TYPE, STATUS )
If the data component held `_WORD' values and the variance
component held `_REAL' values, then a value of `_REAL' would be returned
indicating that both components could be accessed for processing using
single-precision floating-point arithmetic without losing information.
The question of type conversion during array component access is discussed
later (see §).