Skip to content
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

Closed
koldunovn opened this issue Sep 5, 2021 · 4 comments
Closed

Wrong plotting of curvilinear coordinates in v 0.19.0.post1 #1839

koldunovn opened this issue Sep 5, 2021 · 4 comments

Comments

@koldunovn
Copy link

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

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

od = Dataset('./areacello_Ofx_MPI-ESM1-2-LR_1pctCO2_r1i1p1f1_gn.nc')
lon2d = od.variables['longitude'][:]
lat2d = od.variables['latitude'][:]
data = od.variables['areacello'][:]

plt.figure(figsize=(10,5))
ax = plt.axes(projection=ccrs.Mercator())
ax.coastlines(resolution='110m', color='k')
ax.pcolormesh(lon2d, lat2d, 
            data,  
            cmap=cm.RdBu_r, transform=ccrs.PlateCarree())

plt.figure(figsize=(10,5))
ax = plt.axes(projection=ccrs.NorthPolarStereo())
ax.coastlines(resolution='110m', color='k')
ax.pcolormesh(lon2d, lat2d, 
            temp,  
            cmap=cm.RdBu_r, transform=ccrs.PlateCarree())
ax.set_extent([-180.,180.,60.,90.], crs=ccrs.PlateCarree())

Traceback

v 0.18 result:

image
image

v 0.19.0.post1

image
image

Full environment definition

Operating system

Tested on MacOS and Linux

Cartopy version

0.19.0.post1 installed from conda-forge

conda list

