-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[FIX] iam.physical returns nan for aoi > 90° when n = 1 (#1706) #1707
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
Conversation
The nan appears to enter here and on the following line, because |
That condensed mathematical expression is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kdebrab! Can you add a bug fix entry in the 0.9.6 what's new file?
One thing is that the new test produces some runtime warning clutter: https://github.com/pvlib/pvlib-python/actions/runs/4510438842/jobs/7941391259?pr=1707#step:9:58
It would be nice to prevent iam.physical
from emitting those, but n=1
seems uncommon enough that I'd be okay with just suppressing them in the test function if there's not a clean way of preventing them at the source.
There is an interesting thing happening with this sequence of inexact trig calculations:
If the first line were producing a true zero this function would blow up sooner and more often; therefore, the previous use of We shouldn't really rely on cosd(90) != 0 anywhere, although we probably unwittingly do. |
I would follow this up with a suggestion (now retracted) to rewrite tools.cosd as
|
I'm puzzled by this. I assume you meant |
Sorry, didn't think that through all the way. Still, I hope this does not detract from the preceding (hopefully) valid observation about what's going wrong in this function. |
I'm going to merge this since it's ready to go and an improvement. Additional improvements can always be future PRs :) Thanks again @kdebrab for noticing and fixing this bug! |
docs/sphinx/source/reference
for API changes.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`
).remote-data
) and Milestone are assigned to the Pull Request and linked Issue.