4 Accessing header information

 4.1 Example 6 – Reading a header item

It is often very useful for an application to be able to access the header information within an NDF, e.g. to get the airmass, time, name of the source etc. The IMG library provides a number of simple routines which allow you to gain access to the header. The following example shows how an integer header item called ALT_OBS is read from the header.

4.1 Example 6 – Reading a header item


  C This simple code reads a header item.
          INCLUDE ’SAE_PAR’
          INTEGER STATUS     ! Global Status
          INTEGER NX         ! Number of X pixels
          INTEGER NY         ! Number of Y pixels
          INTEGER IP         ! Image pointer
          INTEGER ALTOBS     ! Item to get
          WRITE (*,*) ALTOBS

Interface file:

  interface HEADER
    parameter IN
    prompt ’Input NDF’

Note that this assumes that there really is an item called ALT_OBS in the header. To check this (and to find if you need to substitute something else in as a test) use the fitskeys command in Figaro to find out which items exist within the FITS header of your test files.

The above example read in an integer value. HDR_INR, HDR_INC, HDR_IND and HDR_INL read in real, character, double precision and logical header items respectively.

Other HDRroutines include:

A full description of how to use these items can be found in the IMG manual (SUN/160).