Skip to content

Commit

Permalink
Merge pull request #16 from WSWUP/tdew-param
Browse files Browse the repository at this point in the history
Support setting Tdew instead of Ea
  • Loading branch information
cgmorton authored Oct 12, 2022
2 parents 1c46aae + 8deae6c commit 8f4d70e
Show file tree
Hide file tree
Showing 10 changed files with 354 additions and 206 deletions.
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

34 changes: 22 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ASCE Standardized Reference Evapotranspiration (ET)
===================================================

|version| |build| |codecov|
|version| |build|

NumPy functions for computing daily and hourly reference ET following the ASCE Standardized Reference Evapotranspiration Equations (ASCE2005_).

Expand All @@ -21,16 +21,18 @@ The raw input data is available `here <https://www.usbr.gov/pn-bin/daily.pl?stat
import math
import refet
# Compute actual vapor pressure from Tdew
tdew_c = (49.84 - 32) * (5.0 / 9) # F -> C
ea = 0.6108 * math.exp(17.27 * tdew_c / (tdew_c + 237.3)) # kPa
# ea = refet.calcs._saturated_vapor_pressure(tdew_c)
# The actual vapor pressure could be computed from the dew point temperature below
# or the tdew can be passed directly to the function
# Convert the dew point temperature to Celsius
# tdew = units._f2c(49.84)
# ea = 0.6108 * math.exp(17.27 * tdew / (tdew + 237.3))
# ea = refet.calcs._sat_vapor_pressure(tdew)
etr = refet.Daily(
tmin=66.65, tmax=102.80, ea=ea, rs=674.07, uz=4.80,
tmin=66.65, tmax=102.80, tdew=49.84, rs=674.07, uz=4.80,
zw=3, elev=1208.5, lat=39.4575, doy=182, method='asce',
input_units={'tmin': 'F', 'tmax': 'F', 'rs': 'Langleys', 'uz': 'mph',
'lat': 'deg'}
input_units={'tmin': 'F', 'tmax': 'F', 'tdew': 'F', 'rs': 'Langleys',
'uz': 'mph', 'lat': 'deg'}
).etr()
print(f'ETr: {float(etr):.2f} mm')
Expand Down Expand Up @@ -64,14 +66,25 @@ Required Parameters (hourly & daily)
======== ========== ====================================================
Variable Type Description [default units]
======== ========== ====================================================
ea ndarray Actual vapor pressure [kPa]
uz ndarray Wind speed [m s-1]
zw float Wind speed height [m]
elev ndarray Elevation [m]
lat ndarray Latitude [degrees]
doy ndarray Day of year
======== ========== ====================================================

Required Ea Parameters (hourly & daily)
---------------------------------------------------

Either the "ea" or "tdew" parameter must be set

======== ========== ====================================================
Variable Type Description [default units]
======== ========== ====================================================
ea ndarray Actual vapor pressure [kPa]
tdew ndarray Dew point temperature [C]
======== ========== ====================================================

Required Daily Parameters
-------------------------

Expand Down Expand Up @@ -185,6 +198,3 @@ References
.. |version| image:: https://badge.fury.io/py/refet.svg
:alt: Latest version on PyPI
:target: https://badge.fury.io/py/refet
.. |codecov| image:: https://codecov.io/gh/WSWUP/refet/branch/main/graphs/badge.svg
:alt: Coverage Status
:target: https://codecov.io/gh/WSWUP/refet
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "refet"
version = "0.3.12"
version = "0.4.0"
authors = [
{ name="Charles Morton", email="[email protected]" },
]
Expand Down
Loading

0 comments on commit 8f4d70e

Please sign in to comment.