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:
dasemu committed 2026-03-17 17:54:43 +01:00
1 parent 5e2a22340f
commit 70e3a1cf92
10 files changed
+128 -1

No files matched your search

+40
View File
@@ -39,8 +39,48 @@ DAILY_VARIABLES = [
"wind_direction_10m_dominant",
"relative_humidity_2m_mean",
"surface_pressure_mean",
"weather_code",
]
# WMO Weather Code to sky condition mapping (Spanish labels).
_WMO_SKY_CONDITIONS: dict[int, str] = {
0: "soleado",
1: "soleado",
2: "parcialmente nublado",
3: "nublado",
45: "niebla",
48: "niebla",
51: "nublado",
53: "nublado",
55: "nublado",
56: "nublado",
57: "nublado",
61: "nublado",
63: "nublado",
65: "nublado",
66: "nublado",
67: "nublado",
71: "nublado con nieve",
73: "nublado con nieve",
75: "nublado con nieve",
77: "nublado con nieve",
80: "nublado",
81: "nublado",
82: "nublado",
85: "nublado con nieve",
86: "nublado con nieve",
95: "tormenta",
96: "tormenta",
99: "tormenta",
}
def wmo_code_to_sky_condition(code: int | float | None) -> str:
"""Convert a WMO weather code to a Spanish sky condition label."""
if code is None:
return "desconocido"
return _WMO_SKY_CONDITIONS.get(int(code), "desconocido")
MAX_RETRIES = 6
RETRY_BACKOFF = 2 # seconds between retries