For the complete documentation index, see llms.txt. This page is also available as Markdown.

Azimuth and Altitude

The following example uses the Skyfield library in python to calculate the azimuth and altitude of Mars above Boston (US) on the 1st March 1980.

from skyfield.api import N,S,E,W, wgs84

# Altitude and azimuth in the sky of a specific geographic location

boston = earth + wgs84.latlon(42.3583 * N, 71.0603 * W, elevation_m=43)
astro = boston.at(ts.utc(1980, 3, 1)).observe(mars)
app = astro.apparent()

alt, az, distance = app.altaz()
print(alt.dstr())
print(az.dstr())
print(distance)

# OUTPUT
# 24deg 30' 27.2"
# 93deg 04' 29.5"
# 0.678874 au

Last updated