-
Notifications
You must be signed in to change notification settings - Fork 370
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
Wrong plotting of curvilinear coordinates in v 0.19.0.post1 #1839
Comments
I'm pretty sure this is due to pcolormesh change in MPL 3.3, and not Cartopy. You should have received a warning: "UserWarning: The input coordinates to pcolormesh are interpreted as cell centers, but are not monotonically increasing or decreasing. This may lead to incorrectly calculated cell edges, in which case, please supply explicit cell edges to pcolormesh." As the warning states, you need to supply cell edges instead of centers to the plot. If you change to This would be helped by: #1646 |
@greglucas Thanks a lot for the explanation! I did not get the warning, but changing to temp[:-1, :-1] just fixed the problem :) Not related to this thread directly, but maybe you can also advise a quick fix for wget https://swift.dkrz.de/v1/dkrz_c719fbc3-98ea-446c-8e01-356dac22ed90/cartopy/areacello_Ofx_MPI-ESM1-2-LR_1pctCO2_r1i1p1f1_gn.nc from netCDF4 import Dataset
import cartopy.crs as ccrs
import matplotlib.pylab as plt
from matplotlib import cm
plt.figure(figsize=(10,5))
ax = plt.axes(projection=ccrs.Mercator())
ax.coastlines(resolution='110m', color='k')
ax.contourf(lon2d, lat2d,
data,
cmap=cm.RdBu_r, transform=ccrs.PlateCarree()) |
No quick fixes for the contour issue you're seeing :( |
@greglucas thanks again for the tip and your help with this issue! I will close now, so the contouring thing is unrelated to this particular one, which is solved :) |
Description
Switching from 0.18 to 0.19.0.post1 (conda installation) breaks ability to plot curvilinear coordinates, as used, for example, in ocean models. Could be related to #1622
Code to reproduce
Minimum example with use of CMIP6
areacello
, that one has to download, unfortunately (only 2M).Traceback
v 0.18 result:
v 0.19.0.post1
Full environment definition
Operating system
Tested on MacOS and Linux
Cartopy version
0.19.0.post1 installed from
conda-forge
conda list
pip list
The text was updated successfully, but these errors were encountered: