hor2eq {astrolibR}R Documentation

Converts local horizon coordinates (alt-az) to equatorial coordinates(ra-dec)


Converts local horizon coordinates (alt-az) to equatorial coordinates(ra-dec)


hor2eq(alt, az, jd,  lat=43.0783, lon= -89.865, ws=FALSE,
           b1950 = FALSE, precess_=TRUE, nutate_=TRUE,
           refract_ = TRUE, aberration_ = TRUE, altitude=0)



local apparent altitude, in degrees, scalar or vector


local apparent altitude, in degrees, scalar or vector, measured east of north unless ws=TRUE


Julian Date, in days, scalar or vector


local geodetic latitude of observer, in degrees, scalar or vector (default=43.0783)


east longitude of observer, in degrees; specify west longitude with a negative sign (default=-89.865)


if =TRUE, azimuth is measured westward from south, rather than eastward of north


if =TRUE, Right Ascension and declination are specified in B1950/FK4, rather than J2000/FK5 coordinates (default=FALSE)


if =TRUE, precession is applied (default=TRUE)


if =TRUE, nutation is applied (default=TRUE)


if =TRUE, refraction correction is applied (default=TRUE)


if =TRUE, aberration correction is applied (default=TRUE)


altitude of the observing location, in meters (default=0)


This function calculates equatorial (ra,dec) coordinates from horizon (alt,az) coords. It is typically accurate to about 1 arcsecond or better, performing precession, nutation, aberration, and refraction corrections. Inputs can be vectors except for the observer's latitude, longitude and altitude. ra, dec, alt and az must be vectors of the same length, but jd may be a scalar or a vector of the same length.

Steps in the calculation:
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
Apply spherical trigonometry to find Apparent Alt-Az
Apply refraction correction to find observed Alt

The user can add specification for temperature and pressure used by function co_refract to calculate the refraction effect of the atmosphere. See co_refract for more details.



Right Ascension of object (J2000/FK5), in degrees, scalar or vector


declination of object (J2000/FK5), in degrees, scalar or vector


hour angle, in degrees


Written by Chris O'Dell Univ. of Wisconsin-Madison

R adaptation by Arnab Chakraborty June 2013

See Also

altaz2hadec co_nutate co_refract ct2lst precess


#   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.
#   Result: ra=00h13m14.s  dec=+15d11'0.3"   ha=+03h3m30.1s
#   The star is Algenib
hor2eq(ten(37,54,41), ten(264,55,06), 2466879.7083333, lat=+31.9633, lon=-111.6)

# 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)

[Package astrolibR version 0.1 Index]