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

Remove warning message for num_threads in pvlib.spa #2170

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

kandersolar
Copy link
Member

@kandersolar kandersolar commented Aug 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.

Edit: this PR now removes, instead of edits, the mentioned warning. Original text below:


The numba SPA implementation uses multithreading by default. When the specified number of threads is larger than the number of given timestamps, a warning is emitted indicating that the number of used threads is being reduced to match the input timestamps. However, the message mixes two styles of interpolation (old %s style and .format style) and thus produces a faulty message with the interpolation placeholder still present:

UserWarning: The number of threads is more than the length of the time array. Only using %s threads.

This PR fixes the interpolation so that it would then look something like this:

UserWarning: The number of threads is more than the length of the time array. Only using 3 threads.

@kandersolar kandersolar added this to the v0.11.1 milestone Aug 17, 2024
@kandersolar kandersolar changed the title Fix error message for num_threads in pvlib.spa Fix warning message for num_threads in pvlib.spa Aug 17, 2024
@kandersolar
Copy link
Member Author

If I remember correctly, @AdamRJensen suggested we get rid of this warning entirely. I'm inclined to agree. The situation in question (number of threads larger than number of timestamps) is not inherently problematic. What is the user supposed to "fix" to make the warning go away? I plan to modify this PR to just remove the warning.

@cwhanse
Copy link
Member

cwhanse commented Sep 23, 2024

No objection from me

@kandersolar kandersolar mentioned this pull request Sep 23, 2024
11 tasks
@kandersolar kandersolar changed the title Fix warning message for num_threads in pvlib.spa Remove warning message for num_threads in pvlib.spa Sep 23, 2024
Copy link
Member

@cwhanse cwhanse left a comment

Choose a reason for hiding this comment

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

Still approve

@AdamRJensen AdamRJensen merged commit e80355e into pvlib:main Sep 23, 2024
30 checks passed
@kandersolar kandersolar deleted the spa-warning branch September 23, 2024 21:21
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.

3 participants