HOR2EQ
Name
HOR2EQ
Purpose
Converts local horizon coords (alt-az) of something to equatorial (ra-dec).
Explanation
This is a nice code to calculate equatorial (ra,dec) coordinates from
horizon (alt,az) coords. It is typically accurate to about 1 arcsecond
or better (I have checked the output against the publicly available XEPHEM
software). It performs precession, nutation, aberration, and refraction
corrections. The perhaps best thing about it is that it can take arrays
as inputs, in all variables and keywords EXCEPT Lat, lon, and Altitude
(the code assumes these aren't changing), and uses vector arithmetic in
every calculation except when calculating the precession matrices.
Calling Sequence
HOR2EQ, alt, az, jd, ra, dec, [ha, LAT= , LON= , /WS, OBSNAME= , $
/B1950 , PRECESS_= 0, NUTATE_= 0, REFRACT_= 0, $
ABERRATION_= 0, ALTITUDE= , /VERBOSE, _EXTRA= ]
Input Variables
alt : altitude (in degrees) [scalar or vector]
az : azimuth angle (in degrees, measured EAST from NORTH, but see
keyword WS below.) [scalar or vector]
JD : Julian Date [scalar or vector], double precision
Note: if RA and DEC are arrays, then alt and az will also be arrays.
If RA and DEC are arrays, JD may be a scalar OR an array of
the same dimensionality.
Optional Input Keywords
lat : north geodetic latitude of location in degrees
lon : EAST longitude of location in degrees
(Specify west longitude with a negative sign.)
/WS : Set this to get the azimuth measured westward from south
(not East of North).
obsname : Set this to a valid observatory name to be used by the
astrolib OBSERVATORY procedure, which will return the latitude
and longitude to be used by this program.
/B1950 : Set this if your ra and dec are specified in B1950,
FK4 coordinates (instead of J2000, FK5)
precess_ : Set this to 1 to force precession [default], 0 for no
precession.
nutate_ : Set this to 1 to force nutation [default], 0 for no nutation.
aberration_ : Set this to 1 to force aberration correction [default],
0 for no correction.
refract_ : Set to 1 to force refraction correction [default], 0 for
no correction.
altitude: The altitude of the observing location, in meters. [default=0].
/verbose: Set this for verbose output. The default is verbose=0.
_extra: This is for setting TEMPERATURE or PRESSURE explicitly, which are
used by CO_REFRACT to calculate the refraction effect of the
atmosphere. If you don't set these, the program will make an
intelligent guess as to what they are (taking into account your
altitude). See CO_REFRACT for more details.
Output Variables
ra : Right Ascension of object (J2000) in degrees (FK5); scalar or
vector.
dec : Declination of object (J2000) in degrees (FK5), scalar or vector.
ha : hour angle (in degrees) (optional)
Dependencies
NUTATE, PRECESS, ADSTRING(), SUNPOS, OBSERVATORY (from the astrolib)
CO_NUTATE, CO_ABERRATION, CO_REFRACT, HADEC2ALTAZ
Basic Steps
Precess Ra-Dec to current equinox.
Nutation Correction to Ra-Dec
Aberration correction to Ra-Dec
Calculate Local Mean Sidereal Time
Calculate Local Apparent Sidereal Time
Calculate Hour Angle
Do Spherical Trig to find Apparent Alt-Az
Apply refraction correction to find observed Alt.
Corrections I Do Not Make
* Deflection of Light by the sun due to GR. (typically milliarcseconds,
can be arcseconds within one degree of the sun)
* The Effect of Annual Parallax (typically < 1 arcsecond)
* and more (see below)
To Do
* Better Refraction Correction. Need to put in wavelength dependence,
and integrate through the atmosphere.
* Topocentric Parallax Correction (will take into account elevation of
the observatory)
* Proper Motion (but this will require crazy lookup tables or something).
* Difference between UTC and UT1 in determining LAST -- is this important?
* Effect of Annual Parallax (is this the same as topocentric Parallax?)
* Polar Motion
* Better connection to Julian Date Calculator.
Example
You are at Kitt Peak National Observatory, looking at a star at azimuth
angle 264d 55m 06s and elevation 37d 54m 41s (in the visible). Today is
Dec 25, 2041 and the local time is 10 PM precisely. What is the ra and dec
(J2000) of the star you're looking at? The temperature here is about 0
Celsius, and the pressure is 781 millibars. The Julian date for this
time is 2466879.7083333
IDL> hor2eq, ten(37,54,41), ten(264,55,06), 2466879.7083333d, ra, dec, $
/verb, obs='kpno', pres=781.0, temp=273.0
The program produces this output (because the VERBOSE keyword was set):
Latitude = +31 57 48.0 Longitude = *** 36 0.0 ; longitude prints weirdly b/c of negative input to ADSTRING!!
Julian Date = 2466879.708333
Az, El = 17 39 40.4 +37 54 41.0 (Observer Coords)
Az, El = 17 39 40.4 +37 53 39.6 (Apparent Coords)
LMST = +03 53 54.1
LAST = +03 53 53.6
Hour Angle = +03 38 30.1 (hh:mm:ss)
Ra, Dec: 00 15 23.5 +15 25 1.9 (Apparent Coords)
Ra, Dec: 00 15 24.2 +15 25 0.1 (J2041.9841)
Ra, Dec: 00 13 14.1 +15 11 0.3 (J2000)
The star is therefore Algenib! Compare the derived Ra, Dec with what XEPHEM
got:
Ra, Dec: 00 13 14.2 +15 11 1.0 (J2000)
Author
Chris O'Dell
Univ. of Wisconsin-Madison
Observational Cosmology Laboratory
Email: odell@cmb.physics.wisc.edu
Revision History
Made all integers type LONG W. Landsman September 2007
Fixed for case of scalar Julian date but vector positions W L June 2009