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():
|
for shower_id, shower_info in METEOR_SHOWERS.items():
|
||||||
# Calculate peak date based on solar longitude
|
# Calculate peak date based on solar longitude
|
||||||
peak_date = calculate_solar_longitude_date(
|
peak_longitude = shower_info["peak_solar_longitude"]
|
||||||
year, shower_info["peak_solar_longitude"]
|
assert isinstance(peak_longitude, (int, float))
|
||||||
)
|
peak_date = calculate_solar_longitude_date(year, peak_longitude)
|
||||||
|
|
||||||
# Calculate activity period
|
# Calculate activity period
|
||||||
activity_start = calculate_solar_longitude_date(
|
start_longitude = shower_info["activity_start"]
|
||||||
year, shower_info["activity_start"]
|
assert isinstance(start_longitude, (int, float))
|
||||||
)
|
activity_start = calculate_solar_longitude_date(year, start_longitude)
|
||||||
activity_end = calculate_solar_longitude_date(year, shower_info["activity_end"])
|
|
||||||
|
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
|
# Calculate moon phase at peak
|
||||||
moon_illumination, moon_phase_desc = calculate_moon_phase(peak_date)
|
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,
|
"peak": peak_formatted,
|
||||||
"active": active_formatted,
|
"active": active_formatted,
|
||||||
"rate": f"{shower_info['rate_min']}-{shower_info['rate_max']} meteors per hour",
|
"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 "
|
+ "h "
|
||||||
+ shower_info["radiant_dec"],
|
+ str(shower_info["radiant_dec"]),
|
||||||
"moon_phase": moon_phase_desc,
|
"moon_phase": moon_phase_desc,
|
||||||
"visibility": shower_info["visibility"],
|
"visibility": shower_info["visibility"],
|
||||||
"description": shower_info["description"],
|
"description": shower_info["description"],
|
||||||
|
@ -255,7 +258,7 @@ def calculate_meteor_shower_data(year: int) -> list[MeteorShower]:
|
||||||
meteor_data.append(meteor_shower)
|
meteor_data.append(meteor_shower)
|
||||||
|
|
||||||
# Sort by peak date
|
# 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
|
return meteor_data
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue