Having stored a set of FITS header cards in a FitsChan and determined
how the WCS information is encoded
(
), the next step is to read an AST
Object from the FitsChan using AST_READ. We must also remember to
rewind the FitsChan first, if necessary, such as by clearing its Card
attribute, which defaults to 1:
INTEGER WCSINFO
...
CALL AST_CLEAR( FITSCHAN, 'Card', STATUS )
WCSINFO = AST_READ( FITSCHAN, STATUS )
If the pointer returned by AST_READ is not equal to AST__NULL, then
an Object has been read successfully. Otherwise, there was either no
information to read or the choice of FITS encoding
(
) was inappropriate.
At this point you might like to indulge in a little data validation
along the lines described in
, for example:
IF ( AST_GETC( WCSINFO, 'Class', STATUS ) .EQ. 'FrameSet' ) THEN
<the Object is a FrameSet, so use it>
ELSE
<something unexpected was read>
END IF
If a foreign encoding has definitely been used, then the Object will
automatically be a FrameSet (
), so
this stage can be omitted. However, if the native encoding
(
) might have been employed, which is a
possibility if you accept the FitsChan's default Encoding value, then
any class of Object might have been read and a quick check would be
worthwhile.
If you used AST_SHOW (
) to examine the
FrameSet which results from reading our example FITS header
(
), you would find that its base
Frame describes the image's pixel coordinate system and that its
current Frame is a SkyFrame representing galactic coordinates. These
two Frames are inter-related by a Mapping (actually a CmpMap) which
incorporates the effects of various rotations, scalings and a
``zenithal equal area'' sky projection, so that each pixel of the FITS
image is mapped on to a corresponding sky position in galactic
coordinates.
Because this FrameSet may be used both as a Mapping
(
) and as a Frame
(
), it may be employed directly to perform
many useful operations without any need to decompose it into its
component parts. These include:
).
and
).
) which might be used, for
example, to label columns of coordinates in a table
(
).
).
), which can be used to overlay
a variety of graphical information (including a coordinate
grid--Figure
) on the displayed image.
). This new FrameSet could then be
written out as FITS headers to describe the modified image
(
).
If the FrameSet contains other Frames (apart from the base and current
Frames), then you would also have access to information about other
coordinate systems associated with the image.
AST A Library for Handling World Coordinate Systems in Astronomy