SciTools / iris

A powerful, format-agnostic, and community-driven Python package for analysing and visualising Earth science data
https://scitools-iris.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
633 stars 283 forks source link

Remove `GeoAxes` patch at next Cartopy release #5977

Open trexfeathers opened 4 months ago

trexfeathers commented 4 months ago

📰 Custom Issue

SciTools/cartopy#2390

https://github.com/SciTools/iris/blob/57096f29f6f2c5ff278d616df5e2da4d2bab95e2/lib/iris/plot.py#L46-L60

rcomer commented 6 days ago

Cartopy 0.24 is now out.

schlunma commented 4 days ago

Hi!

With the release of cartopy 0.24 the current iris 3.10.0 package on conda-forge will throw the following exception when trying to plot a map:

TypeError: _GeoAxesPatched._draw_preprocess() missing 1 required positional argument: 'renderer' 

I could trace back this error to the piece of code that you mention here (i.e., removing it solves this error).

MRE:

import matplotlib.pyplot as plt

import iris
import iris.quickplot as qplt

fname = iris.sample_data_path("air_temp.pp")
temperature_cube = iris.load_cube(fname)

# Draw the contour with 25 levels.
qplt.contourf(temperature_cube, 25)

# Add coastlines to the map created by contourf.
plt.gca().coastlines()

plt.show()
rcomer commented 4 days ago

Ah, that would be my fault again 😬 . renderer wasn't getting used in _draw_preprocess so we removed that at https://github.com/SciTools/cartopy/pull/2424

trexfeathers commented 4 days ago

I'm working on it right now guys: #6171.

Unfortunately updating to Cartopy 0.24 has produced some material image test failures so I need to make sure I understand why before we can move forward.

If that takes too long or I'm too dumb then I'll have to use a pin in the short term.

valeriupredoi commented 4 days ago

cheers, guys! We're gonna pin ESMValTool's cartopy<0.24 right now, and will release a new build with it :+1:

trexfeathers commented 15 hours ago

@pp-mo I currently have no intention of removing the patch at the next Cartopy release. Could you explain the re-opening? You mentioned to me offline that in several years' time we will probably have a minimum pin >0.23, but that's a long way off and I wouldn't want to use an issue to track something like that.