oceanspy
oceanspy copied to clipboard
plot.horizontal_section break by matplotlib version >3.5.2
All tests related to plot.horizontal_section is broke, likely because of matplotlib.
To reproduce the error try the following:
import oceanspy as ospy
import cartopy
import matplotlib as mpl
print('mpl version:',mpl.__version__)
print('cartopy version:',cartopy.__version__)
od = ospy.open_oceandataset.from_catalog('get_started')
od.plot.horizontal_section(varName = 'XC')
I got the error "AttributeError: 'GeoAxesSubplot' object has no attribute '_autoscaleXon' " with mpl 3.6.1 and cartopy 0.19.0.post1, but no error on Oceanography image with 3.5.1 and 0.19.0.post1.
See this cartopy issue for more info. https://github.com/SciTools/cartopy/issues/2086
The straightforward solution is to pin matplotlib until cartopy people solve this issue from their end.
It works for me on SciServer:

You have mpl version 3.5.2, an older version. That's why it is not broken.
@MaceKuailv FYI I just checked the oceanspy_test
environment that I used for testing in my local computer and matplotlib indeed is version 3.5.1
(also checked and xgcm is version 0.6 and xarray is 0.21.1).
All good signs that indeed the issue is a maplotlib rather than cartopy.
Since cartopy is now unpinned, this issue will automatically be resolved once cartopy people fixed the bug.
Closed with PR #348