Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move albedo dictionary from pvlib.irradiance to pvlib.albedo #2095

Merged
merged 11 commits into from
Jun 19, 2024

Conversation

IoannisSifnaios
Copy link
Contributor

@IoannisSifnaios IoannisSifnaios commented Jun 17, 2024

  • [ ] Closes #xxxx
  • I am familiar with the contributing guidelines
  • Tests added
  • [ ] Updates entries in docs/sphinx/source/reference for API changes.
  • 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`).
  • [ ] New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

Deprecate the SURFACE_ALBEDOS dictionary from the irradiance.py. The dictionary is now moved to the albedo.py module.

@kandersolar
Copy link
Member

@IoannisSifnaios check out https://peps.python.org/pep-0562/. I wasn't sure it was available in all of our python versions, but looks like 3.7+ allows it, so we can use it in pvlib. It allows basically the same thing (a custom __getattr__), but without having to mess with sys.modules, so I think it is a better method.

@IoannisSifnaios
Copy link
Contributor Author

IoannisSifnaios commented Jun 17, 2024

@kandersolar for some reason, the function added for the deprecation warning fails some existing tests. Can you take a look at it?

@kandersolar
Copy link
Member

A semi-informed guess: modifying sys.modules is interfering with the test suite's ability to track what functions get executed in the tests. Another reason to prefer the PEP 562 approach :)

@IoannisSifnaios IoannisSifnaios marked this pull request as ready for review June 18, 2024 11:47
Copy link
Member

@kandersolar kandersolar left a comment

Choose a reason for hiding this comment

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

This approach seems good to me. Good job finding all the places the docs mention that dictionary!

pvlib/irradiance.py Outdated Show resolved Hide resolved
@AdamRJensen AdamRJensen added this to the 0.11.0 milestone Jun 18, 2024
@AdamRJensen AdamRJensen added enhancement GSoC Contributions related to Google Summer of Code. labels Jun 18, 2024
@kandersolar kandersolar changed the title Move albedo dictionary Move albedo dictionary from pvlib.irradiance to pvlib.albedo Jun 19, 2024
@kandersolar kandersolar merged commit 1eecaa3 into pvlib:main Jun 19, 2024
31 of 32 checks passed
@kandersolar
Copy link
Member

Thanks @IoannisSifnaios!

@IoannisSifnaios IoannisSifnaios deleted the deprecate_albedo_dict branch June 19, 2024 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement GSoC Contributions related to Google Summer of Code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants