X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=weather_renderer.py;h=23c5a201e6e44f254c39c112a2d6c59451231ba5;hb=6cd5b068127501d2b48e8ac67b7432bffc5fce53;hp=4a5663cfb612469b3890a2cb0a5be68b6a639a1d;hpb=da3a11e9fcea80a7700eb54605512d331a9ec612;p=kiosk.git diff --git a/weather_renderer.py b/weather_renderer.py index 4a5663c..23c5a20 100644 --- a/weather_renderer.py +++ b/weather_renderer.py @@ -246,6 +246,7 @@ function makePrecipChart(name, xValues, yValues) { days_seen.add(formatted_date) total = len(days_seen) + first_day = True days_seen = set() for n, date in enumerate(sorted(highs.keys())): if n % 3 == 0: @@ -264,6 +265,10 @@ function makePrecipChart(name, xValues, yValues) { aggregate = r + s aggregate_precip += aggregate precip[date].append(aggregate) + if first_day: + while len(precip[date]) < 8: + precip[date].insert(0, 0) + first_day = False day = datetime.fromtimestamp(ts[date]) formatted_date = day.strftime("%a %e %b") @@ -275,26 +280,34 @@ function makePrecipChart(name, xValues, yValues) { ) # Date - f.write( - "
" - + formatted_date - + "
\n" - ) + f.write(f''' + + +
+ {formatted_date} +
+ +''') # Conditions icon - f.write( - '
\n' - % self.pick_icon(conditions[date], rain[date], snow[date]) - ) + icon = self.pick_icon(conditions[date], rain[date], snow[date]) + f.write(f''' + + +
+ +
+ +''') - # Low temp + # Low temp -- left color = "#000099" if lows[date] <= 32.5: color = "#009999" f.write(f''' - + {int(lows[date])}°F   @@ -306,8 +319,8 @@ function makePrecipChart(name, xValues, yValues) { f.write(f'''
- - {aggregate_precip:3.1f}" + + {aggregate_precip:3.1f}”
@@ -321,14 +334,17 @@ function makePrecipChart(name, xValues, yValues) { color = "#AA0000" f.write(f''' - +   {int(highs[date])}°F - +''') + + # Precip graph + f.write(f''' - +