Altitude and Azimuth Calculation


Given the coordinates of an object, our location on the earths surface, and the local sidereal time, it is possible to calculate the altitude and azimuth of the object.

Those who study the following equations will observe that the site longitude does not appear in the calculations. It would have been used in the calculation of the local sidereal time, and is no longer needed once that has been done.

It will also be noticed that the RA of the object is used only in the calculation of the hour angle (HA) and that once the HA is known, neither RA nor LST are needed.

The following equations are written in a C (or Fortran) style pseudocode.

	ha = lst - ra

	sinh = sin(lat) * sin(dec) + cos(lat) * cos(dec) * cos(ha)

	sinz = -cos(dec)*sin(ha)
	cosz = ( sin(dec) - sin(lat)*sinh ) / cos(lat)

	sin(alt) = sinh
	tan(az) = cosz / sinz

Notice that division by zero would occur for a site at the pole with a latitude of 90 degrees.

An "altaz" (altazimuth) telescope would also need the parallactic angle of an object to control an image derotator, and this may be calculated as follows:

	sinb = -sin(az) * cos(lat) / cos(dec)
	cosb = -cos(ha) * cos(az) - sin(ha) * sin(az) * sin(lat)
	tan(pa) = cosb / sinb

Notice again that division by zero would occur for an object with a declination of 90 degrees (at the celestial pole).

Notice that inverse trigonometric functions will need to be used to calculate alt, az, and pa. Typically the "atan2" function with two arguments is used to calculate the inverse tangent, as it gives the angle over the appropriate full range of 0-360 degrees, perhaps constrained to the range -180 to 180.

The Astronomical Triangle

The above equations are derived using spherical trigonometry.

The triangle in question is known as the "astronomical triangle" and is the triangle with vertices being the object of interest (O) , the zenith (Z), and the north celestial pole (P). The three sides of this triangle are:

The angles at the vertices of this triangle are:
Have any comments? Questions? Drop me a line!

Tom's home page /