To examine the contents of the FitsChan after writing the SkyFrame
above (), we must write a simple loop to
extract each card in turn and print it out. We must also remember to
rewind the FitsChan first, e.g. using AST_CLEAR. The
following loop would do:
CHARACTER * ( 80 ) CARD
...
CALL AST_CLEAR( FITSCHAN, 'Card', STATUS )
2 CONTINUE
IF ( AST_FINDFITS( FITSCHAN, '%f', CARD, .TRUE., STATUS ) ) THEN
WRITE ( *, '(A)' ) CARD
GO TO 2
END IF
Here, we have used the AST_FINDFITS function to find a FITS card by keyword. It is given a keyword template of ``%f'', which matches any FITS keyword, so it always finds the current card, which it returns. Its fourth argument is set to .TRUE., to indicate that the Card attribute should be incremented afterwards so that the following card will be found the next time around the loop. AST_FINDFITS returns .FALSE. when it reaches the end-of-file and this terminates the loop.
If we were storing the FITS headers in an output FITS file instead of
printing them out, we might use a loop like this but replace the WRITE
statement with a call to a suitable data access routine to store the
header card. This would only be necessary if we had not provided a
sink routine for the FitsChan ().
AST A Library for Handling World Coordinate Systems in Astronomy