From 3780f379005ede212044ce874f81b8649c1a6215 Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Tue, 9 Jun 2026 12:02:20 +0100 Subject: [PATCH 1/6] Add deprecation warning for pvlib.irradiance.king --- pvlib/irradiance.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 50f02426de..fa4c47de42 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 deprecated, pvlibDeprecationWarning import warnings @@ -984,7 +984,12 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra, return sky_diffuse - +@deprecated( + since="0.16.0", + removal="", + name="pvlib.irradiance.king", + alternative="other diffuse transposition models in pvlib.irradiance", +) def king(surface_tilt, dhi, ghi, solar_zenith): ''' Determine diffuse irradiance from the sky on a tilted surface using From 2ea46167638bf84d879063b0f268b826ed3df11b Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Mon, 15 Jun 2026 10:49:25 +0100 Subject: [PATCH 2/6] Correct deprecation version --- pvlib/irradiance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index fa4c47de42..8e71bc9810 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -984,8 +984,9 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra, return sky_diffuse + @deprecated( - since="0.16.0", + since="0.15.2", removal="", name="pvlib.irradiance.king", alternative="other diffuse transposition models in pvlib.irradiance", From b3b824134d979427afcfaadb78ec0b59ebe43cc0 Mon Sep 17 00:00:00 2001 From: cbcrespo <97249533+cbcrespo@users.noreply.github.com> Date: Mon, 22 Jun 2026 15:47:16 +0100 Subject: [PATCH 3/6] Add removal version Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- pvlib/irradiance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 120d25105d..724bf6293d 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -991,7 +991,7 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra, @deprecated( since="0.15.2", - removal="", + removal="0.17.0", name="pvlib.irradiance.king", alternative="other diffuse transposition models in pvlib.irradiance", ) From ef3459f38024654955c3f5d5c3d687baacd27068 Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Tue, 23 Jun 2026 10:44:54 +0100 Subject: [PATCH 4/6] Suppress deprecation warning in test --- tests/test_irradiance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_irradiance.py b/tests/test_irradiance.py index a416636ae9..57c53f1976 100644 --- a/tests/test_irradiance.py +++ b/tests/test_irradiance.py @@ -252,7 +252,8 @@ def test_reindl(irrad_data, ephem_data, dni_et): def test_king(irrad_data, ephem_data): - result = irradiance.king(40, irrad_data['dhi'], irrad_data['ghi'], + with pytest.warns(pvlibDeprecationWarning, match='king'): + result = irradiance.king(40, irrad_data['dhi'], irrad_data['ghi'], ephem_data['apparent_zenith']) assert_allclose(result, [0, 44.629352, 115.182626, 79.719855], atol=1e-4) From c0dc2f9d7c6873603947521a620e9a6cc49a7401 Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Tue, 23 Jun 2026 11:13:47 +0100 Subject: [PATCH 5/6] Add what's new entry --- docs/sphinx/source/whatsnew/v0.15.3.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.15.3.rst b/docs/sphinx/source/whatsnew/v0.15.3.rst index 87ded069ee..2a8847ef36 100644 --- a/docs/sphinx/source/whatsnew/v0.15.3.rst +++ b/docs/sphinx/source/whatsnew/v0.15.3.rst @@ -10,6 +10,9 @@ Breaking Changes Deprecations ~~~~~~~~~~~~ +* Deprecate :py:attr:`pvlib.irradiance.king`. + Use other diffuse transposition models in :py:attr:`pvlib.irradiance` instead. + (:issue:`2636`, :pull:`2783`) Bug fixes From 4044ac5a87c1aba1d694c7d4231b23e59a73dc1b Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Tue, 23 Jun 2026 11:19:38 +0100 Subject: [PATCH 6/6] Change deprecation version to v0.15.3, fix test --- pvlib/irradiance.py | 2 +- tests/test_irradiance.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 1b75f4a029..04cf6574c2 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -993,7 +993,7 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra, @deprecated( - since="0.15.2", + since="0.15.3", removal="0.17.0", name="pvlib.irradiance.king", alternative="other diffuse transposition models in pvlib.irradiance", diff --git a/tests/test_irradiance.py b/tests/test_irradiance.py index fbee301e6d..cbab3dcd93 100644 --- a/tests/test_irradiance.py +++ b/tests/test_irradiance.py @@ -254,7 +254,7 @@ def test_reindl(irrad_data, ephem_data, dni_et): def test_king(irrad_data, ephem_data): with pytest.warns(pvlibDeprecationWarning, match='king'): result = irradiance.king(40, irrad_data['dhi'], irrad_data['ghi'], - ephem_data['apparent_zenith']) + ephem_data['apparent_zenith']) assert_allclose(result, [0, 44.629352, 115.182626, 79.719855], atol=1e-4)