Convert celestial (ra-dec) coords to local horizon coords (alt-az).
eq2hor, ra, dec, jd, alt, az, [ha, LAT= , LON= , /WS, OBSNAME= , $
/B1950 , PRECESS_= 0, NUTATE_= 0, REFRACT_= 0, $
ABERRATION_= 0, ALTITUDE= , /VERBOSE, _EXTRA= ]
This is a nice code to calculate horizon (alt,az) coordinates from equatorial
(ra,dec) 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.
RA : Right Ascension of object (J2000) in degrees (FK5); scalar or
Dec : Declination of object (J2000) in degrees (FK5), scalar or vector.
JD : Julian Date [scalar or vector]
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
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
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
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: (all double precision)
alt : altitude (in degrees)
az : azimuth angle (in degrees, measured EAST from NORTH, but see
keyword WS above.)
ha : hour angle (in degrees) (optional)
NUTATE, PRECESS, OBSERVATORY, SUNPOS, ADSTRING() (from the astrolib)
CO_NUTATE, CO_ABERRATION, CO_REFRACT, ALTAZ2HADEC
Apply refraction correction to find apparent Alt.
Calculate Local Mean Sidereal Time
Calculate Local Apparent Sidereal Time
Do Spherical Trig to find apparent hour angle, declination.
Calculate Right Ascension from hour angle and local sidereal time.
Nutation Correction to Ra-Dec
Aberration correction to Ra-Dec
Precess Ra-Dec to current equinox.
Corrections I Do Not Make
* Deflection of Light by the sun due to GR. (typically milliarcseconds,
can be arseconds within one degree of the sun)
* The Effect of Annual Parallax (typically < 1 arcsecond)
* and more (see below)
* Better Refraction Correction. Need to put in wavelength dependence,
and integrate through the atmosphere.
* Topocentric Parallax Correction (will take into account elevation of
* Proper Motion (but this will require crazy lookup tables or something).
* Difference between UTC and UT1 in determining LAST -- is this
* Effect of Annual Parallax (is this the same as topocentric Parallax?)
* Polar Motion
* Better connection to Julian Date Calculator.
Find the position of the open cluster NGC 2264 at the Effelsburg Radio
Telescope in Germany, on June 11, 2023, at local time 22:00 (METDST).
The inputs will then be:
Julian Date = 2460107.250
Latitude = 50d 31m 36s
Longitude = 06h 51m 18s
Altitude = 369 meters
RA (J2000) = 06h 40m 58.2s
Dec(J2000) = 09d 53m 44.0s
IDL> eq2hor, ten(6,40,58.2)*15., ten(9,53,44), 2460107.250d, alt, az, $
lat=ten(50,31,36), lon=ten(6,51,18), altitude=369.0, /verb, $
The program produces this output (because the VERBOSE keyword was set)
Latitude = +50 31 36.0 Longitude = +06 51 18.0
Julian Date = 2460107.250000
Ra, Dec: 06 40 58.2 +09 53 44.0 (J2000)
Ra, Dec: 06 42 15.7 +09 52 19.2 (J2023.4422)
Ra, Dec: 06 42 13.8 +09 52 26.9 (fully corrected)
LMST = +11 46 42.0
LAST = +11 46 41.4
Hour Angle = +05 04 27.6 (hh:mm:ss)
Az, El = 17 42 25.6 +16 25 10.3 (Apparent Coords)
Az, El = 17 42 25.6 +16 28 22.8 (Observer Coords)
Compare this with the result from XEPHEM:
Az, El = 17h 42m 25.6s +16d 28m 21s
This 1.8 arcsecond discrepancy in elevation arises primarily from slight
differences in the way I calculate the refraction correction from XEPHEM, and
is pretty typical.
Univ. of Wisconsin-Madison
Observational Cosmology Laboratory