Once you have stored a FITS header description of an Object in a
FitsChan using the native encoding (),
you can read it back using AST_READ in much the same way as with a
basic Channel (
). Similar comments
about validating the Object you read also apply
(
). If you have just written to the
FitsChan, you must remember to rewind it first:
INTEGER OBJECT ... CALL AST_CLEAR( FITSCHAN, 'Card', STATUS ) OBJECT = AST_READ( FITSCHAN, STATUS )
An important feature of a FitsChan is that read operations are
destructive. This means that if an Object description is found, it
will be consumed by AST_READ which will remove all the cards
involved, including associated COMMENT cards, from the FitsChan. Thus,
if you write an Object to a FitsChan, rewind, and read the same Object
back, you should end up with the original FitsChan contents. If you
need to circumvent this behaviour for any reason, it is a simple
matter to make a copy of a FitsChan using AST_COPY
(). If you then read from the copy, the
original FitsChan will remain untouched.
After a read completes, the FitsChan's Card attribute identifies the card immediately following the last card read, or the end-of-file of there are no more cards.
Since the native encoding is being used, any long strings involved
in the object description will have been split into two or more adjacent
contuation cards when the Object was stored in the header using routine
AST_WRITE. The AST_READ routine reverses this process by concatenating
any such adjacent continuation cards to re-create the original long
string.
AST A Library for Handling World Coordinate Systems in Astronomy