next up previous
Next: Implicit Type Conversion
Up: ACCESSING ARRAY COMPONENTS
Previous: More About Mapping Modes

Initialisation Options   

Variations on the above basic mapping modes may be obtained by appending either of the two initialisation options `/BAD' or `/ZERO' to the mapping mode argument passed to NDF_MAP. These options specify the value to be supplied as ``initialisation'' in the absence of defined values. For instance, if `READ/ZERO' is specified, thus:

      CALL NDF_MAP( INDF, 'Data', '_REAL', 'READ/ZERO', PNTR, EL, STATUS )

then NDF_MAP will read the component's values if available, but instead of producing an error if its state is undefined, it will supply an array full of zeros instead. In similar circumstances, the access mode `READ/BAD' would supply an array full of the bad-pixel value appropriate to the numeric type in use.[*] The same technique applied to update access (e.g. a mapping mode of `UPDATE/BAD') has a similar effect, except that in this case the values, with possible subsequent modifications, will be written back to the array component when it is unmapped, causing its state to become defined.

The effect of initialisation options on write access (e.g. a mapping mode of `WRITE/ZERO') is slightly different. In this case the initial state of the component is irrelevant, and any initialisation option is always used to initialise the array's values when it is first mapped. These values, with subsequent modifications, are then written back to the NDF component when it is unmapped. Note that there is generally no point in using an initialisation option with write access if an application will subsequently assign values to all of the array's pixels, but it may be useful if only certain pixels will subsequently be assigned values as it can save having to explicitly assign default values to all the others.



next up previous
Next: Implicit Type Conversion
Up: ACCESSING ARRAY COMPONENTS
Previous: More About Mapping Modes


Starlink User Note 33
R.F. Warren-Smith
11th January 2000
E-mail:rfws@star.rl.ac.uk

Copyright © 2000 Council for the Central Laboratory of the Research Councils