idlastro / Astronomical Utilities: GLACTC

[Source code]

NAME
GLACTC
PURPOSE
Convert between celestial and Galactic (or Supergalactic) coordinates.
EXPLANATION
Program to convert right ascension (ra) and declination (dec) to
Galactic longitude (gl) and latitude (gb) (j=1) or vice versa (j=2).
CALLING SEQUENCE
GLACTC, ra, dec, year, gl, gb, j, [ /DEGREE, /FK4, /SuperGalactic ]
INPUT PARAMETERS
year     equinox of ra and dec, scalar       (input)
j        direction of conversion     (input)
        1:  ra,dec --> gl,gb
        2:  gl,gb  --> ra,dec
INPUTS OR OUTPUT PARAMETERS ( depending on argument J )
ra       Right ascension, hours (or degrees if /DEGREES is set), 
                  scalar or vector
dec      Declination, degrees,scalar or vector
gl       Galactic longitude, degrees, scalar or vector
gb       Galactic latitude, degrees, scalar or vector
All results forced double precision floating.
OPTIONAL INPUT KEYWORD PARAMETERS
/DEGREE - If set, then the RA parameter (both input and output) is 
         given in degrees rather than hours. 
/FK4 - If set, then the celestial (RA, Dec) coordinates are assumed
       to be input/output in the FK4 system.    By default,  coordinates
       are assumed to be in the FK5 system.    For B1950 coordinates,
       set the /FK4 keyword *and* set the year to 1950.
/SuperGalactic - If set, the GLACTC returns SuperGalactic coordinates
       as defined by deVaucouleurs et al. (1976) to account for the 
       local supercluster. The North pole in SuperGalactic coordinates 
       has Galactic coordinates l = 47.47, b = 6.32, and the origin is 
       at Galactic coordinates l = 137.37, b= 0 
EXAMPLES
Find the Galactic coordinates of Altair (RA (J2000): 19 50 47 
Dec (J2000): 08 52 06)
IDL> glactc, ten(19,50,47),ten(8,52,6),2000,gl,gb,1
==> gl = 47.74, gb = -8.91
PROCEDURE CALLS
BPRECESS, JPRECESS, PRECESS
HISTORY
FORTRAN subroutine by T. A. Nagy, 21-MAR-78.
Conversion to IDL, R. S. Hill, STX, 19-OCT-87.
Modified to handle vector input, E. P. Smith, GSFC, 14-OCT-94
Converted to IDL V5.0   W. Landsman   September 1997
Added DEGREE keyword, C. Markwardt, Nov 1999
Major rewrite, default now FK5 coordinates, added /FK4 keyword
use external precession routines    W. Landsman   April 2002
Add /Supergalactic keyword W. Landsman  September 2002
Fix major bug when year not 2000 and /FK4 not set W. Landsman July 2003