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 astRead. We must also remember to
rewind the FitsChan first, if necessary, such as by clearing its Card
attribute, which defaults to 1:
AstObject *wcsinfo; ... astClear( fitschan, "Card" ); wcsinfo = astRead( fitschan );
If the pointer returned by astRead 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 ( !strcmp( astGetC( wcsinfo, "Class" ), "FrameSet" ) ) { <the Object is a FrameSet, so use it> } else { <something unexpected was read> }
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 astShow () 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:
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