I/O between AST Objects and FITS headers is supported by a specialised form of Channel called a FitsChan. A FitsChan contains a buffer which may hold any number, including zero, of FITS header cards. This buffer forms a workspace in which you can assemble FITS cards and manipulate them before writing them out to a FITS file.
By default, when a FitsChan is first created, it contains no cards and there are four ways of inserting cards into it:
).
).
).
). If you supply a source
routine, it will be called when the FitsChan is created in order to
fill it with an initial set of cards (
).
There are also three ways of removing cards from a FitsChan:
).
).
). If you supply a sink routine,
it will be called when the FitsChan is deleted in order to write out
any FITS cards that remain in it (
).
Note, in particular, that reading an AST Object from a FitsChan is
destructive. That is, it deletes the FITS cards that describe the
Object. The reason for this is explained in
.
In addition to the above, you may also read individual cards from a
FitsChan using the function AST_FINDFITS (which is not
destructive). This is the main means of writing out FITS cards if you
have not supplied a sink routine. AST_FINDFITS also provides a means
of searching for particular FITS cards (by keyword, for example) and
there are other facilities for overwriting cards when required
(
).
AST A Library for Handling World Coordinate Systems in Astronomy