From c0aac7cad1c7defde608354ee4055acc64e044eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sat, 27 Mar 2021 17:41:37 +0100 Subject: [PATCH] docs: add docs for get_ephemerides() --- Pipfile | 1 + kosmorrolib/data.py | 6 ++++++ kosmorrolib/ephemerides.py | 13 +++++++++++++ 3 files changed, 20 insertions(+) diff --git a/Pipfile b/Pipfile index 9c667d9..5316af6 100644 --- a/Pipfile +++ b/Pipfile @@ -9,6 +9,7 @@ babel = "*" coveralls = "*" parameterized = "*" black = "*" +coverage = "*" [packages] skyfield = ">=1.32.0,<2.0.0" diff --git a/kosmorrolib/data.py b/kosmorrolib/data.py index 50b5af3..45ab90e 100644 --- a/kosmorrolib/data.py +++ b/kosmorrolib/data.py @@ -195,6 +195,12 @@ class AsterEphemerides(Serializable): self.set_time = set_time self.object = aster + def __repr__(self): + return ( + "" + % (self.rise_time, self.culmination_time, self.set_time, self.object) + ) + def serialize(self) -> dict: return { "object": self.object.serialize(), diff --git a/kosmorrolib/ephemerides.py b/kosmorrolib/ephemerides.py index 81f2b2c..00af16b 100644 --- a/kosmorrolib/ephemerides.py +++ b/kosmorrolib/ephemerides.py @@ -115,6 +115,19 @@ def get_moon_phase( def get_ephemerides( position: Position, date: datetime.date = datetime.date.today(), timezone: int = 0 ) -> [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)) + [>, >, >, >, >, >, >, >, >, >] + + Compute the ephemerides for June 9th, 2021: + + >>> get_ephemerides(pos, datetime.date(2021, 6, 9), timezone=2) + [>, >, >, >, >, >, >, >, >, >] + """ ephemerides = [] def get_angle(for_aster: Object):