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

BUG: remaining incompatibility between cartopy 0.21.1 and shapely 2.0 (?) #2113

Closed
neutrinoceros opened this issue Dec 13, 2022 · 5 comments
Closed
Milestone

Comments

@neutrinoceros
Copy link
Contributor

Description

The new release of cartopy (0.21.1) breaks two tests in yt by raising this DeprecationWarning:

 DeprecationWarning: The 'geom_factory' function is deprecated in Shapely 2.0, and will be removed in a future version

I am reasonably confident that this warning is triggered within cartopy and out of control from yt's standpoint. See the tests logs for example: https://github.com/yt-project/yt/actions/runs/3684703466/jobs/6234753758

Code to reproduce

git clone git@github.com:yt-project/yt.git
cd yt
python -m pip install -e .
python -m pip install pytest
# ... install cartopy too

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

Traceback

yt/visualization/tests/test_geo_projections.py:172: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
yt/visualization/plot_window.py:1819: in __init__
    PWViewerMPL.__init__(
yt/visualization/plot_window.py:868: in __init__
    PlotWindow.__init__(self, *args, **kwargs)
yt/visualization/plot_window.py:249: in __init__
    self._setup_plots()
yt/visualization/plot_window.py:1121: in _setup_plots
    self.plots[f] = WindowPlotMPL(
yt/visualization/plot_window.py:2497: in __init__
    self._init_image(data, extent, aspect)
yt/visualization/base_plot_types.py:298: in _init_image
    self._validate_axes_extent(extent, transform)
yt/visualization/base_plot_types.py:396: in _validate_axes_extent
    self.axes.set_extent(extent, crs=transform)
../../../.pyenv/versions/yt-dev/lib/python3.10/site-packages/cartopy/mpl/geoaxes.py:860: in set_extent
    projected = self.projection.project_geometry(domain_in_crs, crs)
../../../.pyenv/versions/yt-dev/lib/python3.10/site-packages/cartopy/crs.py:808: in project_geometry
    return getattr(self, method_name)(geometry, src_crs)
../../../.pyenv/versions/yt-dev/lib/python3.10/site-packages/cartopy/crs.py:814: in _project_line_string
    return cartopy.trace.project_linear(geometry, src_crs, self)
lib/cartopy/trace.pyx:608: in cartopy.trace.project_linear
    ???
lib/cartopy/trace.pyx:74: in cartopy.trace.shapely_from_geos
    ???

...

E       DeprecationWarning: The 'geom_factory' function is deprecated in Shapely 2.0, and will be removed in a future version

A simpler, more self-contained reproducer (but it's harder to see the traceback):

# t.py
import yt
from yt.testing import fake_amr_ds

yt.set_log_level("error")

ds = fake_amr_ds(geometry="geographic")
axis = "altitude"
slc = yt.SlicePlot(
    ds, "altitude", ("stream", "Density"), origin="native", width=(80.0, 50.0)
)
$ python -W always::DeprecationWarning t.py
/Users/robcleme/.pyenv/versions/yt-dev/lib/python3.10/site-packages/cartopy/crs.py:814: DeprecationWarning: The 'geom_factory' function is deprecated in Shapely 2.0, and will be removed in a future version
  return cartopy.trace.project_linear(geometry, src_crs, self)
Full environment definition

Operating system

Seen on Windows and MacOS

versions

cartopy==0.21.1
shapely==0.21.1
yt==4.1.2
@greglucas
Copy link
Contributor

Definitely from Cartopy.
Hoping to get rid of that here: #2083

@neutrinoceros
Copy link
Contributor Author

Thanks for your reply. Since the effort is ongoing, would you advise we just ignore this particular warning downstream from the time being ?

@greglucas
Copy link
Contributor

Yes, we should definitely address the deprecation warning on our side. Someone is welcome to open up a PR to update this alternatively to the referenced PR, but either way I don't see this being an urgent need since it is just a deprecation warning.

@greglucas
Copy link
Contributor

I think these are all taken care of now? Feel free to re-open if that isn't the case.

@neutrinoceros
Copy link
Contributor Author

I confirm that the problem is solved with cartopy 0.22, thank you so much for your work !

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

3 participants