From 3780f379005ede212044ce874f81b8649c1a6215 Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Tue, 9 Jun 2026 12:02:20 +0100 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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 06/10] 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) From d8226d5a7b6af9d173e11d2879f43e2edf9d5308 Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Wed, 8 Jul 2026 10:54:43 +0100 Subject: [PATCH 07/10] Move whatsnew entry to 0.16.0 --- docs/sphinx/source/whatsnew/v0.15.3.rst | 4 +--- docs/sphinx/source/whatsnew/v0.16.0.rst | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.15.3.rst b/docs/sphinx/source/whatsnew/v0.15.3.rst index 9a4d8e31c8..a6a66c24da 100644 --- a/docs/sphinx/source/whatsnew/v0.15.3.rst +++ b/docs/sphinx/source/whatsnew/v0.15.3.rst @@ -10,9 +10,7 @@ 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 diff --git a/docs/sphinx/source/whatsnew/v0.16.0.rst b/docs/sphinx/source/whatsnew/v0.16.0.rst index 6d62b9e1c6..da5dedbe8c 100644 --- a/docs/sphinx/source/whatsnew/v0.16.0.rst +++ b/docs/sphinx/source/whatsnew/v0.16.0.rst @@ -15,7 +15,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 6acb39e3fdab600f0e8adbbaa4ba5b1f997d377c Mon Sep 17 00:00:00 2001 From: cbcrespo <97249533+cbcrespo@users.noreply.github.com> Date: Wed, 8 Jul 2026 16:45:33 +0100 Subject: [PATCH 08/10] Update docs/sphinx/source/whatsnew/v0.16.0.rst Co-authored-by: Kevin Anderson --- docs/sphinx/source/whatsnew/v0.16.0.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.16.0.rst b/docs/sphinx/source/whatsnew/v0.16.0.rst index da5dedbe8c..879cf25641 100644 --- a/docs/sphinx/source/whatsnew/v0.16.0.rst +++ b/docs/sphinx/source/whatsnew/v0.16.0.rst @@ -15,8 +15,8 @@ Breaking Changes Deprecations ~~~~~~~~~~~~ -* Deprecate :py:attr:`pvlib.irradiance.king`. - Use other diffuse transposition models in :py:attr:`pvlib.irradiance` instead. +* Deprecate :py:func:`pvlib.irradiance.king`. + Use other diffuse transposition models in :py:mod:`pvlib.irradiance` instead. (:issue:`2636`, :pull:`2783`) Bug fixes From 7967cb050b885c9a77b3369ca253dbad63ace236 Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Fri, 10 Jul 2026 14:52:58 +0100 Subject: [PATCH 09/10] Remove king from tests --- tests/test_irradiance.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_irradiance.py b/tests/test_irradiance.py index 8607074d59..2e3783043a 100644 --- a/tests/test_irradiance.py +++ b/tests/test_irradiance.py @@ -440,7 +440,7 @@ def test_perez_driesse_scalar(): @pytest.mark.parametrize('model', ['isotropic', 'klucher', 'haydavies', - 'reindl', 'king', 'perez', 'perez-driesse']) + 'reindl', 'perez', 'perez-driesse']) def test_sky_diffuse_zenith_close_to_90(model): # GH 432 sky_diffuse = irradiance.get_sky_diffuse( @@ -492,7 +492,7 @@ def test_campbell_norman(): def test_get_total_irradiance(irrad_data, ephem_data, dni_et, relative_airmass): models = ['isotropic', 'klucher', - 'haydavies', 'reindl', 'king', 'perez', 'perez-driesse'] + 'haydavies', 'reindl', 'perez', 'perez-driesse'] for model in models: total = irradiance.get_total_irradiance( @@ -510,7 +510,7 @@ def test_get_total_irradiance(irrad_data, ephem_data, dni_et, @pytest.mark.parametrize('model', ['isotropic', 'klucher', - 'haydavies', 'reindl', 'king', + 'haydavies', 'reindl', 'perez', 'perez-driesse']) def test_get_total_irradiance_albedo( irrad_data, ephem_data, dni_et, relative_airmass, model): @@ -530,7 +530,7 @@ def test_get_total_irradiance_albedo( @pytest.mark.parametrize('model', ['isotropic', 'klucher', - 'haydavies', 'reindl', 'king', + 'haydavies', 'reindl', 'perez', 'perez-driesse']) def test_get_total_irradiance_scalars(model): total = irradiance.get_total_irradiance( From 31e5f2c4ad506b6161ffb64937c5c6db25ee45ac Mon Sep 17 00:00:00 2001 From: cbcrespo <97249533+cbcrespo@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:09:17 +0100 Subject: [PATCH 10/10] Apply suggestions from code review Co-authored-by: Cliff Hansen --- docs/sphinx/source/whatsnew/v0.15.3.rst | 1 - pvlib/irradiance.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.15.3.rst b/docs/sphinx/source/whatsnew/v0.15.3.rst index a6a66c24da..23d89b06e5 100644 --- a/docs/sphinx/source/whatsnew/v0.15.3.rst +++ b/docs/sphinx/source/whatsnew/v0.15.3.rst @@ -12,7 +12,6 @@ Deprecations ~~~~~~~~~~~~ - Bug fixes ~~~~~~~~~ diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 67e860b249..13d254e230 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -988,7 +988,7 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra, @deprecated( - since="0.15.3", + since="0.16.0", removal="0.17.0", name="pvlib.irradiance.king", alternative="other diffuse transposition models in pvlib.irradiance",