Selaa lähdekoodia

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

pull/24/head
Tung Lam Nguyen Le 3 vuotta sitten
committed by Jérôme Deuchnord
vanhempi
commit
1291d286d3
2 muutettua tiedostoa jossa 8 lisäystä ja 1 poistoa
  1. +1
    -1
      kosmorrolib/enum.py
  2. +7
    -0
      kosmorrolib/events.py

+ 1
- 1
kosmorrolib/enum.py Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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.



Ladataan…
Peruuta
Tallenna