An NDF data structure which is to be used for output from an application can
be obtained in a number of ways.
Most simply, an existing NDF may be acquired by using the NDF_ASSOC routine
(§) and specifying `UPDATE' or `WRITE' access (in both the
call to the routine and the associated interface file if you are using
ADAM).
New values, or new components, may then be added to the NDF, as in the
following simple example which obtains a new value for an NDF's title
component:
SUBROUTINE TITLE( STATUS )
INTEGER STATUS, INDF
IF ( STATUS .NE. SAI__OK ) RETURN
CALL NDF_ASSOC( 'OUT', 'UPDATE', INDF, STATUS )
CALL NDF_CINP( 'TITLE', INDF, 'Title', STATUS )
CALL NDF_ANNUL( INDF, STATUS )
END
The same principle would also be used to write a new NDF data
component by mapping it for `WRITE' access and assigning new values to its
pixels, as described in §.
Note that `UPDATE' access has been used here in the call to NDF_ASSOC because we want other NDF components to retain their previous values. If `WRITE' access had been specified, then the NDF's components would have been automatically reset to an undefined state, as the NDF_ system interprets this access mode as a request to re-write the data structure.