idlastro / FITS Astrometry and Calibration: WCS_CHECK_CTYPE

[Source code]

NAME
WCS_CHECK_CTYPE
PURPOSE
Checks that a pair of CTYPE parameters conform to WCS format and return
the projection type and coordinate type extracted from them.
EXPLANATION
Stops with an error message if CTYPE does not conform to standard,
unless one or both CTYPE strings is missing.
If only CTYPE[0] is present, and is valid, this counts as a
"pass".
If ctype is unset, returns silently, with coord_type = 'X' and
projection_type = 'DEF'.
Low-level procedure extracted from WCSXY2SPH & WCSSPH2XY to reduce code 
duplication. 
CATEGORY
Mapping and Auxiliary FITS Routine
CALLING SEQUENCE
wcs_check_ctype, ctype, projection_type, [coord_type]
INPUT PARAMETERS
ctype  - astrometry-related CTYPE strings extracted from the header.
OUTPUT PARAMETERS
projection_type - three-character code specifying map projection.
                  If ctype is not specified returns 'DEF' for default.
coord_type -      one- or two-character code specifying the coordinate
                  type, 'X' (unknown) if not specified. 'C' for RA & Dec. 
NOTES
The conventions followed here check consistency with
"Representations of Celestial Coordinates in FITS" by Calabretta
and  Greisen (2002, A&A, 395, 1077; also see
http://fits.gsfc.nasa.gov/fits_wcs.html).
PROCEDURE
Astrometry CTYPEs should come in longitude and latitude pairs in one
of three formats: 'RA---xxx' & 'DEC--xxx', 'yLON-xxx' & 'yLAT-xxx', or
'zzLN-xxx' & 'zzLT-xxx' where xxx is the projection code and y or zz
specify the type of the latitude & longitude axes, e.g. Galactic,
Ecliptic etc. If the CTYPE pair is in this format, xxx is returned as
the projection type.
COMMON BLOCKS
none
PROCEDURES CALLED
none
AUTHOR
J. P. Leahy
MODIFICATIONS/REVISION LEVEL
1.0     Jul 2013 Extracted from WCSXY2SPH & WCSSPH2XY
1.1     Aug 2013 Now does actually stop if error detected.
1.2     Jan 2014 Recognize when RA, DEC reversed, W. Landsman