From 1291d286d34f411614c3535c943dd095038ecb7e Mon Sep 17 00:00:00 2001 From: Tung Lam Nguyen Le Date: Tue, 15 Jun 2021 16:39:45 +0700 Subject: [PATCH] Add season change event in events.py and enum.py --- kosmorrolib/enum.py | 2 +- kosmorrolib/events.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kosmorrolib/enum.py b/kosmorrolib/enum.py index e9420cd..9bf4e0d 100644 --- a/kosmorrolib/enum.py +++ b/kosmorrolib/enum.py @@ -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""" diff --git a/kosmorrolib/events.py b/kosmorrolib/events.py index 20d5d03..2506dae 100644 --- a/kosmorrolib/events.py +++ b/kosmorrolib/events.py @@ -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.