idlastro / FITS Astrometry and Calibration: PRECESS_CD

[Source code]

NAME
PRECESS_CD
PURPOSE
Precess the CD (coordinate description) matrix from a FITS header 
EXPLANATION
The CD matrix is precessed from EPOCH1 to EPOCH2.  Called by HPRECESS
CALLING SEQUENCE
PRECESS_CD, cd, epoch1, epoch2, crval_old, crval_new, [/FK4]  
INPUTS/OUTPUT
CD - 2 x 2 CD (coordinate description) matrix in any units
        (degrees or radians).  CD will altered on output to contain 
        precessed values in the same units.    On output CD will always
        be double precision no matter how input.
INPUTS
EPOCH1 - Original equinox of coordinates, scalar (e.g. 1950.0).  
EPOCH2 - Equinox of precessed coordinates, scalar (e.g. 2000.0)
CRVAL_OLD - 2 element vector containing RA and DEC in DEGREES
        of the reference pixel in the original equinox
CRVAL_NEW - 2 elements vector giving CRVAL in the new equinox 
INPUT KEYWORD
/FK4 - If this keyword is set, then the precession constants are taken
      in the FK4 reference frame.   The default is the FK5 frame.
RESTRICTIONS
PRECESS_CD should not be used more than 2.5 centuries from the
year 1900.      
PROCEDURE
Adapted from the STSDAS program FMATPREC.  Precession changes the
location of the north pole, and thus changes the rotation of
an image from north up.  This is reflected in the precession of the
CD matrix.   This is usually a very small change. 
PROCEDURE CALLS
PRECESS
REVISION HISTORY
Written, Wayne Landsman, ST Systems  February 1988
Fixed sign error in computation of SINRA     March 1992
Added /FK4 keyword                           Feb 1994
Converted to IDL V5.0   W. Landsman   September 1997
Use B/Jprecess for conversion between 1950 and 2000 W.L. Aug 2009
ute C - inclination of the mean equator in the new equinox relative
hat of the old equinox
Get RA of old pole in new coordinates
oordinates of old pole (RA is arbitrary)
ixed sign error Mar-92
otate to new north pole