modified: app.py
This commit is contained in:
8
app.py
8
app.py
@@ -545,7 +545,13 @@ def get_mosmix_forecast(lat, lon, hours=72):
|
|||||||
rprob = p.get("probability_precipitation_height_gt_0_1mm_last_1h")
|
rprob = p.get("probability_precipitation_height_gt_0_1mm_last_1h")
|
||||||
rain_prob = round(float(rprob)*100) if not _isnan(rprob) else None
|
rain_prob = round(float(rprob)*100) if not _isnan(rprob) else None
|
||||||
n = p.get("cloud_cover_total")
|
n = p.get("cloud_cover_total")
|
||||||
clouds = round(float(n)*100) if not _isnan(n) else None
|
if not _isnan(n):
|
||||||
|
nf = float(n)
|
||||||
|
# wetterdienst returns cloud cover as a 0-1 fraction (like probabilities);
|
||||||
|
# guard against stations that already return 0-100 percent.
|
||||||
|
clouds = _clamp(round(nf * 100 if nf <= 1.0 else nf), 0, 100)
|
||||||
|
else:
|
||||||
|
clouds = None
|
||||||
sun = p.get("sunshine_duration")
|
sun = p.get("sunshine_duration")
|
||||||
sun_min = round(float(sun)/60) if not _isnan(sun) else 0
|
sun_min = round(float(sun)/60) if not _isnan(sun) else 0
|
||||||
wd = p.get("wind_direction")
|
wd = p.get("wind_direction")
|
||||||
|
|||||||
Reference in New Issue
Block a user