Adding a little more Python documentation.

This commit is contained in:
Don Cross
2019-07-07 17:42:21 -04:00
parent 254238b9ea
commit ce3d709d5e
3 changed files with 64 additions and 0 deletions

View File

@@ -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 <i>Improved Lunar Ephemeris</i> 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

View File

@@ -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 <i>Improved Lunar Ephemeris</i> 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.