Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion refet/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self, tmin, tmax, ea, rs, uz, zw, elev, lat, doy,
continue
elif unit.lower() not in [
'k', 'kelvin', 'f', 'fahrenheit',
'pa',
'pa','rh','relative humidity',
'langleys', 'w m-2', 'w/m2',
'mph',
'ft', 'feet',
Expand All @@ -121,6 +121,12 @@ def __init__(self, tmin, tmax, ea, rs, uz, zw, elev, lat, doy,
elif variable == 'ea':
if unit.lower() in ['pa']:
self.ea /= 1000.0
elif unit.lower() in ['rh','relative humidity']:
if self.ea.max() > 1.0: # check for percentage format
self.ea /= 100
# use Teten's formula
self.ea = self.ea * (0.61078 ** (17.27 * ((self.tmin+self.tmax)/2) / (
((self.tmin+self.tmax)/2) + 237.3)))
elif variable == 'rs':
if unit.lower() in ['langleys']:
self.rs *= 0.041868
Expand Down
7 changes: 6 additions & 1 deletion refet/hourly.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self, tmean, ea, rs, uz, zw, elev, lat, lon, doy, time,
continue
elif unit.lower() not in [
'k', 'kelvin', 'f', 'fahrenheit',
'pa',
'pa','rh','relative humidity',
'langleys', 'w m-2', 'w/m2',
'mph',
'ft', 'feet',
Expand All @@ -109,6 +109,11 @@ def __init__(self, tmean, ea, rs, uz, zw, elev, lat, lon, doy, time,
elif variable == 'ea':
if unit.lower() in ['pa']:
self.ea /= 1000.0
elif unit.lower() in ['rh','relative humidity']:
if self.ea.max() > 1.0: # check for percentage format
self.ea /= 100
# use Teten's formula
self.ea = self.ea * (0.61078 ** (17.27 * self.tmean / (self.tmean + 237.3)))
elif variable == 'rs':
if unit.lower() in ['langleys']:
self.rs *= 0.041868
Expand Down