From 0d7f1abaf8b35a8ca4642f19f7677df0a584807a Mon Sep 17 00:00:00 2001 From: John Kline Date: Mon, 24 Aug 2020 13:09:58 -0700 Subject: [PATCH] v3.5.0b8: suport rain and snow icons in WU forecasts. --- bin/user/forecast.py | 16 +++++++++++++++- install.py | 2 +- readme.txt | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/user/forecast.py b/bin/user/forecast.py index 4f89617..729fa08 100644 --- a/bin/user/forecast.py +++ b/bin/user/forecast.py @@ -555,7 +555,7 @@ from weewx.engine import StdService from weewx.cheetahgenerator import SearchList -VERSION = "3.4.0b7" +VERSION = "3.4.0b8" if weewx.__version__ < "4": raise weewx.UnsupportedFeature( @@ -2557,6 +2557,20 @@ def create_records_from_five_day(fc, issued_ts, now, location=None): r['clouds'] = 'B1' else: r['clouds'] = 'OV' + # Precip + precip_type = fc['daypart'][0]['precipType'][daypart_index] + precip_chance = fc['daypart'][0]['precipChance'][daypart_index] + if precip_chance > 0 and (precip_type == 'rain' or precip_type == 'snow'): + if precip_chance < 30: + r[precip_type] = 'S' + elif precip_chance < 60: + r[precip_type] = 'C' + elif precip_chance < 80: + r[precip_type] = 'L' + elif precip_chance < 100: + r[precip_type] = 'O' + else: + r[precip_type] = 'D' if half_day_index == 0: r['tempMax'] = Forecast.str2float( 'temperatureMax', fc['temperatureMax'][half_day_index], WU_KEY) diff --git a/install.py b/install.py index 99559e8..332d592 100644 --- a/install.py +++ b/install.py @@ -10,7 +10,7 @@ def loader(): class ForecastInstaller(ExtensionInstaller): def __init__(self): super(ForecastInstaller, self).__init__( - version="3.4.0b7", + version="3.4.0b8", name='forecast', description='Generate and display weather and tide forecasts.', author="Matthew Wall", diff --git a/readme.txt b/readme.txt index 8e66828..d938280 100644 --- a/readme.txt +++ b/readme.txt @@ -78,7 +78,7 @@ Installation instructions: 1) run the installer: -wee_extension --install weewx-forecast-3.4.0b7.zip +wee_extension --install weewx-forecast-3.4.0b8.zip 2) modify weewx.conf for your location: