modified: app.py

modified:   static/css/style.css
	new file:   static/icons/nebel_nacht.png
This commit is contained in:
simon
2026-04-24 12:01:34 +02:00
parent bdf2b5fbae
commit 31d58800f0
3 changed files with 11 additions and 3 deletions

13
app.py
View File

@@ -342,7 +342,8 @@ def _parse_warning_datetime(value):
# 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, day)
# nebel_nacht dense fog (visibility < 1000 m, night)
# nebel_wolkig foggy + overcast (1000-5000 m, cloud > 60 %)
# wolkig_nebel_sonne patchy fog / haze (1000-5000 m, less cloud)
# nacht clear night (moon)
@@ -351,6 +352,7 @@ def _parse_warning_datetime(value):
# nacht(3) moon+cloud+snow
_WW_HAIL = {27, 89, 90, 93, 94} # hail showers (no thunder)
_WW_GRAUPEL = {87, 88} # graupel → schneebedeckt
_WW_THUNDER_HAIL = {96, 99} # thunderstorm + hail → sturmundhagel
_WW_THUNDER_RAIN = {91, 92, 95, 97, 98} # thunderstorm + precipitation
_WW_THUNDER_DRY = {17} # dry thunderstorm
@@ -360,18 +362,20 @@ def weather_icon(cloud_pct, precip_mm, rain_prob, temp_c, is_night=False, visibi
# Fog (takes priority; fog unlikely when precipitating heavily)
if visibility_m is not None and visibility_m < 5000 and not (precip_mm and precip_mm > 0.5):
if visibility_m < 1000:
return "nebel"
return "nebel_nacht" if is_night else "nebel"
if cloud_pct is not None and cloud_pct > 60:
return "nebel_wolkig"
return "wolkig_nebel_sonne"
# ── WW-code based icons (thunderstorm / hail) ─────────────────────
# ── WW-code based icons (thunderstorm / hail / graupel) ──────────
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_GRAUPEL:
return "schneebedeckt"
if ww in _WW_THUNDER_RAIN:
return "sturm"
if ww in _WW_THUNDER_DRY:
@@ -416,6 +420,7 @@ def pick_daily_icon(hours):
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_graupel = any(w in _WW_GRAUPEL 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)
@@ -425,6 +430,8 @@ def pick_daily_icon(hours):
return "sturmundhagel"
if has_hail:
return "schneebedeckt" if mean_temp <= 2 else "hagel"
if has_graupel:
return "schneebedeckt"
if has_t_rain:
return "sturm"
if has_t_dry: