idlastro / FITS Astrometry and Calibration: ADXY

[Source code]

NAME
ADXY
PURPOSE
Use a FITS header to convert astronomical to pixel coordinates
EXPLANATION
Use an image header to compute X and Y positions, given the
RA and Dec (or longitude, latitude) in decimal degrees.  
CALLING SEQUENCE
ADXY, HDR               ;Prompt for Ra and DEC 
ADXY, hdr, a, d, x, y, [ /PRINT, ALT= ]
INPUTS
HDR - FITS Image header containing astrometry parameters
OPTIONAL INPUTS
A - Right ascension in decimal DEGREES, scalar or vector
D - Declination in decimal DEGREES, scalar or vector        
If A and D are not supplied, user will be prompted to supply
them in either decimal degrees or HR,MIN,SEC,DEG,MN,SC format.
OPTIONAL OUTPUT
X     - row position in pixels, same number of elements as A and D
Y     - column position in pixels
X and Y will be in standard IDL convention (first pixel is 0) and not
the FITS convention (first pixel is 1).      As in FITS an integral
value corresponds to the center of a pixel.
OPTIONAL KEYWORD INPUT
/PRINT - If this keyword is set and non-zero, then results are displayed
        at the terminal.
ALT -  single character 'A' through 'Z' or ' ' specifying an alternate 
      astrometry system present in the FITS header.    The default is
      to use the primary astrometry or ALT = ' '.   If /ALT is set, 
      then this is equivalent to ALT = 'A'.   See Section 3.3 of 
      Greisen & Calabretta (2002, A&A, 395, 1061) for information about
      alternate astrometry keywords.
OPERATIONAL NOTES
If less than 5 parameters are supplied, or if the /PRINT keyword is
set, then the X and Y positions are displayed at the terminal.
If the procedure is to be used repeatedly with the same header,
then it would be faster to use AD2XY.
PROCEDURES CALLED
AD2XY, ADSTRING(), EXTAST, GETOPT(), TEN()
REVISION HISTORY
W. Landsman                 HSTX          January, 1988
Use astrometry structure   W. Landsman   January, 1994  
Changed default ADSTRING format   W. Landsman    September, 1995
Check if latitude/longitude reversed in CTYPE keyword W. L. Feb. 2004
Added ALT keyword   W. Landsman   September 2004
Work for non-spherical coordinate transformation W. Landsman May 2005 
More informative error message if astrometry missing W.L. Feb 2008
Cosmetic updates W.L. July 2011
Use version 2 astrometry structure J. P. Leahy July 2013