idlastro / FITS Astrometry and Calibration: HPRECESS

[Source code]

NAME
HPRECESS
PURPOSE
Precess the astrometry in a FITS header to a new equinox
CALLING SEQUENCE
HPRECESS, HDR, [ yearf ]      
INPUT-OUTPUT
HDR - FITS Header, must contain the CRVAL astrometry keywords,
        and either an EPOCH or EQUINOX keyword.
        HDR will be modified to contain the precessed astrometry
OPTIONAL INPUT
YEARF - Scalar, giving the year of the new (Final) equinox.
        If not supplied, user will be prompted for this value.
METHOD
The CRVAL and CD (or CROTA) keywords are extracted from the header 
and precessed to the new equinox.  The EPOCH or EQUINOX keyword in 
the header is  updated.  A HISTORY record is added
RESTRICTIONS
The reference frame is assumed to be FK5 or ICRS (which are extremely close)
and precess.pro is used to perform the precession.
Exceptions: If the input header is equinox 1950 and the output is equinox 2000
then jprecess is used to precess from B1950 to J2000.   If the input
header is equinox 2000 and the output is equinox 1950 then bprecess is
used to precess from J2000 to B1950). 
PROCEDURES USED
EXTAST, GET_EQUINOX(), SXADDPAR, SXADDHIST, PRECESS, PRECESS_CD
PUTAST, ZPARCHECK
REVISION HISTORY
Written  W. Landsman        STX              July, 1988
CD matrix precessed -                        February, 1989
Update EQUINOX keyword when CROTA2 present   November, 1992
Recognize a GSSS header                      June, 1994
Additional Noparams value recognize for storing CDs.  RSH, 6 Apr 95
Understand reversed X,Y (X-Dec, Y-RA) axes,   W. Landsman  October 1998
Correct algorithm when CROTA2 is in header W. Landsman  April 2006
Correct sign error introduced April 2006, include CDELT values
  when computing rotation of pole   W. Landsman July 2007
Call hprecess/jprecess for 1950<>2000   W. L. Aug 2009
Work when ASTR.LONGPOLE NE 180.0 W.L.  Aug 2014
EAR of Initial equinox
xtract astrometry from header
heck if non-standard CTYPE was used
est if RA and Dec reversed in 'CTYPE*'
recess the CRVAL coordinates
recess the CD matrix
pdate CRVAL values
pdate CD values
r CROTA2 value