Browse Source

docs: add docs for get_ephemerides() (#9)

tags/v0.10.0
Jérôme Deuchnord 3 years ago
committed by GitHub
parent
commit
6cea55e774
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions
  1. +1
    -0
      Pipfile
  2. +6
    -0
      kosmorrolib/data.py
  3. +13
    -0
      kosmorrolib/ephemerides.py

+ 1
- 0
Pipfile View File

@@ -9,6 +9,7 @@ babel = "*"
coveralls = "*" coveralls = "*"
parameterized = "*" parameterized = "*"
black = "*" black = "*"
coverage = "*"


[packages] [packages]
skyfield = ">=1.32.0,<2.0.0" skyfield = ">=1.32.0,<2.0.0"


+ 6
- 0
kosmorrolib/data.py View File

@@ -195,6 +195,12 @@ class AsterEphemerides(Serializable):
self.set_time = set_time self.set_time = set_time
self.object = aster self.object = aster


def __repr__(self):
return (
"<AsterEphemerides rise_time=%s culmination_time=%s set_time=%s aster=%s>"
% (self.rise_time, self.culmination_time, self.set_time, self.object)
)

def serialize(self) -> dict: def serialize(self) -> dict:
return { return {
"object": self.object.serialize(), "object": self.object.serialize(),


+ 13
- 0
kosmorrolib/ephemerides.py View File

@@ -115,6 +115,19 @@ def get_moon_phase(
def get_ephemerides( def get_ephemerides(
position: Position, date: datetime.date = datetime.date.today(), timezone: int = 0 position: Position, date: datetime.date = datetime.date.today(), timezone: int = 0
) -> [AsterEphemerides]: ) -> [AsterEphemerides]:
"""Compute and return the ephemerides for the given position and date, adjusted to the given timezone if any.

Compute the ephemerides for June 9th, 2021:

>>> pos = Position(50.5824, 3.0624)
>>> get_ephemerides(pos, datetime.date(2021, 6, 9))
[<AsterEphemerides rise_time=2021-06-09 03:36:18+00:00 culmination_time=2021-06-09 11:47:05+00:00 set_time=2021-06-09 19:58:10+00:00 aster=<Object type=star name=Sun />>, <AsterEphemerides rise_time=2021-06-09 02:58:49+00:00 culmination_time=2021-06-09 11:02:18+00:00 set_time=2021-06-09 19:15:58+00:00 aster=<Object type=satellite name=Moon />>, <AsterEphemerides rise_time=2021-06-09 04:05:32+00:00 culmination_time=2021-06-09 11:57:51+00:00 set_time=2021-06-09 19:49:16+00:00 aster=<Object type=planet name=Mercury />>, <AsterEphemerides rise_time=2021-06-09 04:51:39+00:00 culmination_time=2021-06-09 13:12:45+00:00 set_time=2021-06-09 21:33:38+00:00 aster=<Object type=planet name=Venus />>, <AsterEphemerides rise_time=2021-06-09 06:37:42+00:00 culmination_time=2021-06-09 14:39:49+00:00 set_time=2021-06-09 22:41:29+00:00 aster=<Object type=planet name=Mars />>, <AsterEphemerides rise_time=2021-06-09 23:43:15+00:00 culmination_time=2021-06-09 04:53:50+00:00 set_time=2021-06-09 10:00:35+00:00 aster=<Object type=planet name=Jupiter />>, <AsterEphemerides rise_time=2021-06-09 23:01:34+00:00 culmination_time=2021-06-09 03:40:38+00:00 set_time=2021-06-09 08:15:43+00:00 aster=<Object type=planet name=Saturn />>, <AsterEphemerides rise_time=2021-06-09 01:55:34+00:00 culmination_time=2021-06-09 09:18:00+00:00 set_time=2021-06-09 16:40:29+00:00 aster=<Object type=planet name=Uranus />>, <AsterEphemerides rise_time=2021-06-09 00:26:54+00:00 culmination_time=2021-06-09 06:12:55+00:00 set_time=2021-06-09 11:58:57+00:00 aster=<Object type=planet name=Neptune />>, <AsterEphemerides rise_time=2021-06-09 22:22:10+00:00 culmination_time=2021-06-09 02:31:56+00:00 set_time=2021-06-09 06:37:43+00:00 aster=<Object type=planet name=Pluto />>]

Compute the ephemerides for June 9th, 2021:

>>> get_ephemerides(pos, datetime.date(2021, 6, 9), timezone=2)
[<AsterEphemerides rise_time=2021-06-09 05:36:18+02:00 culmination_time=2021-06-09 13:47:05+02:00 set_time=2021-06-09 21:58:10+02:00 aster=<Object type=star name=Sun />>, <AsterEphemerides rise_time=2021-06-09 04:58:49+02:00 culmination_time=2021-06-09 13:02:19+02:00 set_time=2021-06-09 21:15:58+02:00 aster=<Object type=satellite name=Moon />>, <AsterEphemerides rise_time=2021-06-09 06:05:32+02:00 culmination_time=2021-06-09 13:57:51+02:00 set_time=2021-06-09 21:49:16+02:00 aster=<Object type=planet name=Mercury />>, <AsterEphemerides rise_time=2021-06-09 06:51:39+02:00 culmination_time=2021-06-09 15:12:45+02:00 set_time=2021-06-09 23:33:38+02:00 aster=<Object type=planet name=Venus />>, <AsterEphemerides rise_time=2021-06-09 08:37:42+02:00 culmination_time=2021-06-09 16:39:49+02:00 set_time=2021-06-09 00:43:41+02:00 aster=<Object type=planet name=Mars />>, <AsterEphemerides rise_time=2021-06-09 01:47:05+02:00 culmination_time=2021-06-09 06:53:50+02:00 set_time=2021-06-09 12:00:35+02:00 aster=<Object type=planet name=Jupiter />>, <AsterEphemerides rise_time=2021-06-09 01:05:33+02:00 culmination_time=2021-06-09 05:40:38+02:00 set_time=2021-06-09 10:15:43+02:00 aster=<Object type=planet name=Saturn />>, <AsterEphemerides rise_time=2021-06-09 03:55:34+02:00 culmination_time=2021-06-09 11:18:01+02:00 set_time=2021-06-09 18:40:29+02:00 aster=<Object type=planet name=Uranus />>, <AsterEphemerides rise_time=2021-06-09 02:26:54+02:00 culmination_time=2021-06-09 08:12:55+02:00 set_time=2021-06-09 13:58:57+02:00 aster=<Object type=planet name=Neptune />>, <AsterEphemerides rise_time=2021-06-09 00:26:08+02:00 culmination_time=2021-06-09 04:31:56+02:00 set_time=2021-06-09 08:37:43+02:00 aster=<Object type=planet name=Pluto />>]
"""
ephemerides = [] ephemerides = []


def get_angle(for_aster: Object): def get_angle(for_aster: Object):


Loading…
Cancel
Save