Skip to content

Note deprecation of king in get_total_irradiance and get_sky_diffuse docstrings - #2904

Open
Blizzeq wants to merge 3 commits into
pvlib:mainfrom
Blizzeq:docs/deprecate-king-model-list
Open

Blizzeq wants to merge 3 commits into
pvlib:mainfrom
Blizzeq:docs/deprecate-king-model-list

Conversation

@Blizzeq

@Blizzeq Blizzeq commented Oct 17, 2026 •

Copy link
Copy Markdown
  • Closes deprecate king from get_total_irradiance and get_sky_diffuse? #2897
  • I am familiar with the contributing guidelines
  • I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
  • Tests added
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • Pull request is nearly complete and ready for detailed review.

Note that the king diffuse irradiance model is deprecated in the docstrings of get_total_irradiance and get_sky_diffuse.

@RDaxini RDaxini left a comment

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.

Thanks for your contribution.
Can you confirm you read the issue? The issue never discussed adding tests to check the existing deprecation behavior and I see no note from yourself in the whatsnew file about these tests. Were these automatically generated by an AI agent? It is pvlib policy to vet all AI-generated content, which I understand you have confirmed you did in the checklist, but in this case I am unsure then how or why these tests appeared.

Comment thread docs/sphinx/source/whatsnew/v0.16.2.rst Outdated
(: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`)

Comment thread tests/test_irradiance.py Outdated
Comment on lines +323 to +344
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',
)


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.

@Blizzeq

Blizzeq commented Oct 22, 2026

Copy link
Copy Markdown
Author

Thanks for the review. You're right, #2897 only asked for the docstring change. The tests were added by the AI assistant I used. When I vetted them I checked that they pass, but not whether they belonged in this PR, and they don't. I've removed them, applied your whatsnew suggestion and merged main to fix the conflict.

@RDaxini RDaxini left a comment

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.

I advise reading the issue before throwing an AI agent at it in future as it would save everyone's time and resources (including yours, and the AI agents'). Given the simplicity of this PR, it's passable, but more complex PRs with the same problem are likely to be closed before review—just FYI.

Thanks for addressing this. LGTM now but we'll wait for another maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deprecate king from get_total_irradiance and get_sky_diffuse?

2 participants