XY2AD
Name
XY2AD
Purpose
Compute R.A. and Dec from X and Y and a FITS astrometry structure
Explanation
The astrometry structure must first be extracted by EXTAST from a FITS
header. The offset from the reference pixel is computed and the CD
matrix is applied. If distortion is present then this is corrected.
If a WCS projection (Calabretta & Greisen 2002, A&A, 395, 1077) is
present, then the procedure WCSXY2SPH is used to compute astronomical
coordinates. Angles are returned in degrees.
XY2AD is meant to be used internal to other procedures.
For interactive purposes use XYAD.
Calling Sequence
XY2AD, x, y, astr, a, d
Inputs
X - row position in pixels, scalar or vector
Y - column position in pixels, scalar or vector
X and Y should be in the standard IDL convention (first pixel is
0), and not the FITS convention (first pixel is 1).
ASTR - astrometry structure, output from EXTAST procedure containing:
.CD - 2 x 2 array containing the astrometry parameters CD1_1 CD1_2
in DEGREES/PIXEL CD2_1 CD2_2
.CDELT - 2 element vector giving physical increment at reference pixel
.CRPIX - 2 element vector giving X and Y coordinates of reference pixel
(def = NAXIS/2)
.CRVAL - 2 element vector giving R.A. and DEC of reference pixel
in DEGREES
.CTYPE - 2 element vector giving projection types
.LONGPOLE - scalar longitude of north pole
.LATPOLE - scalar giving native latitude of the celestial pole
.PV2 - Vector of projection parameter associated with latitude axis
PV2 will have up to 21 elements for the ZPN projection, up to 3
for the SIN projection and no more than 2 for any other
projection
.DISTORT - Optional substructure specifying distortion parameters
Output
A - R.A. in DEGREES, same number of elements as X and Y
D - Dec. in DEGREES, same number of elements as X and Y
Restrictions
Note that all angles are in degrees, including CD and CRVAL
Also note that the CRPIX keyword assumes an FORTRAN type
array beginning at (1,1), while X and Y give the IDL position
beginning at (0,0). No parameter checking is performed.
Notes
AD2XY tests for presence of WCS coordinates by the presence of a dash
in the 5th character position in the value of CTYPE (e.g 'DEC--SIN').
Procedures Used
TAG_EXIST(), WCSXY2SPH
Revision History
Written by R. Cornett, SASC Tech., 4/7/86
Converted to IDL by B. Boothman, SASC Tech., 4/21/86
Perform CD multiplication in degrees W. Landsman Dec 1994
Understand reversed X,Y (X-Dec, Y-RA) axes, W. Landsman October 1998
Consistent conversion between CROTA and CD matrix W. Landsman Oct. 2000
No special case for tangent projection W. Landsman June 2003
Work for non-WCS coordinate transformations W. Landsman Oct 2004
Use CRVAL reference point for non-WCS transformation W.L. March 2007
Use post V6.0 notation W.L. July 2009