modified: app.py

modified:   static/css/style.css
This commit is contained in:
simon
2026-04-24 11:52:57 +02:00
parent b89a1215cd
commit bdf2b5fbae
2 changed files with 20 additions and 8 deletions

16
app.py
View File

@@ -338,8 +338,10 @@ def _parse_warning_datetime(value):
# schnee snow # schnee snow
# blitz dry thunderstorm (WW 17, 91-92) # blitz dry thunderstorm (WW 17, 91-92)
# sturm thunderstorm with rain (WW 95, 97-98) # 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) # 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 dense fog (visibility < 1000 m)
# nebel_wolkig foggy + overcast (1000-5000 m, cloud > 60 %) # nebel_wolkig foggy + overcast (1000-5000 m, cloud > 60 %)
# wolkig_nebel_sonne patchy fog / haze (1000-5000 m, less cloud) # wolkig_nebel_sonne patchy fog / haze (1000-5000 m, less cloud)
@@ -348,7 +350,8 @@ def _parse_warning_datetime(value):
# nacht(2) moon+cloud+rain # nacht(2) moon+cloud+rain
# nacht(3) moon+cloud+snow # nacht(3) moon+cloud+snow
_WW_HAIL = {27, 89, 90, 93, 94, 96, 99} # hail shower codes _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_RAIN = {91, 92, 95, 97, 98} # thunderstorm + precipitation
_WW_THUNDER_DRY = {17} # dry thunderstorm _WW_THUNDER_DRY = {17} # dry thunderstorm
@@ -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) ───────────────────── # ── WW-code based icons (thunderstorm / hail) ─────────────────────
if weather_code is not None: if weather_code is not None:
ww = int(weather_code) ww = int(weather_code)
if ww in _WW_THUNDER_HAIL:
return "sturmundhagel"
if ww in _WW_HAIL: if ww in _WW_HAIL:
return "schneebedeckt" if (temp_c is not None and temp_c <= 2) else "hagel" return "schneebedeckt" if (temp_c is not None and temp_c <= 2) else "hagel"
if ww in _WW_THUNDER_RAIN: 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 ( 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) (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 ─────────────────────────────────────────────────── # ── Night icons ───────────────────────────────────────────────────
if is_night: if is_night:
@@ -407,12 +414,15 @@ def pick_daily_icon(hours):
# Thunderstorm / hail: any hour with matching WW code takes priority # 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] ww_codes = [h.get("weather_code") for h in hours if h.get("weather_code") is not None]
if ww_codes: if 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_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_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_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) 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) 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 mean_temp = avg_temp / n_temp if n_temp else 10
if has_t_hail:
return "sturmundhagel"
if has_hail: if has_hail:
return "schneebedeckt" if mean_temp <= 2 else "hagel" return "schneebedeckt" if mean_temp <= 2 else "hagel"
if has_t_rain: if has_t_rain:

View File

@@ -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="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="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="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="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="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="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"] { background: linear-gradient(135deg, #7a8a96 0%, #b0c0cc 100%); }
.wx-icon-wrap[data-icon="nebel_wolkig"] { background: linear-gradient(135deg, #505a64 0%, #8898a8 100%); } .wx-icon-wrap[data-icon="nebel_wolkig"] { background: linear-gradient(135deg, #505a64 0%, #8898a8 100%); }