Welcome to earthkit-regrid’s documentation
Important
This software is deprecated as of the Earthkit 1.0 release. Its functionality has been expanded and rolled into earthkit-geo.
earthkit-regrid is a Python package for regridding. It is one of the components of earthkit.
The API features the regrid() function taking inputs of Numpy arrays, earthkit-data GRIB field or fieldlist objects, and Xarray DataArrays or Datasets. It is implemented with various backends, the default backend uses ECMWF’s MIR (Meteorological Interpolation and Regridding) library to perform the regridding.
Quick start
A different interface is available depending on the input data type.
High-level interface
Use it for data containing geographical information, e.g. earthkit-data fieldlist objects, Xarray DataArrays or Datasets.
import earthkit.data as ekd
from earthkit.regrid import regrid
# get fieldlist from a sample GRIB file
ds = ekd.from_source("sample", "O32_t2.grib2")
# the target is a regular latitude-longitude grid
grid = {"grid": [5, 5]}
ds_res = regrid(ds, grid=grid)
Array-level interface
Use it for raw data arrays, e.g. Numpy ndarrays.
from earthkit.regrid.array import regrid
import numpy as np
vals = np.random.rand(320, 640)
in_grid = {"grid": [0.25, 0.25]} # regular latitude-longitude grid
out_grid = {"grid": "O320"} # octahedral reduced Gaussian grid
res_vals, res_grid = regrid(vals, in_grid=in_grid, out_grid=out_grid)
Examples
Documentation
Installation
Projects