ansiwrap                  0.8.4                      py_0    conda-forge
appdirs                   1.4.3                      py_1    conda-forge
appnope                   0.1.0           py38h32f6830_1001    conda-forge
argon2-cffi               20.1.0           py38h4d0b108_1    conda-forge
astroid                   2.4.2            py38h32f6830_0    conda-forge
async_generator           1.10                       py_0    conda-forge
attrs                     19.3.0                     py_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.1                      py_0    conda-forge
bcrypt                    3.1.7                    pypi_0    pypi
black                     19.10b0                    py_4    conda-forge
bleach                    3.1.5              pyh9f0ad1d_0    conda-forge
blosc                     1.21.0               h046ec9c_0    conda-forge
bokeh                     2.1.1            py38h32f6830_0    conda-forge
boost-cpp                 1.72.0               hd067f63_4    conda-forge
brotli                    1.0.9                h046ec9c_4    conda-forge
brotlipy                  0.7.0           py38h64e0658_1000    conda-forge
brunsli                   0.1                  hb1e8313_0    conda-forge
bzip2                     1.0.8                haf1e3a3_2    conda-forge
c-ares                    1.16.1               haf1e3a3_0    conda-forge
ca-certificates           2021.5.30            h033912b_0    conda-forge
cairo                     1.16.0            h4ec454a_1007    conda-forge
cartopy                   0.19.0.post1     py38h4be4431_1    conda-forge
certifi                   2021.5.30        py38h50d1736_0    conda-forge
cffi                      1.14.5           py38ha97d567_0    conda-forge
cfgrib                    0.9.9.0            pyhd8ed1ab_1    conda-forge
cfitsio                   3.470                hdf94aef_6    conda-forge
cftime                    1.2.1            py38h9c4ca6c_0    conda-forge
chardet                   3.0.4           py38h32f6830_1006    conda-forge
charls                    2.2.0                h046ec9c_0    conda-forge
click                     7.1.2              pyh9f0ad1d_0    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.1              pyhd8ed1ab_0    conda-forge
cloudpickle               1.5.0                      py_0    conda-forge
cmocean                   2.0                        py_3    conda-forge
colorama                  0.4.3                    pypi_0    pypi
colorcet                  2.0.1                      py_0    conda-forge
colorspacious             1.1.2              pyh24bf2e0_0    conda-forge
conda                     4.9.2            py38h50d1736_0    conda-forge
conda-package-handling    1.7.2            py38h94c058a_0    conda-forge
configobj                 5.0.6                      py_0    conda-forge
cryptography              3.0              py38h52adbb4_0    conda-forge
curl                      7.71.1               hcb81553_5    conda-forge
cycler                    0.10.0                     py_2    conda-forge
cytoolz                   0.10.1           py38h0b31af3_0    conda-forge
dask                      2.22.0                     py_0    conda-forge
dask-core                 2.22.0                     py_0    conda-forge
datashader                0.10.0                     py_0    conda-forge
datashape                 0.5.4                      py_1    conda-forge
dbus                      1.13.6               h2f22bb5_0    conda-forge
decorator                 4.4.2                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
distributed               2.23.0           py38h32f6830_0    conda-forge
docutils                  0.16                     pypi_0    pypi
eccodes                   2.18.0               h031fe05_0    conda-forge
entrypoints               0.3             py38h32f6830_1001    conda-forge
expat                     2.2.10               h1c7c35f_0    conda-forge
f90nml                    1.2                      pypi_0    pypi
fabric                    2.5.0                    pypi_0    pypi
fdiag                     0.1.0                     dev_0    <develop>
fiona                     1.8.18           py38hd34e6ff_0    conda-forge
flake8                    3.8.3                      py_1    conda-forge
flatten-dict              0.3.0                    pypi_0    pypi
fontconfig                2.13.1            hd23ceaa_1004    conda-forge
freetype                  2.10.4               h4cff582_1    conda-forge
freexl                    1.0.5             h0b31af3_1002    conda-forge
fsspec                    0.8.0                      py_0    conda-forge
ftest                     0.1.0                     dev_0    <develop>
gdal                      3.1.4            py38hfec5fc6_8    conda-forge
geopandas                 0.8.2              pyhd8ed1ab_0    conda-forge
geos                      3.9.1                he49afe7_2    conda-forge
geotiff                   1.6.0                h1925f3f_4    conda-forge
geoviews                  1.8.2                      py_0    pyviz
geoviews-core             1.8.2                      py_0    pyviz
gettext                   0.19.8.1          h7937167_1005    conda-forge
giflib                    5.2.1                h0b31af3_2    conda-forge
glib                      2.66.7               h1c7c35f_0    conda-forge
glib-tools                2.66.7               h1c7c35f_0    conda-forge
hdf4                      4.2.13            h84186c3_1003    conda-forge
hdf5                      1.10.6          nompi_haae91d6_101    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
holoviews                 1.13.3             pyh9f0ad1d_0    conda-forge
icu                       68.1                 h74dc148_0    conda-forge
idna                      2.10               pyh9f0ad1d_0    conda-forge
imagecodecs               2021.1.11        py38hb15f0e6_1    conda-forge
imageio                   2.9.0                      py_0    conda-forge
importlib-metadata        1.7.0            py38h32f6830_0    conda-forge
importlib_metadata        1.7.0                         0    conda-forge
iniconfig                 1.0.1              pyh9f0ad1d_0    conda-forge
intake                    0.6.1              pyhd8ed1ab_0    conda-forge
invoke                    1.4.1                    pypi_0    pypi
ipykernel                 5.3.4            py38h23f93f0_0    conda-forge
ipython                   7.17.0           py38h1cdfbd6_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.5.1                      py_0    conda-forge
isort                     4.3.21           py38h32f6830_1    conda-forge
jasper                    1.900.1           h636a363_1006    conda-forge
jedi                      0.17.2           py38h32f6830_0    conda-forge
jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
joblib                    0.16.0                     py_0    conda-forge
jpeg                      9d                   h0b31af3_0    conda-forge
json-c                    0.15                 hcb556a6_0    conda-forge
jsonschema                3.2.0            py38h32f6830_1    conda-forge
jupyter                   1.0.0                    pypi_0    pypi
jupyter_client            6.1.6                      py_0    conda-forge
jupyter_console           6.1.0                      py_1    conda-forge
jupyter_core              4.6.3            py38h32f6830_1    conda-forge
jxrlib                    1.1                  h0b31af3_2    conda-forge
kealib                    1.4.14               ha0ce315_1    conda-forge
keyring                   21.3.0                   pypi_0    pypi
kiwisolver                1.2.0            py38ha0d09dd_0    conda-forge
krb5                      1.17.1               h75d18d8_2    conda-forge
lazy-object-proxy         1.4.3            py38h64e0658_2    conda-forge
lcms2                     2.11                 h174193d_0    conda-forge
lerc                      2.2.1                h046ec9c_0    conda-forge
libaec                    1.0.4                h4a8c4bd_1    conda-forge
libarchive                3.5.1                h0a5793d_1    conda-forge
libblas                   3.8.0               17_openblas    conda-forge
libcblas                  3.8.0               17_openblas    conda-forge
libclang                  11.0.1          default_hf8bb9ca_1    conda-forge
libcurl                   7.71.1               h9bf37e3_5    conda-forge
libcxx                    12.0.1               habf9029_0    conda-forge
libdap4                   3.20.6               h993cace_1    conda-forge
libdeflate                1.7                  h35c211d_5    conda-forge
libedit                   3.1.20191231         h0678c8f_2    conda-forge
libev                     4.33                 haf1e3a3_0    conda-forge
libffi                    3.3                  h046ec9c_2    conda-forge
libgdal                   3.1.4                h62a8350_8    conda-forge
libgfortran               4.0.0                         2    conda-forge
libglib                   2.66.7               h56565ab_0    conda-forge
libiconv                  1.16                 haf1e3a3_0    conda-forge
libkml                    1.3.0             h169b8f9_1011    conda-forge
liblapack                 3.8.0               17_openblas    conda-forge
libllvm11                 11.0.1               h223d4b2_0    conda-forge
libllvm9                  9.0.1                h7475705_1    conda-forge
libnetcdf                 4.7.4           nompi_hc5b2cf3_105    conda-forge
libnghttp2                1.41.0               h8a08a2b_1    conda-forge
libopenblas               0.3.10          openmp_h63d9170_4    conda-forge
libpng                    1.6.37               hb0a8c7a_2    conda-forge
libpq                     13.2                 h052a64a_2    conda-forge
librttopo                 1.1.0                h5413771_6    conda-forge
libsodium                 1.0.18               h01d97ff_0    conda-forge
libsolv                   0.7.17               hfd3ada9_0    conda-forge
libspatialindex           1.9.3                h4a8c4bd_3    conda-forge
libspatialite             5.0.1                h395434c_3    conda-forge
libssh2                   1.9.0                h8a08a2b_5    conda-forge
libtiff                   4.2.0                h355d032_0    conda-forge
libwebp-base              1.1.0                h0b31af3_3    conda-forge
libxml2                   2.9.10               h802ca4f_3    conda-forge
libzopfli                 1.0.3                h4a8c4bd_0    conda-forge
llvm-openmp               10.0.1               h28b9765_0    conda-forge
llvmlite                  0.33.0           py38h3707e27_1    conda-forge
locket                    0.2.0                      py_2    conda-forge
lz4-c                     1.9.3                h046ec9c_0    conda-forge
lzo                       2.10              haf1e3a3_1000    conda-forge
mamba                     0.7.14           py38hb989c8f_0    conda-forge
markdown                  3.2.2                      py_0    conda-forge
markupsafe                1.1.1            py38h64e0658_1    conda-forge
matplotlib                3.3.0                         1    conda-forge
matplotlib-base           3.3.0            py38haed9462_1    conda-forge
mccabe                    0.6.1                      py_1    conda-forge
mistune                   0.8.4           py38h64e0658_1001    conda-forge
mkfesom                   0.1.0                     dev_0    <develop>
more-itertools            8.4.0                      py_0    conda-forge
msgpack-python            1.0.0            py38ha0d09dd_1    conda-forge
multipledispatch          0.6.0                      py_0    conda-forge
munch                     2.5.0                      py_0    conda-forge
mysql-common              8.0.25               h694c41f_0    conda-forge
mysql-libs                8.0.25               h54f5a68_0    conda-forge
nbclient                  0.4.1                      py_1    conda-forge
nbconvert                 5.6.1            py38h32f6830_1    conda-forge
nbformat                  5.0.7                      py_0    conda-forge
ncurses                   6.2                  hb1e8313_1    conda-forge
nest-asyncio              1.4.0                      py_0    conda-forge
netcdf4                   1.5.4           nompi_py38h74ad9c1_100    conda-forge
networkx                  2.4                        py_1    conda-forge
notebook                  6.1.3            py38h32f6830_0    conda-forge
nspr                      4.29                 hbc8d48c_1    conda-forge
nss                       3.47                 hc0980d9_0    conda-forge
numba                     0.50.1           py38h9529b5f_1    conda-forge
numpy                     1.19.1           py38h598c1e0_0    conda-forge
olefile                   0.46                       py_0    conda-forge
openjpeg                  2.4.0                h6cbf5cd_0    conda-forge
openssl                   1.1.1l               h0d85af4_0    conda-forge
ordered-set               4.0.2                      py_0    conda-forge
owslib                    0.20.0                     py_0    conda-forge
packaging                 20.4               pyh9f0ad1d_0    conda-forge
pandas                    1.1.0            py38h11c0d25_0    conda-forge
pandoc                    2.10.1               haf1e3a3_0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
panel                     0.9.7                      py_0    conda-forge
papermill                 2.1.2            py38h32f6830_0    conda-forge
param                     1.9.3                      py_0    conda-forge
paramiko                  2.7.1                    pypi_0    pypi
parso                     0.7.1              pyh9f0ad1d_0    conda-forge
partd                     1.1.0                      py_0    conda-forge
pathlib2                  2.3.5                    pypi_0    pypi
pathspec                  0.8.0              pyh9f0ad1d_0    conda-forge
pcre                      8.44                 h4a8c4bd_0    conda-forge
pexpect                   4.8.0            py38h32f6830_1    conda-forge
pickleshare               0.7.5           py38h32f6830_1001    conda-forge
pillow                    7.2.0            py38h83dc5e5_1    conda-forge
pip                       20.2.2                     py_0    conda-forge
pixman                    0.40.0               hbcb3906_0    conda-forge
pkginfo                   1.5.0.1                  pypi_0    pypi
pluggy                    0.13.1           py38h32f6830_2    conda-forge
poppler                   0.89.0               hd735947_5    conda-forge
poppler-data              0.4.9                         1    conda-forge
postgresql                13.2                 ha63e576_2    conda-forge
proj                      7.2.0                h4c0e659_0    conda-forge
proj4                     5.2.0             h6de7cb9_1006    conda-forge
prometheus_client         0.8.0              pyh9f0ad1d_0    conda-forge
prompt-toolkit            3.0.6                      py_0    conda-forge
prompt_toolkit            3.0.6                         0    conda-forge
psutil                    5.7.2            py38h4d0b108_0    conda-forge
ptyprocess                0.6.0                   py_1001    conda-forge
py                        1.9.0              pyh9f0ad1d_0    conda-forge
pycodestyle               2.6.0              pyh9f0ad1d_0    conda-forge
pycosat                   0.6.3           py38h5406a74_1006    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pyct                      0.4.6                      py_0    conda-forge
pyct-core                 0.4.6                      py_0    conda-forge
pyepsg                    0.4.0                      py_0    conda-forge
pyfesom2                  0.2.0                     dev_0    <develop>
pyflakes                  2.2.0              pyh9f0ad1d_0    conda-forge
pygments                  2.6.1                      py_0    conda-forge
pykdtree                  1.3.1           py38h65ad66c_1003    conda-forge
pylatex                   1.3.4              pyh9f0ad1d_0    conda-forge
pylint                    2.5.3            py38h32f6830_0    conda-forge
pynacl                    1.4.0                    pypi_0    pypi
pyopenssl                 19.1.0                     py_1    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyproj                    3.0.0.post1      py38h9d4eb05_0    conda-forge
pyqt                      5.12.3           py38hf180056_3    conda-forge
pyqt5-sip                 4.19.18                  pypi_0    pypi
pyqtchart                 5.12                     pypi_0    pypi
pyqtwebengine             5.12.1                   pypi_0    pypi
pyresample                1.16.0           py38h5fc983b_0    conda-forge
pyrsistent                0.16.0           py38h64e0658_0    conda-forge
pyshp                     2.1.0                      py_0    conda-forge
pysocks                   1.7.1            py38h32f6830_1    conda-forge
pytest                    6.0.1            py38h32f6830_0    conda-forge
python                    3.8.5                h26836e1_1
python-dateutil           2.8.1                      py_0    conda-forge
python-eccodes            2021.03.0        py38h0793694_0    conda-forge
python_abi                3.8                      1_cp38    conda-forge
pytz                      2020.1             pyh9f0ad1d_0    conda-forge
pyviz_comms               0.7.6              pyh9f0ad1d_0    conda-forge
pywavelets                1.1.1            py38h65ad66c_1    conda-forge
pyyaml                    5.3.1            py38h64e0658_0    conda-forge
pyzmq                     19.0.2           py38h2c785a9_0    conda-forge
qt                        5.12.9               h126340a_4    conda-forge
qtconsole                 4.7.6              pyh9f0ad1d_0    conda-forge
qtpy                      1.9.0                      py_0    conda-forge
readline                  8.0                  h0678c8f_2    conda-forge
readme-renderer           26.0                     pypi_0    pypi
regex                     2020.7.14        py38h4d0b108_0    conda-forge
reproc                    14.2.1               hbcb3906_0    conda-forge
reproc-cpp                14.2.1               h2e338ed_0    conda-forge
requests                  2.25.1             pyhd3deb0d_0    conda-forge
requests-toolbelt         0.9.1                    pypi_0    pypi
rfc3986                   1.4.0                    pypi_0    pypi
rtree                     0.9.7            py38hc59ffc2_1    conda-forge
ruamel_yaml               0.15.80         py38hca655e8_1004    conda-forge
scikit-image              0.17.2           py38h5fc983b_1    conda-forge
scipy                     1.5.2            py38h1402333_0    conda-forge
seawater                  3.3.4                      py_1    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                49.6.0           py38h32f6830_0    conda-forge
shapely                   1.7.1            py38h5786f56_5    conda-forge
six                       1.15.0             pyh9f0ad1d_0    conda-forge
snappy                    1.1.8                h4a8c4bd_3    conda-forge
sortedcontainers          2.2.2              pyh9f0ad1d_0    conda-forge
sqlite                    3.34.0               h17101e1_0    conda-forge
tabulate                  0.8.7                    pypi_0    pypi
tbb                       2019.9               ha1b3eb9_1    conda-forge
tblib                     1.6.0                      py_0    conda-forge
tenacity                  6.2.0            py38h32f6830_0    conda-forge
terminado                 0.8.3            py38h32f6830_1    conda-forge
testpath                  0.4.4                      py_0    conda-forge
textwrap3                 0.9.2                      py_0    conda-forge
tifffile                  2020.8.13                  py_0    conda-forge
tiledb                    2.2.4                h695c1d7_0    conda-forge
tk                        8.6.10               hb0a8c7a_0    conda-forge
toml                      0.10.1             pyh9f0ad1d_0    conda-forge
toolz                     0.10.0                     py_0    conda-forge
tornado                   6.0.4            py38h64e0658_1    conda-forge
tqdm                      4.48.2             pyh9f0ad1d_0    conda-forge
traitlets                 4.3.3            py38h32f6830_1    conda-forge
twine                     3.2.0                    pypi_0    pypi
typed-ast                 1.4.1            py38h0b31af3_0    conda-forge
typing_extensions         3.7.4.2                    py_0    conda-forge
tzcode                    2020a                h0b31af3_0    conda-forge
tzdata                    2021a                he74cb21_1    conda-forge
urllib3                   1.25.10                    py_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_1    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.35.1             pyh9f0ad1d_0    conda-forge
widgetsnbextension        3.5.1            py38h32f6830_1    conda-forge
wrapt                     1.11.2           py38h64e0658_0    conda-forge
xarray                    0.16.0                     py_0    conda-forge
xerces-c                  3.2.3                hd3a8c1e_2    conda-forge
xz                        5.2.5                haf1e3a3_1    conda-forge
yaml                      0.2.5                haf1e3a3_0    conda-forge
zeromq                    4.3.2                h4a8c4bd_3    conda-forge
zfp                       0.5.5                h4a8c4bd_1    conda-forge
zict                      2.0.0                      py_0    conda-forge
zipp                      3.1.0                      py_0    conda-forge
zlib                      1.2.11                     1007    conda-forge
zstd                      1.4.9                h582d3a0_0    conda-forge

