Skip to content

Commit

Permalink
Update master-branch to Pyet v1.2.1
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
raoulcollenteur authored Nov 16, 2022
2 parents d8224ed + 3c01ef8 commit b08709f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
14 changes: 7 additions & 7 deletions pyet/radiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion pyet/version.py
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

from tests import testfao56
from tests import testalternative
from tests import test_all
27 changes: 27 additions & 0 deletions tests/test_all.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b08709f

Please sign in to comment.