Here is an example showing how to create the NDF structure in
§.
INCLUDE 'SAE_PAR'
INCLUDE 'DAT_PAR'
CHARACTER * ( DAT__SZLOC ) NLOC, ALOC, CELL
INTEGER DIMS( 2 ), STATUS
DATA DIMS / 512, 1024 /
* Create a container file with a top level scalar object of type NDF.
CALL HDS_NEW( 'dataset', 'DATASET', 'NDF', 0, 0, NLOC, STATUS )
* Create components in the top level object.
CALL DAT_NEW( NLOC, 'DATA_ARRAY', '_UBYTE', 2, DIMS, STATUS )
CALL DAT_NEWC( NLOC, 'LABEL', 80, 0, 0, STATUS )
CALL DAT_NEW( NLOC, 'AXIS', 'AXIS', 1, 2, STATUS )
* Create components in the AXIS structure...
* Get a locator to the AXIS component.
CALL DAT_FIND( NLOC, 'AXIS', ALOC, STATUS )
* Get a locator to the array cell AXIS(1).
CALL DAT_CELL( ALOC, 1, 1, CELL, STATUS )
* Create internal components within AXIS(1) using the CELL locator.
CALL DAT_NEW( CELL, 'DATA_ARRAY', '_REAL', 1, DIM( 1 ), STATUS )
CALL DAT_NEWC( CELL, 'LABEL', 30, 0, 0, STATUS )
* Annul the cell locator
CALL DAT_ANNUL( CELL, STATUS )
* Do the same for AXIS(2).
CALL DAT_CELL( ALOC, 1, 2, CELL, STATUS )
CALL DAT_NEW( CELL, 'DATA_ARRAY', '_REAL', 1, DIM( 2 ), STATUS )
CALL DAT_NEWC( CELL, 'LABEL', 10, 0, 0, STATUS )
CALL DAT_ANNUL( CELL, STATUS )
* Access objects which have been created.
...
* Tidy up
CALL DAT_ANNUL( ALOC, STATUS )
CALL DAT_ANNUL( NLOC, STATUS )
END
The following points should be borne in mind:
Here are some notes on particular aspects of this example:
We use two variants of this routine simply because the character string length has to be specified when creating a character object and it is normally most convenient to provide this via an additional integer argument. However, DAT_NEW may be used to create new objects of any type, including character objects. In this case the character string length would be provided via the type specification, e.g. `_CHAR*15' (a character string length of one is assumed if `_CHAR' is specified alone).
HDS Hierarchical Data System