Types
This commit is contained in:
parent
8901bc9bbb
commit
bc4d956042
|
@ -197,15 +197,18 @@ def calculate_meteor_shower_data(year: int) -> list[MeteorShower]:
|
|||
|
||||
for shower_id, shower_info in METEOR_SHOWERS.items():
|
||||
# Calculate peak date based on solar longitude
|
||||
peak_date = calculate_solar_longitude_date(
|
||||
year, shower_info["peak_solar_longitude"]
|
||||
)
|
||||
peak_longitude = shower_info["peak_solar_longitude"]
|
||||
assert isinstance(peak_longitude, (int, float))
|
||||
peak_date = calculate_solar_longitude_date(year, peak_longitude)
|
||||
|
||||
# Calculate activity period
|
||||
activity_start = calculate_solar_longitude_date(
|
||||
year, shower_info["activity_start"]
|
||||
)
|
||||
activity_end = calculate_solar_longitude_date(year, shower_info["activity_end"])
|
||||
start_longitude = shower_info["activity_start"]
|
||||
assert isinstance(start_longitude, (int, float))
|
||||
activity_start = calculate_solar_longitude_date(year, start_longitude)
|
||||
|
||||
end_longitude = shower_info["activity_end"]
|
||||
assert isinstance(end_longitude, (int, float))
|
||||
activity_end = calculate_solar_longitude_date(year, end_longitude)
|
||||
|
||||
# Calculate moon phase at peak
|
||||
moon_illumination, moon_phase_desc = calculate_moon_phase(peak_date)
|
||||
|
@ -235,9 +238,9 @@ def calculate_meteor_shower_data(year: int) -> list[MeteorShower]:
|
|||
"peak": peak_formatted,
|
||||
"active": active_formatted,
|
||||
"rate": f"{shower_info['rate_min']}-{shower_info['rate_max']} meteors per hour",
|
||||
"radiant": shower_info["radiant_ra"].split("h")[0]
|
||||
"radiant": str(shower_info["radiant_ra"]).split("h")[0]
|
||||
+ "h "
|
||||
+ shower_info["radiant_dec"],
|
||||
+ str(shower_info["radiant_dec"]),
|
||||
"moon_phase": moon_phase_desc,
|
||||
"visibility": shower_info["visibility"],
|
||||
"description": shower_info["description"],
|
||||
|
@ -255,7 +258,7 @@ def calculate_meteor_shower_data(year: int) -> list[MeteorShower]:
|
|||
meteor_data.append(meteor_shower)
|
||||
|
||||
# Sort by peak date
|
||||
meteor_data.sort(key=lambda x: datetime.strptime(x["peak_date"], "%Y-%m-%d"))
|
||||
meteor_data.sort(key=lambda x: datetime.strptime(str(x["peak_date"]), "%Y-%m-%d"))
|
||||
|
||||
return meteor_data
|
||||
|
||||
|
|
Loading…
Reference in a new issue