From 579e9dbe92e39226445452eb03ce492d2871129f Mon Sep 17 00:00:00 2001 From: Raoul Collenteur Date: Fri, 15 Mar 2024 13:47:40 +0100 Subject: [PATCH 01/10] Update python-publish.yml --- .github/workflows/python-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 4725cc9..fa046e3 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -26,4 +26,4 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + password: ${{ secrets.PYPY_TOKEN }} From 4be8574f352f9c8e4b14ce8f47653f384a9107b5 Mon Sep 17 00:00:00 2001 From: MatevzVremec Date: Fri, 15 Mar 2024 14:13:50 +0100 Subject: [PATCH 02/10] Update python-publish.yml --- .github/workflows/python-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index fa046e3..5e93739 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -23,7 +23,7 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel twine - name: Upload Python Package - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: user: __token__ password: ${{ secrets.PYPY_TOKEN }} From a2debe20eb72aa6cbdb96c59d13bf2a338111ca3 Mon Sep 17 00:00:00 2001 From: Raoul Collenteur Date: Fri, 15 Mar 2024 14:48:43 +0100 Subject: [PATCH 03/10] Update python-publish.yml --- .github/workflows/python-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 5e93739..e7f234b 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -22,6 +22,8 @@ jobs: run: | python -m pip install --upgrade pip pip install setuptools wheel twine + - name: Build package + run: python -m build - name: Upload Python Package uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: From f64e5c5e9c6822bd9c982f2100de78975f34b0b6 Mon Sep 17 00:00:00 2001 From: MatevzVremec Date: Fri, 15 Mar 2024 15:38:47 +0100 Subject: [PATCH 04/10] Update python-publish.yml --- .github/workflows/python-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index e7f234b..51ed8c4 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install setuptools wheel twine build - name: Build package run: python -m build - name: Upload Python Package From 1d893f47060f4aa1b966f5a9644b755c3af21802 Mon Sep 17 00:00:00 2001 From: anshuverma2000 Date: Thu, 2 May 2024 21:27:39 +0530 Subject: [PATCH 05/10] removed extra argument given --- pyet/radiation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyet/radiation.py b/pyet/radiation.py index 54cfde5..6dd7830 100644 --- a/pyet/radiation.py +++ b/pyet/radiation.py @@ -104,7 +104,7 @@ def jensen_haise(tmean, rs=None, cr=0.025, tx=-3, lat=None, method=0, clip_zero= if lat is None: raise Exception("If you choose method == 1, provide lat!") index = get_index(tmean) - ra = extraterrestrial_r(index, lat, tmean) + ra = extraterrestrial_r(index, lat) pet = ra * (tmean + 5) / 68 / lambd else: raise Exception("Method can be either 0 or 1.") From 201a2c4da3db7e1487b77364406522e047d7b85d Mon Sep 17 00:00:00 2001 From: anshuverma2000 Date: Thu, 2 May 2024 22:14:32 +0530 Subject: [PATCH 06/10] fix the nan output error --- pyet/radiation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyet/radiation.py b/pyet/radiation.py index 6dd7830..a498083 100644 --- a/pyet/radiation.py +++ b/pyet/radiation.py @@ -4,7 +4,7 @@ from numpy import sqrt, log from xarray import DataArray -from pandas import Series +from pandas import Series ,to_datetime from .meteo_utils import extraterrestrial_r, calc_press, calc_psy, calc_vpc, calc_lambda from .utils import get_index, check_rad, clip_zeros, pet_out, check_rh @@ -105,7 +105,10 @@ def jensen_haise(tmean, rs=None, cr=0.025, tx=-3, lat=None, method=0, clip_zero= raise Exception("If you choose method == 1, provide lat!") index = get_index(tmean) ra = extraterrestrial_r(index, lat) - pet = ra * (tmean + 5) / 68 / lambd + + temp = (tmean + 5) / 68 / lambd + temp.index = to_datetime(temp.index) + pet = ra * temp else: raise Exception("Method can be either 0 or 1.") pet = clip_zeros(pet, clip_zero) From 8a077774ad81d50e0e6db028413e3476765781e0 Mon Sep 17 00:00:00 2001 From: anshuverma2000 Date: Thu, 2 May 2024 22:54:04 +0530 Subject: [PATCH 07/10] fix all nan values in output error --- pyet/radiation.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyet/radiation.py b/pyet/radiation.py index a498083..ada243a 100644 --- a/pyet/radiation.py +++ b/pyet/radiation.py @@ -151,7 +151,9 @@ def mcguinness_bordne(tmean, lat, k=0.0147, clip_zero=True): ra = extraterrestrial_r(index, lat) if isinstance(tmean, DataArray) and isinstance(ra, Series): ra = ra.values[:, None, None] - pet = k * ra * (tmean + 5) / lambd + temp = (tmean + 5) / lambd + temp.index = to_datetime(temp.index) + pet = k * ra * temp pet = clip_zeros(pet, clip_zero) return pet_out(tmean, pet, "Mcguinness_Bordne") @@ -448,8 +450,10 @@ def oudin(tmean, lat, k1=100, k2=5, clip_zero=True): """ lambd = calc_lambda(tmean) index = get_index(tmean) - ra = extraterrestrial_r(index, lat) - pet = ra * (tmean + k2) / lambd / k1 + ra = extraterrestrial_r(index, lat) + temp = (tmean + k2) / lambd / k1 + temp.index = to_datetime(temp.index) + pet = ra * temp pet = pet.where((tmean + k2) >= 0, 0) pet = clip_zeros(pet, clip_zero) return pet_out(tmean, pet, "Oudin") From 3479d7ae11bcf429af80824cab2dac378818e982 Mon Sep 17 00:00:00 2001 From: anshuverma2000 Date: Thu, 2 May 2024 23:12:23 +0530 Subject: [PATCH 08/10] temperary fix in oudin methods's function --- pyet/radiation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyet/radiation.py b/pyet/radiation.py index ada243a..69a0a4d 100644 --- a/pyet/radiation.py +++ b/pyet/radiation.py @@ -454,6 +454,7 @@ def oudin(tmean, lat, k1=100, k2=5, clip_zero=True): temp = (tmean + k2) / lambd / k1 temp.index = to_datetime(temp.index) pet = ra * temp - pet = pet.where((tmean + k2) >= 0, 0) + # pet = pet.where((tmean + k2) >= 0, 0) + # the above line of code is not working properly and setting all the values in pet 0.0 pet = clip_zeros(pet, clip_zero) return pet_out(tmean, pet, "Oudin") From e03fd143431d0ca623fd4fdc0fac2c887a7e38e4 Mon Sep 17 00:00:00 2001 From: anshuverma2000 Date: Wed, 8 May 2024 06:02:49 +0530 Subject: [PATCH 09/10] rs/rso doubles the number of items in solar_rat and each of the value is nan so instead used rs.values --- pyet/rad_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyet/rad_utils.py b/pyet/rad_utils.py index b10272f..610f151 100644 --- a/pyet/rad_utils.py +++ b/pyet/rad_utils.py @@ -199,7 +199,7 @@ def calc_rad_long( rso = rso.where(rso != 0, 0.001) if len(rs.shape) == 3 and len(rso.shape) == 1: rso = rso.values[:, newaxis, newaxis] - solar_rat = clip(rs / rso, 0.3, 1) + solar_rat = clip(rs.values / rso.values, 0.3, 1) if tmax is not None: tmp1 = STEFAN_BOLTZMANN_DAY * ((tmax + 273.16) ** 4 + (tmin + 273.16) ** 4) / 2 else: From 2b36d48fbd4cab72bacd3516b9ff63df7a0ebba6 Mon Sep 17 00:00:00 2001 From: Anshu Date: Wed, 8 May 2024 06:36:11 +0530 Subject: [PATCH 10/10] n/nn doubles the number of items in the series and each of the value is nan so instead used n.values --- pyet/rad_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyet/rad_utils.py b/pyet/rad_utils.py index 610f151..ef2c496 100644 --- a/pyet/rad_utils.py +++ b/pyet/rad_utils.py @@ -279,7 +279,7 @@ def calc_rad_sol_in(n, lat, as1=0.25, bs1=0.5, nn=None): ra = extraterrestrial_r(tindex, lat) if nn is None: nn = daylight_hours(tindex, lat) - return (as1 + bs1 * n / nn) * ra + return (as1 + bs1 * n.values / nn) * ra def calc_rso(ra, elevation, kab=None):