pangeo-data / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
182 stars 32 forks source link

Another numpy 2 fix #377

Open aulemahal opened 2 days ago

aulemahal commented 2 days ago

Fixes #315

ESMpy has stored its grid sizes in int32 forever, but before numpy 2 our get_shape function was returning normal ints while it now returns np.int32 scalars with numpy 2.0.

The reason is that tuple(np.array([1, 1], dtype=np.int32)) changed behaviour in numpy 2, preserving the dtype of the individual elements in the tuple, while it previously implicitly casted them with python's scalar. See https://numpy.org/doc/stable/numpy_2_0_migration_guide.html#changes-to-numpy-data-type-promotion