Files
astronomy/source/python/README.md

6.3 KiB

## Classes

class Observer

Represents the geographic location of an observer on the surface of the Earth.

Type Parameter Description
float latitude Geographic latitude in degrees north of the equator.
float longitude Geographic longitude in degrees east of the prime meridian at Greenwich, England.
float height Elevation above sea level in meters.

class Time

Represents a date and time used for performing astronomy calculations.

All calculations performed by Astronomy Engine are based on dates and times represented by Time objects.

Type Parameter Description
float ut UT1/UTC number of days since noon on January 1, 2000. See the ut attribute of this class for more details.
Type Attribute Description
float ut The floating point number of days of Universal Time since noon UTC January 1, 2000. Astronomy Engine approximates UTC and UT1 as being the same thing, although they are not exactly equivalent; UTC and UT1 can disagree by up to 0.9 seconds. This approximation is sufficient for the accuracy requirements of Astronomy Engine. Universal Time Coordinate (UTC) is the international standard for legal and civil timekeeping and replaces the older Greenwich Mean Time (GMT) standard. UTC is kept in sync with unpredictable observed changes in the Earth's rotation by occasionally adding leap seconds as needed. UT1 is an idealized time scale based on observed rotation of the Earth, which gradually slows down in an unpredictable way over time, due to tidal drag by the Moon and Sun, large scale weather events like hurricanes, and internal seismic and convection effects. Conceptually, UT1 drifts from atomic time continuously and erratically, whereas UTC is adjusted by a scheduled whole number of leap seconds as needed. The value in ut is appropriate for any calculation involving the Earth's rotation, such as calculating rise/set times, culumination, and anything involving apparent sidereal time. Before the era of atomic timekeeping, days based on the Earth's rotation were often known as mean solar days.
float tt Terrestrial Time days since noon on January 1, 2000. Terrestrial Time is an atomic time scale defined as a number of days since noon on January 1, 2000. In this system, days are not based on Earth rotations, but instead by the number of elapsed SI seconds divided by 86400. Unlike ut, tt increases uniformly without adjustments for changes in the Earth's rotation. The value in tt is used for calculations of movements not involving the Earth's rotation, such as the orbits of planets around the Sun, or the Moon around the Earth. Historically, Terrestrial Time has also been known by the term Ephemeris Time (ET).

Enumerated Types


ApsisKind

Represents whether a satellite is at a closest or farthest point in its orbit.

An apsis is a point in a satellite's orbit that is closest to, or farthest from, the body it orbits (its primary). ApsisKind is an enumerated type that indicates which of these two cases applies to a particular apsis event.

Value Description
Pericenter The satellite is at its closest point to its primary.
Apocenter The satellite is at its farthest point from its primary.
Invalid A placeholder for an undefined, unknown, or invalid apsis.

Body

The celestial bodies supported by Astronomy Engine calculations.

Value Description
Invalid An unknown, invalid, or undefined celestial body.
Mercury The planet Mercury.
Venus The planet Venus.
Earth The planet Earth.
Mars The planet Mars.
Jupiter The planet Jupiter.
Saturn The planet Saturn.
Uranus The planet Uranus.
Neptune The planet Neptune.
Pluto The planet Pluto.
Sun The Sun.
Moon The Earth's moon.

Direction

Indicates whether a body is rising above or setting below the horizon.

Specifies the direction of a rising or setting event for a body. For example, Direction.Rise is used to find sunrise times, and Direction.Set is used to find sunset times.

Value Description
Rise First appearance of a body as it rises above the horizon.
Set Last appearance of a body as it sinks below the horizon.

Refraction

Selects if/how to correct for atmospheric refraction.

Some functions allow enabling or disabling atmospheric refraction for the calculated apparent position of a celestial body as seen by an observer on the surface of the Earth.

Value Description
Airless No atmospheric refraction correction.
Normal Recommended correction for standard atmospheric refraction.
JplHorizons Used only for compatibility testing with JPL Horizons online tool.

Functions


BodyCode(name)

Finds the Body enumeration value, given the name of a body.

>>> astronomy.BodyCode('Mars')
<Body.Mars: 3>
Type Parameter Description
str name The common English name of a supported celestial body.

GeoMoon(time)

Calculates the geocentric position of the Moon at a given time.

Given a time of observation, calculates the Moon's position as a vector. The vector gives the location of the Moon's center relative to the Earth's center with x-, y-, and z-components measured in astronomical units. This algorithm is based on Nautical Almanac Office's Improved Lunar Ephemeris of 1954, which in turn derives from E. W. Brown's lunar theories from the early twentieth century. It is adapted from Turbo Pascal code from the book Astronomy on the Personal Computer by Montenbruck and Pfleger.

Type Parameter Description
Time time The date and time for which to calculate the Moon's position.