pip list

ansiwrap                      0.8.4
appdirs                       1.4.3
appnope                       0.1.0
argon2-cffi                   20.1.0
astroid                       2.4.2
async-generator               1.10
attrs                         19.3.0
backcall                      0.2.0
backports.functools-lru-cache 1.6.1
bcrypt                        3.1.7
black                         19.10b0
bleach                        3.1.5
bokeh                         2.1.1
brotlipy                      0.7.0
Cartopy                       0.19.0.post1
certifi                       2021.5.30
cffi                          1.14.5
cfgrib                        0.9.9.0
cftime                        1.2.1
chardet                       3.0.4
click                         7.1.2
click-plugins                 1.1.1
cligj                         0.7.1
cloudpickle                   1.5.0
cmocean                       2.0
colorama                      0.4.3
colorcet                      2.0.1
colorspacious                 1.1.2
conda                         4.9.2
conda-package-handling        1.7.2
configobj                     5.0.6
cryptography                  3.0
cycler                        0.10.0
cytoolz                       0.10.1
dask                          2.22.0
datashader                    0.10.0
datashape                     0.5.4
decorator                     4.4.2
defusedxml                    0.6.0
distributed                   2.23.0
docutils                      0.16
eccodes                       1.2.0
entrypoints                   0.3
f90nml                        1.2
fabric                        2.5.0
fdiag                         0.1.0               /Users/nkolduno/FESOM/CI/fdiag
Fiona                         1.8.18
flake8                        3.8.3
flatten-dict                  0.3.0
fsspec                        0.8.0
ftest                         0.1.0               /Users/nkolduno/FESOM/CI/ftest
GDAL                          3.1.4
geopandas                     0.8.2
geoviews                      1.8.2
HeapDict                      1.0.1
holoviews                     1.13.3
idna                          2.10
imagecodecs                   2021.1.11
imageio                       2.9.0
importlib-metadata            1.7.0
iniconfig                     1.0.1
intake                        0.6.1
invoke                        1.4.1
ipykernel                     5.3.4
ipython                       7.17.0
ipython-genutils              0.2.0
ipywidgets                    7.5.1
isort                         4.3.21
jedi                          0.17.2
Jinja2                        2.11.2
joblib                        0.16.0
jsonschema                    3.2.0
jupyter                       1.0.0
jupyter-client                6.1.6
jupyter-console               6.1.0
jupyter-core                  4.6.3
keyring                       21.3.0
kiwisolver                    1.2.0
lazy-object-proxy             1.4.3
llvmlite                      0.33.0
locket                        0.2.0
mamba                         0.7.14
Markdown                      3.2.2
MarkupSafe                    1.1.1
matplotlib                    3.3.0
mccabe                        0.6.1
mistune                       0.8.4
mkfesom                       0.1.0               /Users/nkolduno/PYTHON/mkfesom
more-itertools                8.4.0
msgpack                       1.0.0
multipledispatch              0.6.0
munch                         2.5.0
nbclient                      0.4.1
nbconvert                     5.6.1
nbformat                      5.0.7
nest-asyncio                  1.4.0
netCDF4                       1.5.4
networkx                      2.4
notebook                      6.1.3
numba                         0.50.1
numpy                         1.19.1
olefile                       0.46
ordered-set                   4.0.2
OWSLib                        0.20.0
packaging                     20.4
pandas                        1.1.0
pandocfilters                 1.4.2
panel                         0.9.7
papermill                     2.1.2
param                         1.9.3
paramiko                      2.7.1
parso                         0.7.1
partd                         1.1.0
pathlib2                      2.3.5
pathspec                      0.8.0
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        7.2.0
pip                           20.2.2
pkginfo                       1.5.0.1
pluggy                        0.13.1
prometheus-client             0.8.0
prompt-toolkit                3.0.6
psutil                        5.7.2
ptyprocess                    0.6.0
py                            1.9.0
pycodestyle                   2.6.0
pycosat                       0.6.3
pycparser                     2.20
pyct                          0.4.6
pyepsg                        0.4.0
pyfesom2                      0.2.0               /Users/nkolduno/PYTHON/pyfesom2
pyflakes                      2.2.0
Pygments                      2.6.1
pykdtree                      1.3.1
PyLaTeX                       1.3.4
pylint                        2.5.3
PyNaCl                        1.4.0
pyOpenSSL                     19.1.0
pyparsing                     2.4.7
pyproj                        3.0.0.post1
PyQt5                         5.12.3
PyQt5-sip                     4.19.18
PyQtChart                     5.12
PyQtWebEngine                 5.12.1
pyresample                    1.16.0
pyrsistent                    0.16.0
pyshp                         2.1.0
PySocks                       1.7.1
pytest                        6.0.1
python-dateutil               2.8.1
pytz                          2020.1
pyviz-comms                   0.7.6
PyWavelets                    1.1.1
PyYAML                        5.3.1
pyzmq                         19.0.2
qtconsole                     4.7.6
QtPy                          1.9.0
readme-renderer               26.0
regex                         2020.7.14
requests                      2.25.1
requests-toolbelt             0.9.1
rfc3986                       1.4.0
Rtree                         0.9.7
ruamel-yaml-conda             0.15.80
scikit-image                  0.17.2
scipy                         1.5.2
seawater                      3.3.4
Send2Trash                    1.5.0
setuptools                    49.6.0.post20200814
Shapely                       1.7.1
six                           1.15.0
sortedcontainers              2.2.2
tabulate                      0.8.7
tblib                         1.6.0
tenacity                      6.2.0
terminado                     0.8.3
testpath                      0.4.4
textwrap3                     0.9.2
tifffile                      2020.8.13
toml                          0.10.1
toolz                         0.10.0
tornado                       6.0.4
tqdm                          4.48.2
traitlets                     4.3.3
twine                         3.2.0
typed-ast                     1.4.1
typing-extensions             3.7.4.2
urllib3                       1.25.10
wcwidth                       0.2.5
webencodings                  0.5.1
wheel                         0.35.1
widgetsnbextension            3.5.1
wrapt                         1.11.2
xarray                        0.16.0
zict                          2.0.0
zipp                          3.1.0
@greglucas
Copy link
Contributor

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 data = data[:-1, :-1] you will get the behavior of the old MPL style.

This would be helped by: #1646

@koldunovn
Copy link
Author

@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 contourf in a similar situation :) This has same (wrong) results in 0.18 and 0.19.

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())

image

@greglucas
Copy link
Contributor

No quick fixes for the contour issue you're seeing :(
My guess is it is wrong polygon wrapping, which we have quite a few issues open about. #1739 may help here...?

@koldunovn
Copy link
Author

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants