Open any almanac or consult any catalog that contains the positions of celestial bodies and one will usually find those positions expressed using the coordinates right ascension ( α) and declination ( δ ) . These are coordinates referred to the plane of the Earth's equator at a given epoch and are meant to be independent of the Earth's motion. For an observer on the surface of the Earth, these coordinates may not be very useful. Of more use might be having the positions of celestial bodies in a coordinate system dependent on the observer's position. The horizon coordinate system is best suited for this purpose. In the horizon system, positions are expressed using the coordinates azimuth ( A ) and altitude ( a ) . Azimuth is the angular distance measured clockwise along the observer's horizon from a specified reference point (usually true north) to the intersection with a great circle drawn from the observer's zenith through the celestial body of interest. Altitude is the angular distance of a celestial body above or below the observer's horizon, measured along a great circle passing through the body and the observer's zenith. If the observer knows his or her precise location on the Earth (longitude and latitude), knows the right ascension and declination of the celestial body to be observed, and knows the Greenwich Apparent Sidereal Time (GAST) at the time of interest, the local altitude and azimuth of the celestial body can easily be obtained.
A simple algorithm for computing the Greenwich Apparent Sidereal Time to an accuracy of about 0.1 seconds is given elsewhere at this site. Once that time is obtained, the local hour angle (LHA) can be found from:
where LHA is in degrees, GAST and the right ascension of the body are expressed in hours, and λ, the observer's longitude, is also expressed in degrees. Note that the observer's longitude is added if it is east of Greenwich; it is subtracted if the observer's longitude is west of Greenwich.
The altitude of the observed body can be obtained using the formula:
where φ is the observer's latitude. Here all angles should be converted to the proper units (degrees for most calculators, radians for most computer programs). The range of proper values for the altitude is ± 90 degrees.
The azimuth is found from the formula:
where A is the azimuth angle. When finding the azimuth, the double-argument arctangent function (such as ATAN2 in Fortran or atan2() in C) should be used with the numerator and denominator above entered separately (care must be taken in the order of the arguments). In most implementations, this will give a resulting angle between -pi and +pi radians. In order to express the resulting azimuth in the range between 0 and 360 degrees, the result should be converted to degrees, if necessary, and 360 degrees should be added to any negative values.