yt-project / yt

Main yt repository
http://yt-project.org
Other
469 stars 279 forks source link

BUG: incompatibility with most recent Cartopy versions #3705

Closed neutrinoceros closed 2 years ago

neutrinoceros commented 3 years ago

Bug report

Bug summary

We have been pinning cartopy to version 0.18 for a couple month to mitigate upstream compatibility issues. In order to enable testing yt on Windows + conda + Python 3.10, I tried to loosen that rule to allow more recent versions of cartopy (that are compatible with Python 3.10) to install. Doing so I discovered that we have one failing test under cartopy 0.19 and 0.20 I am reporting it to keep track of the problem, but short term I consider just skipping it would be preferable to not testing Windows + Python 3.10

Code for reproduction

with cartopy 0.19 or newer installed:

pytest yt/visualization/tests/test_geo_projections.py::TestGeoProjections::test_nondefault_transform

Actual outcome

E           ValueError: Invalid vmin or vmax

This can be reproduced at least with Python 3.9 + cartopy 0.19 and Python 3.10 + cartopy 0.20, so I really think this is a cartopy issue, not a Python incompatibility.

neutrinoceros commented 3 years ago

I think I managed to reduce the failure to a "minimal" case that doesn't use yt

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import cartopy

data = np.random.random_sample((10, 10))
transform = cartopy.crs.Miller()
projection = cartopy.crs.Mollweide()

fig = plt.figure()
ax = fig.add_axes((0, 0, 1, 1), projection=projection)
cax = fig.add_axes((1, 1, 1, 1))

im = ax.imshow(
    data,
    extent=[-180.0, 180.0, -90.0, 90.0],
    norm=LogNorm(),
    transform=transform,
)
cb = fig.colorbar(im, cax=cax)
fig.savefig("/tmp/demo.png")
neutrinoceros commented 3 years ago

reported upstream as https://github.com/SciTools/cartopy/issues/1955

neutrinoceros commented 2 years ago

The current conclusion from upstream discussion is that cartopy 0.20 contains some intended breaking changes that need to be accounted for on our side. This actually looks like a blocker for testing on Windows + Python 3.10 because cartopy is only tested on Windows so we can't skip it, but cartopy 0.18 doesn't seem compatible with Python 3.10 so we have to upgrade at some point.

At this stage I'm relatively confident that a solution to this can be found rather soon and be shipped with #3706