The axis label and units components of an NDF are both
accessed via the same set of routines which behave in a similar manner to
those for accessing an NDF's main character components
(§).
The value of either of these axis components may be obtained by calling the routine NDF_ACGET, as follows:
CHARACTER * ( 80 ) VALUE
...
VALUE = 'Default label'
CALL NDF_ACGET( INDF, 'Label', IAXIS, VALUE, STATUS )
This will return the value of the specified component, if it is defined. If its value is not defined and a non-blank default value has been set for the VALUE argument beforehand (as here), then this default value will be returned unchanged. However, if a blank VALUE string is provided, then the routine will generate its own default if necessary, returning either the value `Axis n' for the axis label component (where n is the axis number) or `pixel' for the axis units.
If an axis character component value is to be used in constructing a message, then it may be assigned directly to an MSG_ message token by means of the NDF_ACMSG routine. Thus, a message showing the label and units values for a particular NDF axis could be generated as follows:
CALL NDF_ACMSG( 'LABEL', INDF, 'Label', IAXIS, STATUS )
CALL NDF_ACMSG( 'UNITS', INDF, 'Units', IAXIS, STATUS )
CALL MSG_OUT( 'MESSAGE', '^LABEL (^UNITS)', STATUS )
Here, `LABEL' and `UNITS' are the names of message tokens (see SUN/104).
New values may be assigned to axis character components by using the routine NDF_ACPUT. For instance:
CALL NDF_ACPUT( 'Wavelength', INDF, 'Lab', 1, STATUS )
CALL NDF_ACPUT( 'nm', INDF, 'Unit', 1, STATUS )
would assign the label value `Wavelength' and the units value `nm' to axis 1 of an NDF. Note that the entire character string will be assigned (including trailing blanks if present) and the length of the component will be adjusted to match the new value. A value of zero for the fourth (IAXIS) argument would cause the value to be assigned to all of the NDF's axes.
After a successful call to NDF_ACPUT, the axis character
component's state becomes defined.
So, also, does the NDF's axis coordinate system--this means that
default values will be assigned to all the NDF's axis centre arrays
if these were not previously defined.
The effect of this is exactly the same as if the routine NDF_ACRE
(§) had been called immediately before the call to NDF_ACPUT.
The length of an axis character component (i.e. the number of characters it contains) is determined by the last assignment made to it, (e.g. by NDF_ACPUT) and may be obtained using the routine NDF_ACLEN. For instance:
INTEGER LENGTH
...
CALL NDF_ACLEN( INDF, 'Units', IAXIS, LENGTH, STATUS )
will return the number of characters in the specified axis units
component via the LENGTH argument.
If the component is in an undefined state, then NDF_ACLEN will return
the number of characters in the default value which would be returned
by NDF_ACGET under these circumstances (see §).