next up previous contents FITSIO Home
Next: 7.1 Self-contained WCS Routines Up: CFITSIO Previous: 6.4 Complete List of

7. Celestial Coordinate System Routines

The FITS community has adopted a set of keyword conventions that are used to specify the transformation that is needed to convert between pixel locations in an image and the corresponding celestial coordinates on the sky. or more generally, to specify world coordinates that are to be associated with any pixel location in an n-dimensional FITS array. CFITSIO is distributed with a simple set of World Coordinate System routines that support a limited set of celestial projections. These routines were derived from functions in the Classic AIPS software package developed in the 1980s. These routines DO NOT support all the new conventions in the WCS papers that have recently been approved as part of the official FITS standard.

Rather than using the WCS routines distributed with CFITSIO, it is STRONGLY RECOMMENDED that software developers use a more sophisticated external WCS library. Several recommended libraries are:

  WCSLIB -  supported by Mark Calabretta
  WCSTools - supported by Doug Mink
  AST library - developed by the U.K. Starlink project

More information about the WCS keyword conventions and links to all of these libraries can be found on the FITS Support Office web site at http://fits.gsfc.nasa.gov under the WCS link.

Each of these libraries has a routine that will ingest a list of header keywords from which the transformations between pixel coordinates and world coordinates can be derived. The following CFITSIO routine may be used to copy the keywords in any FITS header into a long character string that can then be passed to the WCS library routine:

1
Concatenate the header keywords in the CHDU into a single long string of characters. Each 80-character fixed-length keyword record is appended to the output character string, in order, with no intervening separator or terminating characters. The last header record is terminated with a NULL character. This routine allocates memory for the returned character array, so the calling program must free the memory when finished.

Selected keywords may be excluded from the returned character string. If the second parameter (nocomments) is TRUE (nonzero) then any COMMENT, HISTORY, or blank keywords in the header will not be copied to the output string.

The 'exclist' parameter may be used to supply a list of keywords that are to be excluded from the output character string. Wild card characters (*, ?, and #) may be used in the excluded keyword names. If no additional keywords are to be excluded, then set nexc = 0 and specify NULL for the the **header parameter.  

  int fits_hdr2str
      (fitsfile *fptr, int nocomments, char **exclist, int nexc,
      > char **header, int *nkeys, int *status)



 
next up previous contents FITSIO Home
Next: 7.1 Self-contained WCS Routines Up: CFITSIO Previous: 6.4 Complete List of