Access to axis array components takes place in much the same way as access to the main array components of an NDF. It also depends on the concept of mapping, as described in §.
The routine NDF_AMAP provides mapped access to an axis array. Thus, to read values from an NDF's axis centre array, the following call might be used:
INTEGER PNTR( 1 ), EL ... CALL NDF_AMAP( INDF, 'Centre', IAXIS, '_REAL', 'READ', PNTR, EL, STATUS )
Here, a numeric type of `_REAL' has been specified to indicate that an array of single-precision values is required and the mapping mode of `READ' indicates that values are to be read, but not modified. The routine returns an integer pointer to the mapped values via its PNTR argument and a count of the number of elements mapped via its EL argument (PNTR is actually a 1-dimensional array, so the pointer value in this example will be returned in its first element). The value returned for EL will be equal to the size of the NDF dimension being accessed.19The mapped values may be accessed in the normal way by passing them to a subroutine using the %VAL facility (see §).
If the axis array being accessed is in an undefined state, then a set of default values will be returned (see §). Note that the mapping mode initialisation options available when mapping the main NDF array components (§) cannot be applied to axis arrays.
NDF_AMAP will also accept a list of axis component names and will map all of them in the same way (i.e. with the same type and mapping mode). Pointers to each mapped array will be returned via the PNTR argument, which must have sufficient elements to accommodate the returned values. The following example shows how access to all the axis arrays for a particular NDF dimension could be obtained using this facility, and then passed to another routine for processing:
INTEGER PNTR( 3 ), EL ... CALL NDF_AMAP( INDF, 'Cent,Width,Var', IAXIS, '_DOUBLE', 'READ', PNTR, EL, : STATUS ) CALL DOAXIS( EL, %VAL( PNTR( 1 ) ), %VAL( PNTR( 2 ) ), %VAL( PNTR( 3 ) ), : STATUS )
Note that it is not possible to map axis arrays for all the
axes of an NDF in a single call to NDF_AMAP, because each
a different value of EL to be returned.
An IAXIS value of zero is therefore not permitted when calling NDF_AMAP.