From bdf2b5fbaeb08eb6b527ed28fd620d4a225e699d Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 24 Apr 2026 11:52:57 +0200 Subject: [PATCH] modified: app.py modified: static/css/style.css --- app.py | 26 ++++++++++++++++++-------- static/css/style.css | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index 83343f5..7ac8bcc 100644 --- a/app.py +++ b/app.py @@ -338,8 +338,10 @@ def _parse_warning_datetime(value): # schnee snow # blitz dry thunderstorm (WW 17, 91-92) # sturm thunderstorm with rain (WW 95, 97-98) -# hagel hail (WW 27, 89-90, 93-94, 96, 99) +# hagel hail (WW 27, 89-90, 93-94) # schneebedeckt hail + snow (hagel WW + temp ≤ 2°C) +# sturmundhagel thunderstorm + rain + hail (WW 96, 99) +# schneebedecktsonne snow + sunshine (temp ≤ 2°C, cloud < 60 %) # nebel dense fog (visibility < 1000 m) # nebel_wolkig foggy + overcast (1000-5000 m, cloud > 60 %) # wolkig_nebel_sonne patchy fog / haze (1000-5000 m, less cloud) @@ -348,9 +350,10 @@ def _parse_warning_datetime(value): # nacht(2) moon+cloud+rain # nacht(3) moon+cloud+snow -_WW_HAIL = {27, 89, 90, 93, 94, 96, 99} # hail shower codes -_WW_THUNDER_RAIN = {91, 92, 95, 97, 98} # thunderstorm + precipitation -_WW_THUNDER_DRY = {17} # dry thunderstorm +_WW_HAIL = {27, 89, 90, 93, 94} # hail showers (no thunder) +_WW_THUNDER_HAIL = {96, 99} # thunderstorm + hail → sturmundhagel +_WW_THUNDER_RAIN = {91, 92, 95, 97, 98} # thunderstorm + precipitation +_WW_THUNDER_DRY = {17} # dry thunderstorm def weather_icon(cloud_pct, precip_mm, rain_prob, temp_c, is_night=False, visibility_m=None, weather_code=None): """Return the icon key for static/icons/{key}.png.""" @@ -365,6 +368,8 @@ def weather_icon(cloud_pct, precip_mm, rain_prob, temp_c, is_night=False, visibi # ── WW-code based icons (thunderstorm / hail) ───────────────────── if weather_code is not None: ww = int(weather_code) + if ww in _WW_THUNDER_HAIL: + return "sturmundhagel" if ww in _WW_HAIL: return "schneebedeckt" if (temp_c is not None and temp_c <= 2) else "hagel" if ww in _WW_THUNDER_RAIN: @@ -376,7 +381,9 @@ def weather_icon(cloud_pct, precip_mm, rain_prob, temp_c, is_night=False, visibi if temp_c is not None and temp_c <= 2 and ( (precip_mm and precip_mm > 0.1) or (rain_prob and rain_prob >= 40) ): - return "nacht(3)" if is_night else "schnee" + if is_night: + return "nacht(3)" + return "schneebedecktsonne" if (cloud_pct is not None and cloud_pct < 60) else "schnee" # ── Night icons ─────────────────────────────────────────────────── if is_night: @@ -407,12 +414,15 @@ def pick_daily_icon(hours): # Thunderstorm / hail: any hour with matching WW code takes priority ww_codes = [h.get("weather_code") for h in hours if h.get("weather_code") is not None] if ww_codes: - has_hail = any(w in _WW_HAIL for w in ww_codes) - has_t_rain = any(w in _WW_THUNDER_RAIN for w in ww_codes) - has_t_dry = any(w in _WW_THUNDER_DRY for w in ww_codes) + has_t_hail = any(w in _WW_THUNDER_HAIL for w in ww_codes) + has_hail = any(w in _WW_HAIL for w in ww_codes) + has_t_rain = any(w in _WW_THUNDER_RAIN for w in ww_codes) + has_t_dry = any(w in _WW_THUNDER_DRY for w in ww_codes) avg_temp = sum(h["temp_c"] for h in hours if h.get("temp_c") is not None) n_temp = sum(1 for h in hours if h.get("temp_c") is not None) mean_temp = avg_temp / n_temp if n_temp else 10 + if has_t_hail: + return "sturmundhagel" if has_hail: return "schneebedeckt" if mean_temp <= 2 else "hagel" if has_t_rain: diff --git a/static/css/style.css b/static/css/style.css index bc5b8de..0e833be 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -441,8 +441,10 @@ main { flex: 1; } .wx-icon-wrap[data-icon="schnee"] { background: linear-gradient(135deg, #3070a8 0%, #70b8e0 100%); } .wx-icon-wrap[data-icon="blitz"] { background: linear-gradient(135deg, #1e1040 0%, #5030a0 100%); } .wx-icon-wrap[data-icon="sturm"] { background: linear-gradient(135deg, #120e30 0%, #2a1870 60%, #0a0820 100%); } +.wx-icon-wrap[data-icon="sturmundhagel"] { background: linear-gradient(135deg, #0a0e28 0%, #1e1858 60%, #304870 100%); } .wx-icon-wrap[data-icon="hagel"] { background: linear-gradient(135deg, #284060 0%, #507090 100%); } .wx-icon-wrap[data-icon="schneebedeckt"]{ background: linear-gradient(135deg, #2a3a50 0%, #80a8c8 100%); } +.wx-icon-wrap[data-icon="schneebedecktsonne"] { background: linear-gradient(135deg, #4080a8 0%, #a8d0e8 60%, #e0c060 100%); } .wx-icon-wrap[data-icon="wolkig_nebel_sonne"] { background: linear-gradient(135deg, #706858 0%, #a09880 100%); } .wx-icon-wrap[data-icon="nebel"] { background: linear-gradient(135deg, #7a8a96 0%, #b0c0cc 100%); } .wx-icon-wrap[data-icon="nebel_wolkig"] { background: linear-gradient(135deg, #505a64 0%, #8898a8 100%); }