From bc5a7ad03bd390d3fd4cd14490b28e6e4dd77f35 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:34:47 +0100 Subject: [PATCH 01/18] irradiance.py: dirint_bins(), dirindex() --- pvlib/irradiance.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index db62439772..b55c33f876 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -2140,7 +2140,7 @@ def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime): return kt_prime_bin, zenith_bin, w_bin, delta_kt_prime_bin -def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325., +def dirindex(ghi, ghi_clearsky, dni_clear, zenith, times, pressure=101325., use_delta_kt_prime=True, temp_dew=None, min_cos_zenith=0.065, max_zenith=87): """ @@ -2162,7 +2162,7 @@ def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325., ghi_clearsky : array-like Global horizontal irradiance from clear sky model. [Wm⁻²] - dni_clearsky : array-like + dni_clear : array-like Direct normal irradiance from clear sky model. [Wm⁻²] zenith : array-like @@ -2228,7 +2228,7 @@ def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325., min_cos_zenith=min_cos_zenith, max_zenith=max_zenith) - dni_dirindex = dni_clearsky * dni_dirint / dni_dirint_clearsky + dni_dirindex = dni_clear * dni_dirint / dni_dirint_clearsky dni_dirindex[dni_dirindex < 0] = 0. From d431aa8c3a7a241e77e22696ccede21b8496e4eb Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:37:01 +0100 Subject: [PATCH 02/18] irradiance.py: dni(), _get_dirint_coeffs(), complete_irradiance() --- pvlib/irradiance.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index b55c33f876..1fcfdf72f7 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -3600,7 +3600,7 @@ def _get_dirint_coeffs(): return coeffs[1:, 1:, :, :] -def dni(ghi, dhi, zenith, clearsky_dni=None, clearsky_tolerance=1.1, +def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, zenith_threshold_for_zero_dni=88.0, zenith_threshold_for_clearsky_limit=80.0): """ @@ -3624,11 +3624,11 @@ def dni(ghi, dhi, zenith, clearsky_dni=None, clearsky_tolerance=1.1, True (not refraction-corrected) zenith angles in decimal degrees. Angles must be >=0 and <=180. - clearsky_dni : Series, optional + dni_clear : Series, optional Clearsky direct normal irradiance. clearsky_tolerance : float, default 1.1 - If 'clearsky_dni' is given this parameter can be used to allow a + If `dni_clear` is given this parameter can be used to allow a tolerance by how much the calculated DNI value can be greater than the clearsky value before it is identified as an unreasonable value. @@ -3641,7 +3641,7 @@ def dni(ghi, dhi, zenith, clearsky_dni=None, clearsky_tolerance=1.1, 'zenith_threshold_for_clearsky_limit' and smaller the 'zenith_threshold_for_zero_dni' that are greater than the clearsky DNI (times allowed tolerance) will be corrected. Only applies if - 'clearsky_dni' is not None. + `dni_clear` is not None. Returns ------- @@ -3663,8 +3663,8 @@ def dni(ghi, dhi, zenith, clearsky_dni=None, clearsky_tolerance=1.1, # zenith_threshold_for_clearsky_limit and smaller than the # upper_cutoff_zenith that are greater than the clearsky DNI (times # clearsky_tolerance) - if clearsky_dni is not None: - max_dni = clearsky_dni * clearsky_tolerance + if dni_clear is not None: + max_dni = dni_clear * clearsky_tolerance dni[(zenith >= zenith_threshold_for_clearsky_limit) & (zenith < zenith_threshold_for_zero_dni) & (dni > max_dni)] = max_dni @@ -3716,7 +3716,7 @@ def complete_irradiance(solar_zenith, """ if ghi is not None and dhi is not None and dni is None: dni = pvlib.irradiance.dni(ghi, dhi, solar_zenith, - clearsky_dni=dni_clear, + dni_clear=dni_clear, clearsky_tolerance=1.1) elif dni is not None and dhi is not None and ghi is None: ghi = (dhi + dni * tools.cosd(solar_zenith)) From 2701cbbd413a9f4abb6288592532fd274c2a918b Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:58:08 +0100 Subject: [PATCH 03/18] modify tests --- pvlib/tests/test_irradiance.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 64f7d27b5e..600291dd27 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -1063,7 +1063,7 @@ def test_dirindex(times): np.array([0., 79.73860422, 1042.48031487, 257.20751138]), index=times ) - dni_clearsky = pd.Series( + dni_clear = pd.Series( np.array([0., 316.1949056, 939.95469881, 646.22886049]), index=times ) @@ -1073,7 +1073,7 @@ def test_dirindex(times): ) pressure = 93193. tdew = 10. - out = irradiance.dirindex(ghi, ghi_clearsky, dni_clearsky, + out = irradiance.dirindex(ghi, ghi_clearsky, dni_clear, zenith, times, pressure=pressure, temp_dew=tdew) dirint_close_values = irradiance.dirint(ghi, zenith, times, @@ -1101,25 +1101,25 @@ def test_dirindex_min_cos_zenith_max_zenith(): times = pd.DatetimeIndex(['2014-06-24T12-0700', '2014-06-24T18-0700']) ghi = pd.Series([0, 1], index=times) ghi_clearsky = pd.Series([0, 1], index=times) - dni_clearsky = pd.Series([0, 5], index=times) + dni_clear = pd.Series([0, 5], index=times) solar_zenith = pd.Series([90, 89.99], index=times) - out = irradiance.dirindex(ghi, ghi_clearsky, dni_clearsky, solar_zenith, + out = irradiance.dirindex(ghi, ghi_clearsky, dni_clear, solar_zenith, times) expected = pd.Series([nan, nan], index=times) assert_series_equal(out, expected) - out = irradiance.dirindex(ghi, ghi_clearsky, dni_clearsky, solar_zenith, + out = irradiance.dirindex(ghi, ghi_clearsky, dni_clear, solar_zenith, times, min_cos_zenith=0) expected = pd.Series([nan, nan], index=times) assert_series_equal(out, expected) - out = irradiance.dirindex(ghi, ghi_clearsky, dni_clearsky, solar_zenith, + out = irradiance.dirindex(ghi, ghi_clearsky, dni_clear, solar_zenith, times, max_zenith=90) expected = pd.Series([nan, nan], index=times) assert_series_equal(out, expected) - out = irradiance.dirindex(ghi, ghi_clearsky, dni_clearsky, solar_zenith, + out = irradiance.dirindex(ghi, ghi_clearsky, dni_clear, solar_zenith, times, min_cos_zenith=0, max_zenith=100) expected = pd.Series([nan, 5.], index=times) assert_series_equal(out, expected) @@ -1129,10 +1129,10 @@ def test_dni(): ghi = pd.Series([90, 100, 100, 100, 100]) dhi = pd.Series([100, 90, 50, 50, 50]) zenith = pd.Series([80, 100, 85, 70, 85]) - clearsky_dni = pd.Series([50, 50, 200, 50, 300]) + dni_clear = pd.Series([50, 50, 200, 50, 300]) dni = irradiance.dni(ghi, dhi, zenith, - clearsky_dni=clearsky_dni, clearsky_tolerance=2) + dni_clear=dni_clear, clearsky_tolerance=2) assert_series_equal(dni, pd.Series([float('nan'), float('nan'), 400, 146.190220008, 573.685662283])) From 4906f4f77b10dbf84cbcac7988963fef1b1f7ecd Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 26 Nov 2024 10:47:51 -0700 Subject: [PATCH 04/18] apply decorator: dirindex, dni, complete irradiance --- pvlib/irradiance.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 1fcfdf72f7..4728583d92 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -16,7 +16,7 @@ from pvlib import atmosphere, solarposition, tools import pvlib # used to avoid dni name collision in complete_irradiance -from pvlib._deprecation import pvlibDeprecationWarning +from pvlib._deprecation import pvlibDeprecationWarning, renamed_kwarg_warning import warnings @@ -2140,6 +2140,11 @@ def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime): return kt_prime_bin, zenith_bin, w_bin, delta_kt_prime_bin +@renamed_kwarg_warning( + since='11.2', + old_param_name='dni_clearsky', + new_param_name='dni_clear', + removal="12.0") def dirindex(ghi, ghi_clearsky, dni_clear, zenith, times, pressure=101325., use_delta_kt_prime=True, temp_dew=None, min_cos_zenith=0.065, max_zenith=87): @@ -3600,6 +3605,11 @@ def _get_dirint_coeffs(): return coeffs[1:, 1:, :, :] +@renamed_kwarg_warning( + since='11.2', + old_param_name='clearsky_dni', + new_param_name='dni_clear', + removal="12.0") def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, zenith_threshold_for_zero_dni=88.0, zenith_threshold_for_clearsky_limit=80.0): @@ -3671,6 +3681,11 @@ def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, return dni +@renamed_kwarg_warning( + since='11.2', + old_param_name='clearsky_dni', + new_param_name='dni_clear', + removal="12.0") def complete_irradiance(solar_zenith, ghi=None, dhi=None, From 34b430a717a8f4ae02226a973a84ffa99ec42d42 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 26 Nov 2024 10:55:21 -0700 Subject: [PATCH 05/18] dni() deprecation test --- pvlib/tests/test_irradiance.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 600291dd27..30153b5817 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -1143,6 +1143,25 @@ def test_dni(): 146.190220008, 573.685662283])) +def test_dni_dni_clearsky_deprecation(): + ghi = pd.Series([90, 100, 100, 100, 100]) + dhi = pd.Series([100, 90, 50, 50, 50]) + zenith = pd.Series([80, 100, 85, 70, 85]) + dni_clear = pd.Series([50, 50, 200, 50, 300]) + + with pytest.warns(pvlibDeprecationWarning, match='dni_clear'): + dni = irradiance.dni(ghi, dhi, zenith, + clearsky_dni=dni_clear, clearsky_tolerance=2) + assert_series_equal(dni, + pd.Series([float('nan'), float('nan'), 400, + 146.190220008, 573.685662283])) + + dni = irradiance.dni(ghi, dhi, zenith) + assert_series_equal(dni, + pd.Series([float('nan'), float('nan'), 573.685662283, + 146.190220008, 573.685662283])) + + @pytest.mark.parametrize( 'surface_tilt,surface_azimuth,solar_zenith,' + 'solar_azimuth,aoi_expected,aoi_proj_expected', From e5d64a91044fff229ace41c1bfd486ae59cdbffa Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 26 Nov 2024 15:48:11 -0700 Subject: [PATCH 06/18] Update test_irradiance.py --- pvlib/tests/test_irradiance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 30153b5817..05edce5268 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -18,7 +18,7 @@ requires_numba ) -from pvlib._deprecation import pvlibDeprecationWarning +from pvlib._deprecation import pvlibDeprecationWarning, fail_on_pvlib_version # fixtures create realistic test input data # test input data generated at Location(32.2, -111, 'US/Arizona', 700) @@ -1143,6 +1143,7 @@ def test_dni(): 146.190220008, 573.685662283])) +@fail_on_pvlib_version("0.12") def test_dni_dni_clearsky_deprecation(): ghi = pd.Series([90, 100, 100, 100, 100]) dhi = pd.Series([100, 90, 50, 50, 50]) From a7e951120025ab76ae793e4ec750f824cb7605e1 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 26 Nov 2024 15:59:28 -0700 Subject: [PATCH 07/18] Update test_irradiance.py --- pvlib/tests/test_irradiance.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 05edce5268..f06dabba4a 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -15,10 +15,11 @@ assert_frame_equal, assert_series_equal, requires_ephem, - requires_numba + requires_numba, + fail_on_pvlib_version ) -from pvlib._deprecation import pvlibDeprecationWarning, fail_on_pvlib_version +from pvlib._deprecation import pvlibDeprecationWarning # fixtures create realistic test input data # test input data generated at Location(32.2, -111, 'US/Arizona', 700) From c4a5917c7b9086338dac4b09767378be4b3624d8 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Wed, 27 Nov 2024 14:27:58 -0700 Subject: [PATCH 08/18] correct version number --- pvlib/irradiance.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 76e1484dc4..198780d61b 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -2152,10 +2152,10 @@ def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime): @renamed_kwarg_warning( - since='11.2', + since='0.11.2', old_param_name='dni_clearsky', new_param_name='dni_clear', - removal="12.0") + removal="0.12.0") def dirindex(ghi, ghi_clearsky, dni_clear, zenith, times, pressure=101325., use_delta_kt_prime=True, temp_dew=None, min_cos_zenith=0.065, max_zenith=87): @@ -3617,10 +3617,10 @@ def _get_dirint_coeffs(): @renamed_kwarg_warning( - since='11.2', + since='0.11.2', old_param_name='clearsky_dni', new_param_name='dni_clear', - removal="12.0") + removal="0.12.0") def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, zenith_threshold_for_zero_dni=88.0, zenith_threshold_for_clearsky_limit=80.0): @@ -3693,10 +3693,10 @@ def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, @renamed_kwarg_warning( - since='11.2', + since='0.11.2', old_param_name='clearsky_dni', new_param_name='dni_clear', - removal="12.0") + removal="0.12.0") def complete_irradiance(solar_zenith, ghi=None, dhi=None, From 416a5d0170b5df2fa330b8b0504d51c85f7596cd Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:49:43 -0700 Subject: [PATCH 09/18] Update pvlib/tests/test_irradiance.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- pvlib/tests/test_irradiance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index f06dabba4a..4eb71bf0bf 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -16,7 +16,7 @@ assert_series_equal, requires_ephem, requires_numba, - fail_on_pvlib_version + fail_on_pvlib_version, ) from pvlib._deprecation import pvlibDeprecationWarning From c24f6d597479b07e609cb3e29308eed156e9a2f8 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 3 Dec 2024 13:19:32 -0700 Subject: [PATCH 10/18] remove warning from `complete_irradiance` Co-Authored-By: Kevin Anderson <57452607+kandersolar@users.noreply.github.com> --- pvlib/irradiance.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 198780d61b..62ef296c5d 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -3692,11 +3692,6 @@ def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, return dni -@renamed_kwarg_warning( - since='0.11.2', - old_param_name='clearsky_dni', - new_param_name='dni_clear', - removal="0.12.0") def complete_irradiance(solar_zenith, ghi=None, dhi=None, From e1dd203a7292a0cd64e06b6075a47b7efe3ba3de Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 3 Dec 2024 13:36:02 -0700 Subject: [PATCH 11/18] test: remove return value checks --- pvlib/tests/test_irradiance.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 4eb71bf0bf..586aeb9d0b 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -1150,18 +1150,9 @@ def test_dni_dni_clearsky_deprecation(): dhi = pd.Series([100, 90, 50, 50, 50]) zenith = pd.Series([80, 100, 85, 70, 85]) dni_clear = pd.Series([50, 50, 200, 50, 300]) - with pytest.warns(pvlibDeprecationWarning, match='dni_clear'): - dni = irradiance.dni(ghi, dhi, zenith, - clearsky_dni=dni_clear, clearsky_tolerance=2) - assert_series_equal(dni, - pd.Series([float('nan'), float('nan'), 400, - 146.190220008, 573.685662283])) - - dni = irradiance.dni(ghi, dhi, zenith) - assert_series_equal(dni, - pd.Series([float('nan'), float('nan'), 573.685662283, - 146.190220008, 573.685662283])) + irradiance.dni(ghi, dhi, zenith, + clearsky_dni=dni_clear, clearsky_tolerance=2) @pytest.mark.parametrize( From 5301eb937e0ff09c001014c81793748427436178 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 3 Dec 2024 13:47:29 -0700 Subject: [PATCH 12/18] add dirindex test --- pvlib/tests/test_irradiance.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 586aeb9d0b..5f10db7912 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -1126,6 +1126,17 @@ def test_dirindex_min_cos_zenith_max_zenith(): assert_series_equal(out, expected) +@fail_on_pvlib_version("0.12") +def test_dirindex_dni_clearsky_deprecation(): + ghi = pd.Series([0, 1], index=times) + ghi_clearsky = pd.Series([0, 1], index=times) + dni_clear = pd.Series([0, 5], index=times) + solar_zenith = pd.Series([90, 89.99], index=times) + with pytest.warns(pvlibDeprecationWarning, match='dni_clear'): + irradiance.dirindex(ghi, ghi_clearsky, dni_clear, solar_zenith, + times, min_cos_zenith=0) + + def test_dni(): ghi = pd.Series([90, 100, 100, 100, 100]) dhi = pd.Series([100, 90, 50, 50, 50]) From 953d980fb9f33b87f69a7585e7ac59ebfadf2f10 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 3 Dec 2024 14:12:02 -0700 Subject: [PATCH 13/18] fix test --- pvlib/tests/test_irradiance.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 5f10db7912..0832f376c9 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -1128,13 +1128,15 @@ def test_dirindex_min_cos_zenith_max_zenith(): @fail_on_pvlib_version("0.12") def test_dirindex_dni_clearsky_deprecation(): + times = pd.DatetimeIndex(['2014-06-24T12-0700', '2014-06-24T18-0700']) ghi = pd.Series([0, 1], index=times) ghi_clearsky = pd.Series([0, 1], index=times) dni_clear = pd.Series([0, 5], index=times) solar_zenith = pd.Series([90, 89.99], index=times) with pytest.warns(pvlibDeprecationWarning, match='dni_clear'): - irradiance.dirindex(ghi, ghi_clearsky, dni_clear, solar_zenith, - times, min_cos_zenith=0) + irradiance.dirindex(ghi, ghi_clearsky, dni_clearsky=dni_clear, + zenith = solar_zenith, times = times, + min_cos_zenith=0) def test_dni(): From 8273a2915d895a46c6ab77ac779adfa2fbe42115 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 3 Dec 2024 14:14:23 -0700 Subject: [PATCH 14/18] linting --- pvlib/tests/test_irradiance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index 0832f376c9..ce702dc14f 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -1135,7 +1135,7 @@ def test_dirindex_dni_clearsky_deprecation(): solar_zenith = pd.Series([90, 89.99], index=times) with pytest.warns(pvlibDeprecationWarning, match='dni_clear'): irradiance.dirindex(ghi, ghi_clearsky, dni_clearsky=dni_clear, - zenith = solar_zenith, times = times, + zenith=solar_zenith, times=times, min_cos_zenith=0) From ad556e1a496faff6f3e70c19246b8ae25119bd29 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Tue, 3 Dec 2024 14:18:54 -0700 Subject: [PATCH 15/18] Update v0.11.2.rst --- docs/sphinx/source/whatsnew/v0.11.2.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.11.2.rst b/docs/sphinx/source/whatsnew/v0.11.2.rst index 431358459b..c83a69b1b4 100644 --- a/docs/sphinx/source/whatsnew/v0.11.2.rst +++ b/docs/sphinx/source/whatsnew/v0.11.2.rst @@ -6,6 +6,8 @@ v0.11.2 (Anticipated December, 2024) Deprecations ~~~~~~~~~~~~ +* Deprecated terms `dni_clearsky` and `clearsky_dni`, replaced with `dni_clear` + (:issue:`2272`, :pull:`2274`) Enhancements From a1dbbb32602d56ad88248bf63b0c484141ed88c1 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Wed, 4 Dec 2024 15:30:25 -0700 Subject: [PATCH 16/18] 0.12->0.13 irradiance.py, test_irradiance.py --- pvlib/irradiance.py | 4 ++-- pvlib/tests/test_irradiance.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 62ef296c5d..b5e0fa9125 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -2155,7 +2155,7 @@ def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime): since='0.11.2', old_param_name='dni_clearsky', new_param_name='dni_clear', - removal="0.12.0") + removal="0.13.0") def dirindex(ghi, ghi_clearsky, dni_clear, zenith, times, pressure=101325., use_delta_kt_prime=True, temp_dew=None, min_cos_zenith=0.065, max_zenith=87): @@ -3620,7 +3620,7 @@ def _get_dirint_coeffs(): since='0.11.2', old_param_name='clearsky_dni', new_param_name='dni_clear', - removal="0.12.0") + removal="0.13.0") def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, zenith_threshold_for_zero_dni=88.0, zenith_threshold_for_clearsky_limit=80.0): diff --git a/pvlib/tests/test_irradiance.py b/pvlib/tests/test_irradiance.py index ce702dc14f..c39191ba18 100644 --- a/pvlib/tests/test_irradiance.py +++ b/pvlib/tests/test_irradiance.py @@ -1126,7 +1126,7 @@ def test_dirindex_min_cos_zenith_max_zenith(): assert_series_equal(out, expected) -@fail_on_pvlib_version("0.12") +@fail_on_pvlib_version("0.13") def test_dirindex_dni_clearsky_deprecation(): times = pd.DatetimeIndex(['2014-06-24T12-0700', '2014-06-24T18-0700']) ghi = pd.Series([0, 1], index=times) @@ -1157,7 +1157,7 @@ def test_dni(): 146.190220008, 573.685662283])) -@fail_on_pvlib_version("0.12") +@fail_on_pvlib_version("0.13") def test_dni_dni_clearsky_deprecation(): ghi = pd.Series([90, 100, 100, 100, 100]) dhi = pd.Series([100, 90, 50, 50, 50]) From a115f185c17bbb6f6d5b4458de603ed779341f49 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:17:53 -0700 Subject: [PATCH 17/18] Apply suggestions from code review Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com> --- docs/sphinx/source/whatsnew/v0.11.2.rst | 3 ++- pvlib/irradiance.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.2.rst b/docs/sphinx/source/whatsnew/v0.11.2.rst index c83a69b1b4..d5277ac183 100644 --- a/docs/sphinx/source/whatsnew/v0.11.2.rst +++ b/docs/sphinx/source/whatsnew/v0.11.2.rst @@ -6,7 +6,8 @@ v0.11.2 (Anticipated December, 2024) Deprecations ~~~~~~~~~~~~ -* Deprecated terms `dni_clearsky` and `clearsky_dni`, replaced with `dni_clear` +* Deprecated terms ``dni_clearsky`` and ``clearsky_dni``, replaced with ``dni_clear``. + Affected functions are :py:func:`~pvlib.irradiance.dirindex` and :py:func:`~pvlib.irradiance.dni`. (:issue:`2272`, :pull:`2274`) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index b5e0fa9125..262bdb2e26 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -3649,7 +3649,7 @@ def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, Clearsky direct normal irradiance. clearsky_tolerance : float, default 1.1 - If `dni_clear` is given this parameter can be used to allow a + If ``dni_clear`` is given this parameter can be used to allow a tolerance by how much the calculated DNI value can be greater than the clearsky value before it is identified as an unreasonable value. @@ -3662,7 +3662,7 @@ def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, 'zenith_threshold_for_clearsky_limit' and smaller the 'zenith_threshold_for_zero_dni' that are greater than the clearsky DNI (times allowed tolerance) will be corrected. Only applies if - `dni_clear` is not None. + ``dni_clear`` is not None. Returns ------- From 186dbe9842ea4616d184b444961d457854fed054 Mon Sep 17 00:00:00 2001 From: RDaxini Date: Fri, 6 Dec 2024 08:59:25 -0700 Subject: [PATCH 18/18] irradiance.py: +units, +version_changed directive --- pvlib/irradiance.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 262bdb2e26..1c735eb454 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -2181,6 +2181,9 @@ def dirindex(ghi, ghi_clearsky, dni_clear, zenith, times, pressure=101325., dni_clear : array-like Direct normal irradiance from clear sky model. [Wm⁻²] + .. versionchanged:: 0.11.2 + Renamed from ``dni_clearsky`` to ``dni_clear``. + zenith : array-like True (not refraction-corrected) zenith angles in decimal degrees. If Z is a vector it must be of the same size as all @@ -3646,7 +3649,10 @@ def dni(ghi, dhi, zenith, dni_clear=None, clearsky_tolerance=1.1, degrees. Angles must be >=0 and <=180. dni_clear : Series, optional - Clearsky direct normal irradiance. + Clearsky direct normal irradiance. [Wm⁻²] + + .. versionchanged:: 0.11.2 + Renamed from ``clearsky_dni`` to ``dni_clear``. clearsky_tolerance : float, default 1.1 If ``dni_clear`` is given this parameter can be used to allow a @@ -3726,8 +3732,8 @@ def complete_irradiance(solar_zenith, Pandas series of dni data, with datetime index. Must have the same datetime index as ghi, dhi, and zenith series, when available. dni_clear : Series, optional - Pandas series of clearsky dni data. Must have the same datetime index - as ghi, dhi, dni, and zenith series, when available. See + Pandas series of clearsky dni data [Wm⁻²]. Must have the same datetime + index as ghi, dhi, dni, and zenith series, when available. See :py:func:`dni` for details. Returns