Skip to content

BUG: incompatibility with scipy 1.11.0 #2199

@neutrinoceros

Description

@neutrinoceros

Description

Scipy 1.11.0 (released yesterday) appear to break use cases exercised in yt's CI

More specifically the breaking change seems to be scipy/scipy#18502

Code to reproduce

import numpy as np
import cartopy.crs as ccrs
from matplotlib.figure import Figure

fig = Figure()
ax = fig.add_axes((0, 0, 1, 1), projection=ccrs.Mollweide())
ax.imshow([[0, 1], [0, 1]], transform=ccrs.PlateCarree())

Traceback

Traceback (most recent call last):
  File "/private/tmp/t.py", line 7, in <module>
    ax.imshow([[0, 1], [0, 1]], transform=ccrs.PlateCarree())
  File "/private/tmp/.venv/lib/python3.11/site-packages/cartopy/mpl/geoaxes.py", line 318, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/.venv/lib/python3.11/site-packages/cartopy/mpl/geoaxes.py", line 1331, in imshow
    img, extent = warp_array(img,
                  ^^^^^^^^^^^^^^^
  File "/private/tmp/.venv/lib/python3.11/site-packages/cartopy/img_transform.py", line 192, in warp_array
    array = regrid(array, source_native_xy[0], source_native_xy[1],
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/.venv/lib/python3.11/site-packages/cartopy/img_transform.py", line 278, in regrid
    _, indices = kdtree.query(target_xyz, k=1)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "_ckdtree.pyx", line 795, in scipy.spatial._ckdtree.cKDTree.query
ValueError: 'x' must be finite, check for nan or inf values
Full environment definition

Operating system

Discovered in CI on Ubuntu, and reproduced on macOS

Cartopy version

0.21.1

pip list

Package         Version
--------------- --------
Cartopy         0.21.1
certifi         2023.5.7
contourpy       1.1.0
cycler          0.11.0
fonttools       4.40.0
kiwisolver      1.4.4
matplotlib      3.7.1
numpy           1.25.0
packaging       23.1
Pillow          9.5.0
pip             23.1.2
pyparsing       3.1.0
pyproj          3.6.0
pyshp           2.3.1
python-dateutil 2.8.2
scipy           1.11.0
setuptools      65.5.0
shapely         2.0.1
six             1.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions