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
Fix #5524. Use finfo.max instead of np.inf #5534
Conversation
92b937f
to
a9a4683
Compare
I was thinking about the finfo values, but couldn't remember the name |
Stepping back, the problem seems to have been introduced when non-finite values were masked. Would it work if we masked NaNs only (and left inf and -inf alone)? |
why not just use vmax + eps and vmin - eps? Makes for a very small chance On Fri, Nov 20, 2015 at 1:40 PM, Michael Droettboom <
|
@WeatherGod: That does indeed fix the test. @efiring: Any downsides to that you can think of? |
I thought of that also, but I wasn't sure whether vmin/vmax would always be known and invariant at that point in the execution. |
Also, when you norm vmax + eps, is it guaranteed that the result will be greater than 1? I doubt it. |
@@ -1231,10 +1231,11 @@ def _process_levels(self): | |||
self.layers = 0.5 * (self._levels[:-1] + self._levels[1:]) | |||
# ...except that extended layers must be outside the | |||
# normed range: | |||
finfo = np.finfo(float) |
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.
iirc, this can be a major time sink
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.
Yeah. In this case, I don't think it's in a hot path, though.
@mdboom, Regarding an earlier question: I think that masking only the nan values and leaving inf alone would work in this case, but would not be the right thing for pcolormesh in general. It would mean that autoscaling of the data range would still give useless results. I think using |
@efiring It looks like this I think it is better to use the |
Fix #5524. +/m eps instead of np.inf
Fix #5524. +/m eps instead of np.inf
backported as d1f525c |
Confusing indeed. Can we just delete self.vmin and self.vmax here? |
This reverts commit d1f525c.
reverted on master as f90367a reverted on v1.5.x as 605718b Sorry, I miss understood. I am not sure how to guarantee that the values normalize to outside the bounds for a general norm. Maybe we should just use the top and bottom values in |
I think the problem is that their padding is enough to bracket the "outside" data values, but not necessarily to ensure that the normed top and bottom levels are outside 0-1 range. I stand by my earlier recommendation to use magic numbers which work (e.g. anything in the 1e100 to 1e300 range; let's split it and use 1e150) instead of magic numbers (e.g. finfo stuff) that don't work. |
Cc: @efiring
Based on suggested fix in #5524.