diff --git a/pyet/radiation.py b/pyet/radiation.py index 80abec9..007f6d3 100644 --- a/pyet/radiation.py +++ b/pyet/radiation.py @@ -89,22 +89,22 @@ def jensen_haise(tmean, rs=None, cr=0.025, tx=-3, lat=None, method=0, Notes ----- - Method = 0: Based on :cite:t:`oudin_which_2005`. + Method = 0: Based on :cite:t:`jensen_evaporation_2016`. - .. math:: PET = \\frac{R_a(T_{mean}+5)}{68\\lambda} + .. math:: PET = \\frac{C_r(T_{mean}-T_x)R_s}{\\lambda} - Method = 1: Based on :cite:t:`jensen_evaporation_2016`. + Method = 1: Based on :cite:t:`oudin_which_2005`. - .. math:: PET = \\frac{C_r(T_{mean}-T_x)R_s}{\\lambda} + .. math:: PET = \\frac{R_a(T_{mean}+5)}{68\\lambda} """ lambd = calc_lambda(tmean) - if method == 2: + if method == 0: + pet = rs / lambd * cr * (tmean - tx) + elif method == 1: index = get_index(tmean) ra = extraterrestrial_r(index, check_lat(lat)) pet = ra * (tmean + 5) / 68 / lambd - elif method == 1: - pet = rs / lambd * cr * (tmean - tx) pet = clip_zeros(pet, clip_zero) return pet.rename("Jensen_Haise") diff --git a/pyet/version.py b/pyet/version.py index d54bddb..afe1cea 100644 --- a/pyet/version.py +++ b/pyet/version.py @@ -1,3 +1,3 @@ # This is the only location where the version will be written and changed. # Based on https://packaging.python.org/single_source_version/ -__version__ = "1.2.0" +__version__ = "1.2.1" diff --git a/tests/__init__.py b/tests/__init__.py index 7b97397..3aecb64 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1,4 @@ from tests import testfao56 from tests import testalternative +from tests import test_all diff --git a/tests/test_all.py b/tests/test_all.py new file mode 100644 index 0000000..73d6528 --- /dev/null +++ b/tests/test_all.py @@ -0,0 +1,27 @@ +"""This file tests all methods for a minimal functioning.""" +import unittest + +import numpy as np +import pandas as pd + +import pyet as et + +tmean = pd.Series(data=20 * np.sin(np.linspace(0, 1, 365) * 2 * np.pi), + index=pd.date_range("2001-01-01", "2001-12-31", freq="D")) +tmax = tmean + 2 +tmin = tmean - 2 +rh = pd.Series(data=60 * np.sin(np.linspace(0, 1, 365) * np.pi), + index=pd.date_range("2001-01-01", "2001-12-31", freq="D")) +rs = pd.Series(data=10 * np.sin(np.linspace(0, 1, 365) * np.pi), + index=pd.date_range("2001-01-01", "2001-12-31", freq="D")) +wind = pd.Series(data=5 * np.sin(np.linspace(0, 1, 365) * np.pi), + index=pd.date_range("2001-01-01", "2001-12-31", freq="D")) +lat = 0.9 +elevation = 20 + + +class Testall(unittest.TestCase): + def test_calculate_all(self): + et_df = et.calculate_all(tmean, wind, rs, elevation, lat, tmax, tmin, + rh) + self.assertIsInstance(et_df, pd.DataFrame)