-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Adding test for all NANs in contour #25330
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
You should add the match string here rather than asserting on private message lists. https://docs.pytest.org/en/7.1.x/how-to/capture-warnings.html#warns
edit: also, the warning text seems a bit misleading here since the user didn't pass in any masked elements.
Uh oh!
There was an error while loading. Please reload this page.
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.
There are two warnings, so this should be the way to go.
https://docs.pytest.org/en/7.1.x/how-to/capture-warnings.html#recwarn
Edit: I think that those comes from numpy.
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.
As @oscargus mentioned, There are two warnings, so I manually checked the warning messages for both.
Yes, the warning message is coming from numpy.
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.
The warning definitely comes from numpy. It is converting the floats for zmin/zmax
float(np.ma.masked)
Ahh, now I see that (maybe unfortunately?) the levels actually have values now, so we only have the two warnings (there used to be other level related warnings on earlier versions):
[-1.0e-13 -7.5e-14 -5.0e-14 -2.5e-14 0.0e+00 2.5e-14 5.0e-14 7.5e-14 1.0e-13]
I guess these warnings don't really help much for the root of the problem, so I'd actually suggest getting rid of them altogether by converting the typecasts to:
z.min().astype(float)
, and think about instead giving a more helpful error message somewhere else.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.
So, should we close this PR and add
z.min().astype(float)
&z.max().astype(float)
to a new one?I'm getting the correct result using
astype
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.
That seems like a reasonable fix to me and seems to line up with the
plt.plot([np.nan], [np.nan])
case not issuing any warnings either.