mirror of
https://github.com/Dasemu/skipredictor.git
synced 2026-11-26 15:26:15 +00:00
feat(weather): add sky conditions and snow type to predictions
Add WMO weather_code from Open-Meteo to derive sky conditions (sunny/cloudy/foggy/storm) and infer snow type (powder/hard/wet/spring) from temperature and snowfall data. Both fields flow through the full pipeline: weather API, hybrid predictor, SQLite storage, REST API schemas, Telegram bot messages, and scheduler tasks.
This commit is contained in:
1 parent
5e2a22340f
commit
70e3a1cf92
10 files changed
+128
-1
No files matched your search
@@ -147,6 +147,8 @@ def _forecasts_to_payload(
|
||||
"open_probability": row.get("open_probability"),
|
||||
"km_open": row.get("km_open"),
|
||||
"crowd_level": row.get("crowd_level"),
|
||||
"sky_condition": row.get("sky_condition"),
|
||||
"snow_type": row.get("snow_type"),
|
||||
"weather_summary": row.get("weather_summary"),
|
||||
"rule_overrides": json.loads(row["rule_notes_json"] or "[]")
|
||||
if isinstance(row.get("rule_notes_json"), str)
|
||||
@@ -304,6 +306,17 @@ def format_station_prediction(
|
||||
crowd_str = _crowd_label(crowd_raw)
|
||||
km_str = f"{km_open:.1f} / {max_km:.1f}"
|
||||
|
||||
sky_condition = prediction.get("sky_condition")
|
||||
snow_type = prediction.get("snow_type")
|
||||
|
||||
sky_block = ""
|
||||
if sky_condition and sky_condition != "desconocido":
|
||||
sky_block = f"Cielo: {sky_condition.capitalize()}\n"
|
||||
|
||||
snow_type_block = ""
|
||||
if snow_type and snow_type != "desconocido":
|
||||
snow_type_block = f"Tipo de nieve: {snow_type.capitalize()}\n"
|
||||
|
||||
weather_block = ""
|
||||
if weather_summary:
|
||||
weather_block = f"\n<b>Tiempo previsto:</b>\n{weather_summary}\n"
|
||||
@@ -321,6 +334,8 @@ def format_station_prediction(
|
||||
f"Estado: {open_str}\n"
|
||||
f"Km esquiables: {km_str}\n"
|
||||
f"Nivel de afluencia: {crowd_str}\n"
|
||||
f"{sky_block}"
|
||||
f"{snow_type_block}"
|
||||
f"{weather_block}"
|
||||
f"{reasons_block}"
|
||||
f"\n<i>Fuente: {source}</i>"
|
||||
|
||||
Reference in new issue
Block a user