diff --git a/generate/template/astronomy.py b/generate/template/astronomy.py index 2f6fb793..9e4f029f 100644 --- a/generate/template/astronomy.py +++ b/generate/template/astronomy.py @@ -226,6 +226,10 @@ class Time: class Observer: """Represents the geographic location of an observer on the surface of the Earth. + + :param latitude: Geographic latitude in degrees north of the equator. + :param longitude: Geographic longitude in degrees east of the prime meridian at Greenwich, England. + :param height: Elevation above sea level in meters. """ def __init__(self, latitude, longitude, height=0): self.latitude = latitude @@ -579,6 +583,22 @@ def _CalcMoon(time): ) def 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](https://www.springer.com/us/book/9783540672210) + by Montenbruck and Pfleger. + + :param time: The date and time for which to calculate the Moon's position. + :return The Moon's position as a vector in J2000 Cartesian equatorial coordinates. + :rtype Vector + """ m = _CalcMoon(time) # Convert geocentric ecliptic spherical coordinates to Cartesian coordinates. diff --git a/source/python/README.md b/source/python/README.md index bd1b9f10..90db0c55 100644 --- a/source/python/README.md +++ b/source/python/README.md @@ -12,3 +12,27 @@ Observer(self, latitude, longitude, height=0) ``` Represents the geographic location of an observer on the surface of the Earth. +:param latitude: Geographic latitude in degrees north of the equator. +:param longitude: Geographic longitude in degrees east of the prime meridian at Greenwich, England. +:param height: Elevation above sea level in meters. + +## GeoMoon +```python +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](https://www.springer.com/us/book/9783540672210) +by Montenbruck and Pfleger. + +:param time: The date and time for which to calculate the Moon's position. +:return The Moon's position as a vector in J2000 Cartesian equatorial coordinates. +:rtype Vector + diff --git a/source/python/astronomy.py b/source/python/astronomy.py index d2b97267..33fb3162 100644 --- a/source/python/astronomy.py +++ b/source/python/astronomy.py @@ -317,6 +317,10 @@ class Time: class Observer: """Represents the geographic location of an observer on the surface of the Earth. + + :param latitude: Geographic latitude in degrees north of the equator. + :param longitude: Geographic longitude in degrees east of the prime meridian at Greenwich, England. + :param height: Elevation above sea level in meters. """ def __init__(self, latitude, longitude, height=0): self.latitude = latitude @@ -1893,6 +1897,22 @@ def _CalcMoon(time): ) def 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](https://www.springer.com/us/book/9783540672210) + by Montenbruck and Pfleger. + + :param time: The date and time for which to calculate the Moon's position. + :return The Moon's position as a vector in J2000 Cartesian equatorial coordinates. + :rtype Vector + """ m = _CalcMoon(time) # Convert geocentric ecliptic spherical coordinates to Cartesian coordinates.