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.
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.
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.