Skip to content

Commit

Permalink
Make dew point optional in usaheatindex calculation
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Aug 30, 2018
1 parent 61dabbb commit ae1811f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '18.8.0'
_release = '1620'
_commit = '6eb7960'
_release = '1621'
_commit = '61dabbb'
4 changes: 3 additions & 1 deletion src/pywws/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def cadhumidex(temp, humidity):
float(humidity) / 100.0)
return temp + (0.555 * (saturation_pressure - 10.0))

def usaheatindex(temp, humidity, dew):
def usaheatindex(temp, humidity, dew=None):
"""Calculate Heat Index as per USA National Weather Service Standards
See http://en.wikipedia.org/wiki/Heat_index, formula 1. The
Expand All @@ -218,6 +218,8 @@ def usaheatindex(temp, humidity, dew):
"""
if temp is None or humidity is None:
return None
if dew is None:
dew = dew_point(temp, humidity)
if temp < 26.7 or humidity < 40 or dew < 12.0:
return temp
T = (temp * 1.8) + 32.0
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/service/weathercloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class ToService(pywws.service.LiveDataService):
#temp_out "'temp' : '%.1f',"#
#calc "wind_chill(data['temp_out'], data['wind_ave'])" "'chill' : '%.1f',"#
#calc "dew_point(data['temp_out'], data['hum_out'])" "'dew' : '%.1f',"#
#calc "usaheatindex(data['temp_out'], data['hum_out'], dew_point(data['temp_out'], data['hum_out']))" "'heat' : '%.1f',"#
#calc "(usaheatindex(data['temp_out'], data['hum_out'], dew_point(data['temp_out'], data['hum_out'])) - (1.072 * wind_mph(data['wind_ave']))) " "'thw' : '%.1f',"#
#calc "usaheatindex(data['temp_out'], data['hum_out'])" "'heat' : '%.1f',"#
#calc "(usaheatindex(data['temp_out'], data['hum_out']) - (1.072 * wind_mph(data['wind_ave'])))" "'thw' : '%.1f',"#
#hum_out "'hum' : '%.d',"#
#wind_ave "'wspdavg' : '%.1f',"#
#wind_gust "'wspdhi' : '%.1f',"#
Expand All @@ -91,7 +91,7 @@ def __init__(self, context, check_params=True):
#temp_in "'tempin': '%.1f',"#
#hum_in "'humin' : '%.d',"#
#calc "dew_point(data['temp_in'], data['hum_in'])" "'dewin' : '%.1f',"#
#calc "usaheatindex(data['temp_in'], data['hum_in'], dew_point(data['temp_in'], data['hum_in']))" "'heatin' : '%.1f',"#
#calc "usaheatindex(data['temp_in'], data['hum_in'])" "'heatin' : '%.1f',"#
"""

@contextmanager
Expand Down

0 comments on commit ae1811f

Please sign in to comment.