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

Address pandas FutureWarnings in test suite #1900

Merged
merged 9 commits into from
Nov 9, 2023
Merged

Address pandas FutureWarnings in test suite #1900

merged 9 commits into from
Nov 9, 2023

Conversation

matsuobasho
Copy link
Contributor

@matsuobasho matsuobasho commented Nov 2, 2023

  • Closes Various pandas deprecation warnings from test suite #1892
  • I am familiar with the contributing guidelines
  • Tests added - NA since issue is about getting rid of warnings in tests
  • Updates entries in docs/sphinx/source/reference for API changes. - NA see above
  • 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`). - NA
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary. NA
  • Pull request is nearly complete and ready for detailed review.

Updated tests to get rid of warnings.

@kandersolar kandersolar added this to the v0.10.3 milestone Nov 6, 2023
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.

Thanks @matsuobasho! This is looking pretty good. There is a linting failure that needs to be addressed, and one pandas compatibility issue mentioned below.

Can you also list yourself as a contributor in the 0.10.3 what's new file? https://github.com/pvlib/pvlib-python/blob/main/docs/sphinx/source/whatsnew/v0.10.3.rst

@kandersolar
Copy link
Member

Looking at the 3.11-bare CI logs, this PR gets rid of almost all of the pandas warnings, but there are still a few left. @matsuobasho do you want to address those as well in this PR to fully close #1892, or should we merge this as-is and fix the rest in another PR?

@matsuobasho
Copy link
Contributor Author

matsuobasho commented Nov 6, 2023

@kandersolar , most (if not all) of the other warnings occur in the underlying functions being called by the test functions.
i.e. inverter.py, scaling.py, snow.py, soiling.py, solarposition.py, bifacial/utils.py, singlediode.py, ivtools/sdm.py.

Is fixing these in-scope for this issue? Technically these aren't the test functions themselves.

For example, we encounter an invalid value encountered in divide warning in tests/test_inverter.py::test_sandia_multi_array

Here is the function:
image

Here are the values of vdcs and idcs:
image

The warning occurs on L196 of sandia_multi, where we are dividing by 0:
image

In this case, I can modify the test to exclude zeroes, but to get rid of the warning with these test parameters would entail changing the sandia_multi method. Please advise on how to proceed with this one specifically, as well as for the warnings that appear in the other modules listed above. Thanks

@kandersolar
Copy link
Member

Yes, good point. I just saw pandas FutureWarnings in the logs but didn't check what files they were coming from :) Let's leave the other warnings for another PR.

Thanks for this contribution @matsuobasho!

@kandersolar kandersolar changed the title Update tests to get rid of warnings Address pandas FutureWarnings in test suite Nov 9, 2023
@kandersolar kandersolar merged commit 4e55d50 into pvlib:main Nov 9, 2023
29 checks passed
kandersolar added a commit that referenced this pull request Nov 29, 2023
* Remove various repeated words in documentation (#1872)

* Remove repeated words

* Update pvlib/ivtools/sdm.py

Co-authored-by: Kevin Anderson <[email protected]>

---------

Co-authored-by: Kevin Anderson <[email protected]>

* fix invalid escape sequence '\c' (#1879)

* fix invalid escape sequence '\c'

pvlib/iam.py:843: DeprecationWarning: invalid escape sequence '\c'

Occurence is actually in line 854: `IAM = 1 - (1 - \cos(aoi))^5`

* Add to list of contributors

* Replace use of deprecated `pkg_resources` (#1881) (#1882)

* Update infinite_sheds.py to add shaded fraction to returned variables in infinite_sheds.get_irradiance and infinite_sheds.get_irradiance_poa (#1871)

* Update infinite_sheds.py

Added shaded fraction to returned variables.

* Update v0.10.3.rst

* Update test_infinite_sheds.py

added tests for shaded fraction

* Update test_infinite_sheds.py

Corrected the shaded fraction tests in the haydavies portion.

* Update pvlib/bifacial/infinite_sheds.py

Co-authored-by: Kevin Anderson <[email protected]>

* Update infinite_sheds.py

* Update infinite_sheds.py

* Update infinite_sheds.py

fixed indentation issues

---------

Co-authored-by: Kevin Anderson <[email protected]>

* Continuous version of the Perez transposition model implementation (#1876)

* Definitely not ready for review!

* Big step forward.

* Add entry in docs.

* A working model but just one test sofar.

* Add new model as option in get_sky_diffuse.  Docstring edits pending.

* Completed doc strings.  Also a bit of fine-tuning code.

* Updated whatsnew.

* Bugfix, formatting fix, and add all tests.

* Test warning plus some other small changes.

* Make flake happy.

* Update pvlib/irradiance.py

Co-authored-by: Cliff Hansen <[email protected]>

* Address comments.

* Add contributor code comments.

* Update pvlib/irradiance.py

Co-authored-by: Adam R. Jensen <[email protected]>

* Adapt to reviewer preferences.

* Adapt to flake preferences.

* Remove model pseudo-option.

* Flake

---------

Co-authored-by: Cliff Hansen <[email protected]>
Co-authored-by: Adam R. Jensen <[email protected]>

* Fix spurious test error with pandas 2.1 (#1891)

pandas-dev/pandas#55014

* Fix plotting in plot_singlediode.py gallery page (#1895)

* Update plot_singlediode.py

fixed plot annotations by moving plt.show() further down

* Update whatsnew.rst

* Update v0.10.3.rst

* Update docs/sphinx/source/whatsnew.rst

Undoing changes to whatsnew.rst

* Address pandas FutureWarnings in test suite (#1900)

* Cahnged expected reference in test_detect_clearskY_window to 1 from True to avoid Futurewarning

* Change reference to etr in ibird function to avoid FutureWarning

* In test_modelchain, update all instances when referring to series by position to using iloc to get rid of FutureWarning

* Update to iloc method for referencing by position in test_irradiance to get rid of FutureWarning

* In test_singlediode change applymap to map to get rid of FutureWarning

* Test_srml update to select using iloc to get rid of FutureWarning

* Substitute changing to float64 dtype using map with base functionality that's accessible across Pandas versions

* Added username to Contributors

* Update line break in test_clearsky to adhere to line length limit

* add comparisons to other tools

* Apply suggestions from code review

Co-authored-by: Cliff Hansen <[email protected]>

* revision re: other open-source projects

* bibtex tweaks

* clarify pvlib matlab comparison

---------

Co-authored-by: Miroslav Šedivý <[email protected]>
Co-authored-by: Arjan Keeman <[email protected]>
Co-authored-by: Miguel Sánchez de León Peque <[email protected]>
Co-authored-by: Will Hobbs <[email protected]>
Co-authored-by: Anton Driesse <[email protected]>
Co-authored-by: Cliff Hansen <[email protected]>
Co-authored-by: Adam R. Jensen <[email protected]>
Co-authored-by: matsuobasho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Various pandas deprecation warnings from test suite
2 participants