mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-04-04 14:55:38 -04:00
Adding a little more Python documentation.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user