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
4 changes: 4 additions & 0 deletions docs/sphinx/source/whatsnew/v0.16.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Documentation
* Clarify that :py:func:`pvlib.ivtools.sdm.fit_pvsyst_sandia` and
:py:func:`pvlib.ivtools.sdm.fit_desoto_sandia` require multiple IV curves.
(:issue:`1715`, :pull:`2883`)
* Note deprecation of ``king`` model in :py:func:`~pvlib.irradiance.get_total_irradiance`
and :py:func:`~pvlib.irradiance.get_sky_diffuse` docstrings.
(:issue:`2897`)

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.

Suggested change
(:issue:`2897`)
(:issue:`2897`, :pull:`2904`)



Testing
Expand Down Expand Up @@ -62,6 +65,7 @@ Contributors
* Chen Yi (:ghuser:`chenyi6758-source`)
* Rajiv Daxini (:ghuser:`rdaxini`)
* jason-writer (:ghuser:`jason-writer`)
* Jakub Krasuski (:ghuser:`Blizzeq`)



8 changes: 4 additions & 4 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def get_total_irradiance(surface_tilt, surface_azimuth,
* klucher
* haydavies
* reindl
* king
* king (deprecated)
* perez
* perez-driesse

Expand Down Expand Up @@ -328,7 +328,7 @@ def get_total_irradiance(surface_tilt, surface_azimuth,
the list of accepted values.
model : str, default 'isotropic'
Irradiance model. Can be one of ``'isotropic'``, ``'klucher'``,
``'haydavies'``, ``'reindl'``, ``'king'``, ``'perez'``,
``'haydavies'``, ``'reindl'``, ``'king'`` (deprecated), ``'perez'``,
``'perez-driesse'``.
model_perez : str, default 'allsitescomposite1990'
Used only if ``model='perez'``. See :py:func:`~pvlib.irradiance.perez`.
Expand Down Expand Up @@ -387,7 +387,7 @@ def get_sky_diffuse(surface_tilt, surface_azimuth,
* klucher
* haydavies
* reindl
* king
* king (deprecated)
* perez
* perez-driesse

Expand Down Expand Up @@ -415,7 +415,7 @@ def get_sky_diffuse(surface_tilt, surface_azimuth,
See :term:`airmass_relative`. [unitless]
model : str, default 'isotropic'
Irradiance model. Can be one of ``'isotropic'``, ``'klucher'``,
``'haydavies'``, ``'reindl'``, ``'king'``, ``'perez'``,
``'haydavies'``, ``'reindl'``, ``'king'`` (deprecated), ``'perez'``,
``'perez-driesse'``.
model_perez : str, default 'allsitescomposite1990'
Used only if ``model='perez'``. See :py:func:`~pvlib.irradiance.perez`.
Expand Down
22 changes: 22 additions & 0 deletions tests/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,28 @@ def test_king(irrad_data, ephem_data):
assert_allclose(result, [0, 44.629352, 115.182626, 79.719855], atol=1e-4)


def test_get_sky_diffuse_king_deprecated(irrad_data, ephem_data):
with warnings.catch_warnings():
warnings.simplefilter('always')
with pytest.warns(pvlibDeprecationWarning, match='king'):
irradiance.get_sky_diffuse(
40, 180, ephem_data['apparent_zenith'],
ephem_data['azimuth'], irrad_data['dni'],
irrad_data['ghi'], irrad_data['dhi'], model='king',
)


def test_get_total_irradiance_king_deprecated(irrad_data, ephem_data):
with warnings.catch_warnings():
warnings.simplefilter('always')
with pytest.warns(pvlibDeprecationWarning, match='king'):
irradiance.get_total_irradiance(
40, 180, ephem_data['apparent_zenith'],
ephem_data['azimuth'], irrad_data['dni'],
irrad_data['ghi'], irrad_data['dhi'], model='king',
)


Comment on lines +323 to +344

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.

The issue #2897 never discussed tests. The issue discussed a docs change only. These tests check behavior that already exists and are not related to the issue so I don't think they should be included in this PR.

def test_perez(irrad_data, ephem_data, dni_et, relative_airmass):
dni = irrad_data['dni'].copy()
dni.iloc[2] = np.nan
Expand Down
Loading