wylark
/
infoex-autowx.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
035df95
)
Small bugfix with hn24, and add units config check
author
Alexander Vasarab <alexander@wylark.com>
Thu, 3 Mar 2022 23:13:38 +0000
(15:13 -0800)
committer
Alexander Vasarab <alexander@wylark.com>
Thu, 3 Mar 2022 23:13:38 +0000
(15:13 -0800)
infoex-autowx.py
patch
|
blob
|
history
diff --git
a/infoex-autowx.py
b/infoex-autowx.py
index 05e1d4661bc08fc01343c52a6aa31c1ab0581a91..9b72eeee3bd0749994ee7910e3c902be023b7ce1 100755
(executable)
--- a/
infoex-autowx.py
+++ b/
infoex-autowx.py
@@
-128,6
+128,10
@@
def setup_config(config):
LOG.critical("%s is not a valid timezone", tz)
sys.exit(1)
LOG.critical("%s is not a valid timezone", tz)
sys.exit(1)
+ if station['units'] not in ['metric', 'english', 'american']:
+ print("Please specify either metric, english, or american for the units.")
+ sys.exit(1)
+
# By default, fetch three hours of data
#
# If user wants hn24 or wind averaging, then
# By default, fetch three hours of data
#
# If user wants hn24 or wind averaging, then
@@
-538,7
+542,8
@@
def get_nrcs_data(begin, end, station):
hn24 = 0.0
if hn24 is not None:
hn24 = 0.0
if hn24 is not None:
- remote_data['hn24'] = hn24
+ if station['hn24']:
+ remote_data['hn24'] = hn24
return remote_data
return remote_data
@@
-697,7
+702,8
@@
def get_mesowest_data(begin, end, station):
wind_direction_avg = sum(wind_direction_values) / len(wind_direction_values)
if hn24 is not None:
wind_direction_avg = sum(wind_direction_values) / len(wind_direction_values)
if hn24 is not None:
- remote_data['hn24'] = hn24
+ if station['hn24']:
+ remote_data['hn24'] = hn24
# overwrite the following with the respective averages, if
# applicable
# overwrite the following with the respective averages, if
# applicable