Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew/v0.15.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Deprecations
~~~~~~~~~~~~



Bug fixes
~~~~~~~~~

Expand Down
4 changes: 3 additions & 1 deletion docs/sphinx/source/whatsnew/v0.16.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Breaking Changes

Deprecations
~~~~~~~~~~~~

* Deprecate :py:func:`pvlib.irradiance.king`.
Use other diffuse transposition models in :py:mod:`pvlib.irradiance` instead.
(:issue:`2636`, :pull:`2783`)

Bug fixes
~~~~~~~~~
Expand Down
6 changes: 6 additions & 0 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,12 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
return sky_diffuse


@deprecated(
since="0.15.3",
removal="0.17.0",
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
Expand Down
5 changes: 3 additions & 2 deletions tests/test_irradiance.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some other tests are emitting the deprecation error as well. It would be good to suppress those too:

tests/test_irradiance.py::test_sky_diffuse_zenith_close_to_90[king]
tests/test_irradiance.py::test_get_total_irradiance
tests/test_irradiance.py::test_get_total_irradiance_albedo[king]
tests/test_irradiance.py::test_get_total_irradiance_scalars[king]
  /home/runner/work/pvlib-python/pvlib-python/pvlib/irradiance.py:457: pvlibDeprecationWarning: The pvlib.irradiance.king function was deprecated in pvlib 0.15.3 and will be removed in 0.17.0. Use other diffuse transposition models in pvlib.irradiance instead.
    sky = king(surface_tilt, dhi, ghi, solar_zenith)

https://github.com/pvlib/pvlib-python/actions/runs/28933855087/job/85839249803?pr=2783#step:9:88

Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ 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'],
ephem_data['apparent_zenith'])
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)


Expand Down
Loading