瀏覽代碼

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

pull/24/head
Tung Lam Nguyen Le 3 年之前
committed by Jérôme Deuchnord
父節點
當前提交
1291d286d3
共有 2 個檔案被更改,包括 8 行新增1 行删除
  1. +1
    -1
      kosmorrolib/enum.py
  2. +7
    -0
      kosmorrolib/events.py

+ 1
- 1
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"""


+ 7
- 0
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.



Loading…
取消
儲存