next up previous 231
Next: Writing header items
Up: ACCESSING HEADER INFORMATION
Previous: ACCESSING HEADER INFORMATION

Reading header items

This example (taken from a complete program called hdrread.f - see §[*]) shows how to read the value of a header item from an image associated with the parameter 'IN':
*  Read the header item.
      CALL HDR_IN( 'IN', ' ', 'OBSERVER', 1, VALUE, ISTAT )
The call to HDR_IN specifies the image by using its parameter name - 'IN' (argument 1). If you have not previously accessed this image you will probably be prompted for its file name at this point.

The 2nd, blank argument, indicates that an ``ordinary'' FITS header item is required (there are other possible ``sources'' of header information which are described elsewhere).

The 3rd argument 'OBSERVER' specifies the name of the header item required and the 4th argument 1 indicates that you want the first occurrence of that item (just in case it occurs several times, which some items are allowed to do).

The 5th argument VALUE returns the header item value as a character string. If the header item you requested doesn't exist, then VALUE is returned unchanged, so you may want to set it to a sensible value (say '<unknown>') beforehand.



next up previous 231
Next: Writing header items
Up: ACCESSING HEADER INFORMATION
Previous: ACCESSING HEADER INFORMATION

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