Open mathause opened 4 years ago
I have a similar issue with nonmonotonic coordinates (mapping a 2D image to a zenith-azimuth space). Solving this is easy when using Matplotlib's API directly, since I can compute mesh coordinates by myself (on a array with one row and one column more) and supply these as pcolormesh()
's x
and y
arguments; but I can't inject these into xarray's pcolormesh()
function. Wouldn't allowing infer_interval=False
and passing ordinary arrays as x
and y
be a good solution?
Another consequence is that this example in the docs is now meaningless / misleading. I've just come across the series of discussions in cartopy about this issue - it looks quite complex and I'm also not sure yet what to do in xarray in the mean time.
Wouldn't allowing infer_interval=False and passing ordinary arrays as x and y be a good solution?
I'm not sure what you mean by that? You can always set infer_interval=False
at the xarray level?
I'm not sure what you mean by that? You can always set infer_interval=False at the xarray level?
Yes indeed, but you cannot pass custom Numpy arrays as the x
and y
parameters to set.
Looking at some warnings in #3266 I saw that matplotlib will deprecate the old behaviour of
pcolormesh
when the shape of the data and the coordinates are equal (they silently cut a row and a column of the data). With the new behaviour they will interpolate the coordinates.This is a good thing in general - we already do this for a long time with the
infer_intervals
keyword. Unfortunately they don't check if the data is monotonic (matplotlib/matplotlib#18317) which can lead to problems for maps (scitools/cartopy#1638). I don't think there is a need to do something right now - let's see what they think upstream.This change was introduced in mpl 3.3.0