modified: app.py
modified: static/css/style.css new file: static/icons/nebel_nacht.png
This commit is contained in:
13
app.py
13
app.py
@@ -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:
|
||||
|
||||
@@ -447,6 +447,7 @@ main { flex: 1; }
|
||||
.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_nacht"] { background: linear-gradient(135deg, #2a3040 0%, #485868 100%); }
|
||||
.wx-icon-wrap[data-icon="nebel_wolkig"] { background: linear-gradient(135deg, #505a64 0%, #8898a8 100%); }
|
||||
/* Night icons */
|
||||
.wx-icon-wrap[data-icon="nacht"] { background: linear-gradient(135deg, #080c20 0%, #141c40 100%); }
|
||||
|
||||
BIN
static/icons/nebel_nacht.png
Normal file
BIN
static/icons/nebel_nacht.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Reference in New Issue
Block a user