Wetter-Pill: Niederschlag = Höchstwert der nächsten 3 Std statt Tages-Max
weather.py get_weather_for_location: precip = max(h_precip[now_h:now_h+3])
(Fallback Tages-Max). map.js Pill zeigt '💧 X% (3h)'. Gilt auch fürs
Welten-Banner (geteiltes precip_prob-Feld) — behebt das 'ganzer Tag'-Problem
überall. Gespeicherte Tagebuch-Snapshots unberührt (historisch).
This commit is contained in:
parent
fd6be50762
commit
aefdac87ad
8 changed files with 31 additions and 19 deletions
|
|
@ -95,7 +95,7 @@ async def get_weather_for_location(lat: float, lon: float) -> dict:
|
|||
wcode = cur.get('weathercode', 0)
|
||||
wind = cur.get('windspeed_10m')
|
||||
is_day = cur.get('is_day', 1)
|
||||
precip = (daily.get('precipitation_probability_max') or [None])[0]
|
||||
_daily_precip_max = (daily.get('precipitation_probability_max') or [None])[0] # Fallback
|
||||
uv = (daily.get('uv_index_max') or [None])[0]
|
||||
|
||||
desc, icon = _WMO.get(wcode, ('Unbekannt', 'cloud'))
|
||||
|
|
@ -115,6 +115,12 @@ async def get_weather_for_location(lat: float, lon: float) -> dict:
|
|||
h_times = hourly.get('time', [])
|
||||
h_precip = hourly.get('precipitation_probability', [])
|
||||
|
||||
# Niederschlag fürs Pill: Höchstwert der NÄCHSTEN 3 STUNDEN (ab aktueller Stunde) statt Tages-Max
|
||||
# — relevanter fürs "jetzt/gleich Gassi?". h_precip ist nach Stunde indiziert (0 = heute 00:00);
|
||||
# der Slice ist am Tagesende automatisch kürzer (forecast_days=1).
|
||||
_next3 = [p for p in h_precip[now_h:now_h + 3] if p is not None]
|
||||
precip = max(_next3) if _next3 else _daily_precip_max
|
||||
|
||||
# Index-Liste nur für Stunden im Fenster now_h+1 … now_h+12
|
||||
window = []
|
||||
for t, p in zip(h_times, h_precip):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue