Browse Source

Add season change event in events.py and enum.py

pull/24/head
Tung Lam Nguyen Le 3 years ago
committed by Jérôme Deuchnord
parent
commit
1291d286d3
2 changed files with 8 additions and 1 deletions
  1. +1
    -1
      kosmorrolib/enum.py
  2. +7
    -0
      kosmorrolib/events.py

+ 1
- 1
kosmorrolib/enum.py View File

@@ -25,7 +25,7 @@ class EventType(Enum):
MAXIMAL_ELONGATION = 4
MOON_PERIGEE = 5
MOON_APOGEE = 6
EARTH_SEASON_CHANGE = 7

class ObjectType(Enum):
"""An enumeration of object types"""


+ 7
- 0
kosmorrolib/events.py View File

@@ -245,6 +245,13 @@ def _search_moon_perigee(start_time: Time, end_time: Time, timezone: int) -> [Ev
return events


def _earth_change_season(start_time: Time, end_time: Time, timezone: int):
event = []
t, y = almanac.find_discrete(start_time,end_time,almanac.seasons(eph))
for yi, ti in zip(y,t):
event.appendn(EventType.EARTH_SEASON_CHANGE,almanac.SEASON_EVENT[yi],ti.utc_iso(' '))
return event

def get_events(for_date: date = date.today(), timezone: int = 0) -> [Event]:
"""Calculate and return a list of events for the given date, adjusted to the given timezone if any.



Loading…
Cancel
Save