Skip to content

Commit

Permalink
Checked Examples/Updated Turc
Browse files Browse the repository at this point in the history
  • Loading branch information
mvremec committed Mar 14, 2024
1 parent e0521a8 commit 941befd
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 228 deletions.
220 changes: 9 additions & 211 deletions docs/examples/01_example_zamg.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/examples/02_example_zamg_netcdf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/03_example_knmi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
},
"vscode": {
"interpreter": {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/04_example_coagmet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/05_example_calibration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/06_worked_examples_McMahon_etal_2013.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@
"outputs": [],
"source": [
"rhmean = (rhmax + rhmin) / 2\n",
"pet_turc = pyet.turc(tmean, rs_sol, rhmean, k=0.32)\n",
"pet_turc = pyet.turc(tmean, rs_sol, rhmean)\n",
"print(f\"Turc : {round(float(pet_turc.values[0]),4)} vs 2.6727 mm day-1\")"
]
},
Expand Down Expand Up @@ -682,7 +682,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/07_example_climate_change.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/08_crop_coefficient.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/09_CMIP6_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"import numpy as np\n",
"import pandas as pd\n",
"import xarray as xr\n",
"import netcdf4 # Explicit import to test\n",
"import pyet"
]
},
Expand Down Expand Up @@ -108,7 +107,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/10_example_paper.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
Binary file modified docs/examples/data/example_10/df_Guo_2016.xlsx
Binary file not shown.
10 changes: 5 additions & 5 deletions pyet/radiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .utils import get_index, check_rad, clip_zeros, pet_out, check_rh


def turc(tmean, rs, rh, k=0.31, clip_zero=True):
def turc(tmean, rs, rh, k=0.013, clip_zero=True):
"""Potential evapotranspiration calculated according to
:cite:t:`turc_estimation_1961`.
Expand Down Expand Up @@ -37,18 +37,18 @@ def turc(tmean, rs, rh, k=0.31, clip_zero=True):
Notes
-----
Based on equation 2 and 3 in :cite:t:`xu_evaluation_2000`.
Based on equation S9.10 and S9.11 in :cite:t:`mcmahon_estimating_2013`.
.. math:: PET=k(\\frac{T_{mean}}{T_{mean}+15})(\\frac{R_s}{4.184}+50)4.184;
.. math:: PET=k(\\frac{T_{mean}}{T_{mean}+15})(23.88R_s+50)0.013;
for RH>50
.. math:: PET=k(1+\\frac{50-RH}{70})(\\frac{T_{mean}}{T_{mean}+15})
(\\frac{R_s}{4.184}+50)4.184; for RH<50
(23.88R_s+50)0.013; for RH<50
"""
c = tmean / tmean
c = c.where(check_rh(rh) >= 50, 1 + (50 - rh) / 70)
pet = k * c * tmean / (tmean + 15) * (check_rad(rs) + 2.094)
pet = k * c * tmean / (tmean + 15) * (check_rad(rs) * 23.88 + 50)
pet = clip_zeros(pet, clip_zero)
return pet_out(tmean, pet, "Turc")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_rpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def test_turc(self):
# There is a mistake in the R-Package
# The R-Package does not consider RH < 50
# if pyet.turc also does nonsider this, the result is the same
r_turc = [4.2, 4.0, 4.2, 4.0, 4.3, 6.1, 5.4, 5.5, 6.2, 4.1]
r_turc = [4.2, 4.0, 4.2, 4.0, 4.3, 6.1, 5.4, 5.6, 6.2, 4.1]
self.assertEqual(r_turc, pyet_turc, 1)

expected_t = tile(asarray(r_turc)[:, newaxis, newaxis], (1, 3, 3))
Expand Down

0 comments on commit 941befd

Please sign in to comment.