next up previous 231
Next: Using header items from different sources
Up: More advanced header access
Previous: More advanced header access

Accessing header items using different data types

Header items can come in more than one data type, so extended HDR subroutines (as for IMG) are provided to access them. If the item isn't of the type you want, then a format conversion will be attempted. The way you specify the type you require is similar to that used for IMG routines - you just append the necessary character code to the routine name:
Character code Fortran-77 data type Description
C CHARACTER Character string
D DOUBLE PRECISION Double precision
I INTEGER Integer
L LOGICAL Logical
R REAL Single precision
Since all header item values can be converted to a character representation, this is the safest method to access an item of unknown type (which is why it is the method used by the ordinary HDR_IN subroutine). Some of the possible calls are:
     CALL HDR_INR( 'IN', ' ', 'BSCALE', 1, BSCALE, ISTAT )    [1]
     CALL HDR_INI( 'IN', ' ', 'BINNED', 1, IBFACT, ISTAT )    [2]
     CALL HDR_OUTL( 'OUT', ' ', 'CHECKED',                    [3]
     :              'Data checked for C/Rs', .TRUE., ISTAT )
The following notes refer to the numbered statements:
1.
This example reads in a REAL value BSCALE.

2.
This example reads in an INTEGER value BINNED.

3.
This example writes out a LOGICAL value CHECKED with the comment 'Data checked for C/Rs'.



next up previous 231
Next: Using header items from different sources
Up: More advanced header access
Previous: More advanced header access

IMG Simple Image Data Access
Starlink User Note 160
P.W. Draper
R.F. Warren-Smith
3 March 2003
E-mail:P.W.Draper@durham.ac.uk

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