xESMF
Universal Regridder for Geospatial Data
xESMF is a Python package for regridding. It is
Powerful: It uses ESMF/ESMPy as backend and can regrid between general curvilinear grids with all ESMF regridding algorithms, such as bilinear, conservative and nearest neighbour.
Easy-to-use: It abstracts away ESMF’s complicated infrastructure and provides a simple, high-level API, compatible with xarray as well as basic numpy arrays.
Fast: It is faster than ESMPy’s original Fortran regridding engine in serial case, and also supports dask for out-of-core, parallel computation.
http://xesmf.readthedocs.io/
Changing the way we look at Earth data with xESMF: | by Raphael Dussin | pangeo | Oct, 2020 | Medium
https://medium.com/pangeo/changing-the-way-you-look-at-earth-data-with-xesmf-ee55d0b380e5
Examples
Lazy regridding with reusable weights (xESMF pattern)
Precompute weights once; reuse them lazily across variables and time slices.
code:python
import xesmf as xe
regridder = xe.Regridder(ds, target_grid, "bilinear", reuse_weights=True)
theta_regridded = regridder(ds"thetao") # lazy if input is dask-backed
Store weights on disk to amortize setup cost across experiments
See also
interpolation