hainegroup / oceanspy

A Python package to facilitate ocean model data analysis and visualization.
https://oceanspy.readthedocs.io
MIT License
100 stars 32 forks source link

plot.horizontal_section break by matplotlib version >3.5.2 #269

Closed MaceKuailv closed 1 year ago

MaceKuailv commented 1 year ago

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.

ThomasHaine commented 1 year ago

It works for me on SciServer:

image
MaceKuailv commented 1 year ago

You have mpl version 3.5.2, an older version. That's why it is not broken.

Mikejmnez commented 1 year ago

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

MaceKuailv commented 1 year ago

Since cartopy is now unpinned, this issue will automatically be resolved once cartopy people fixed the bug.

MaceKuailv commented 1 year ago

Closed with PR #348