Hi everyone,
pyinterp 2026.11.0 is out. pyinterp is an open-source Python library for fast interpolation of geo-referenced data, and this release makes it available directly from xarray.
import numpy as np
import pyinterp
import xarray as xr
da = xr.open_dataset("sst.nc")["sst"]
# Bilinear interpolation onto a 0.1° grid
fine = da.pyinterp.interp(lon=np.arange(-180, 180, 0.1), lat=np.arange(-80, 80, 0.1))
# Conservative regridding onto a 1° grid
coarse = da.pyinterp.regrid(lon=np.arange(0.5, 360), lat=np.arange(-89.5, 90))
What’s new
- xarray accessor:
da.pyinterp.interpandds.pyinterp.interpfollowDataArray.interp, and the result keeps its labels and attributes. - Periodic longitudes: a grid stored in [0, 360) can be queried in [-180, 180) with no padding. In the example above, the source grid and the target grid use different conventions.
- Conservative regridding:
da.pyinterp.regridworks between rectilinear grids, on a sphere or an ellipsoid. It computes no 2D weights, so there is nothing to generate or store. - Reduced Gaussian grids: ECMWF grids can be interpolated in 2D, 3D and time from plain arrays, with no GRIB library needed.
- Python 3.15: wheels are available for CPython 3.12 and later, including free-threaded builds.
Performance
On a global 0.25° grid, measured on an Apple M3 Max:
- One million scattered points, bilinear: 20 ms on one thread, against 99 ms for
scipy.interpolate.RegularGridInterpolator, and 2.6 ms on all cores. - Conservative regridding to 1°: 1.2 ms on one thread, against 118 ms for xESMF to apply its weights, after 11 s to compute them.
xESMF does more than this: it also handles curvilinear and unstructured grids. The two tools also define cells differently, along parallels for pyinterp and great circles for ESMF. The benchmarks page explains these differences and how to run the comparison yourself: Benchmarks — pyinterp
Install
pip install "pyinterp[xarray]"
or
mamba install -c conda-forge pyinterp
Full release notes: Release 2026.11.0 · CNES/pangeo-pyinterp · GitHub
Documentation: pyinterp — pyinterp
Feedback and bug reports are very welcome.