modified: app.py
This commit is contained in:
20
app.py
20
app.py
@@ -540,26 +540,6 @@ def wind_direction_name(degrees):
|
|||||||
idx = round(float(degrees)/22.5) % 16
|
idx = round(float(degrees)/22.5) % 16
|
||||||
return dirs[idx]
|
return dirs[idx]
|
||||||
|
|
||||||
def weather_icon(cloud_pct, precip_mm, rain_prob, temp_c):
|
|
||||||
"""Return the icon key for static/icons/{key}.png."""
|
|
||||||
# Snow / sleet
|
|
||||||
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 "schnee"
|
|
||||||
# Rain with some sun visible (showers)
|
|
||||||
if (precip_mm and precip_mm > 0.1) or (rain_prob is not None and rain_prob >= 50):
|
|
||||||
return "wolkig(1)" if (cloud_pct is None or cloud_pct < 75) else "regen"
|
|
||||||
# Light rain probability: showers icon when partially cloudy
|
|
||||||
if rain_prob is not None and rain_prob >= 30 and cloud_pct is not None and cloud_pct > 50:
|
|
||||||
return "wolkig(1)"
|
|
||||||
# Cloud cover only
|
|
||||||
if cloud_pct is not None:
|
|
||||||
if cloud_pct > 80: return "wolkig"
|
|
||||||
if cloud_pct > 50: return "wolke"
|
|
||||||
if cloud_pct > 20: return "wolkig(2)"
|
|
||||||
return "sonne"
|
|
||||||
|
|
||||||
def get_mosmix_forecast(lat, lon, hours=72):
|
def get_mosmix_forecast(lat, lon, hours=72):
|
||||||
cache_key = (round(lat,2), round(lon,2), hours)
|
cache_key = (round(lat,2), round(lon,2), hours)
|
||||||
if cache_key in _forecast_cache:
|
if cache_key in _forecast_cache:
|
||||||
|
|||||||
Reference in New Issue
Block a user