From c664def6117c8b246cde767f03a4e2c5d0f1cca4 Mon Sep 17 00:00:00 2001 From: MatevzVremec Date: Mon, 14 Nov 2022 12:00:19 +0100 Subject: [PATCH 1/4] Update radiation.py --- pyet/radiation.py | 14 +++++++------- pyet/version.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) 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..000aa8c 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.1b" From b24af1fdda03c784056e7c71a01bf89d80b44cd4 Mon Sep 17 00:00:00 2001 From: MatevzVremec Date: Mon, 14 Nov 2022 12:01:23 +0100 Subject: [PATCH 2/4] Update version.py --- pyet/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyet/version.py b/pyet/version.py index 000aa8c..d54bddb 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.1b" +__version__ = "1.2.0" From b6a05f796aaf304006f142aaf638534d36123672 Mon Sep 17 00:00:00 2001 From: MatevzVremec Date: Mon, 14 Nov 2022 13:52:10 +0100 Subject: [PATCH 3/4] Added test to check "pyet.calculate_all()". Check if all methods execute without raising error and are stored in a Pandas.DataFrame(). --- tests/__init__.py | 1 + tests/test_all.py | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/test_all.py 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) From 3c01ef89a735991a62e76e54e212db7f14281f84 Mon Sep 17 00:00:00 2001 From: MatevzVremec Date: Mon, 14 Nov 2022 13:55:10 +0100 Subject: [PATCH 4/4] Update version.py --- pyet/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"