next up previous 264
Next: ...Validate WCS Information
Up: How To...
Previous: ...Build an AST Program


...Read a WCS Calibration from a Dataset

Precisely how you extract world coordinate system (WCS) information from a dataset obviously depends on what type of dataset it is. Usually, however, you should be able to obtain a set of FITS header cards which contain the WCS information (and probably much more besides). Suppose that CARDS is an array of character strings containing a complete set of FITS header cards and NCARD is the number of cards. Then proceed as follows:

      INTEGER FITSCHAN, ICARD, NCARD, WCSINFO
      CHARACTER * ( 80 ) CARDS( NCARD )

      ...

*  Create a FitsChan and fill it with FITS header cards.
      FITSCHAN = AST_FITSCHAN( AST_NULL, AST_NULL, ' ', STATUS )
      DO 1 ICARD = 1, NCARD
         CALL AST_PUTFITS( FITSCHAN, CARDS( ICARD ), .FALSE., STATUS )
 1    CONTINUE

*  Rewind the FitsChan and read WCS information from it.
      CALL AST_CLEAR( FITSCHAN, 'Card', STATUS )
      WCSINFO = AST_READ( FITSCHAN, STATUS )

The result should be a pointer, WCSINFO, to a FrameSet which contains the WCS information. This pointer can now be used to perform many useful tasks, some of which are illustrated in the following recipes.

Some datasets which do not easily yield FITS header cards may require a different approach, possibly involving use of a Channel or XmlChan ([*]) rather than a FitsChan. In the case of the Starlink NDF data format, for example, all the above may be replaced by a single call to the routine NDF_GTWCS--see SUN/33. The whole process can probably be encapsulated in a similar way for most other data systems, whether they use FITS header cards or not.

For more details about reading WCS information from datasets, see [*] and [*]. For a more general description of FitsChans and their use with FITS header cards, see [*] and [*]. For more details about FrameSets, see [*] and [*].


next up previous 264
Next: ...Validate WCS Information
Up: How To...
Previous: ...Build an AST Program

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council