earthkit.geo.grids._regrid.array.regrid¶
- earthkit.geo.grids._regrid.array.regrid(data, in_grid=None, out_grid=None, interpolation='linear', backend='mir', **kwargs)¶
Array interface.
Regrid the high-level
dataobject with the given backend.- Parameters:
data (
NDArray) – The input data to be regridded, represented as a NumPy array, defining a single field on thein_grid.in_grid (
dict|str|Grid) – The grid spec describing the input grid. The supported grids depends on the regriddingbackend.out_grid (
dict|str|Grid|None) – The grid spec describing the target grid thatdatawill be interpolated onto. The supported grids depends on the regriddingbackend.interpolation (
str) –The interpolation method. Please note not all the interpolation methods support all possible grid types. The possible values are as follows:
”linear”: Finite Element based interpolation with linear base functions with supporting triangular mesh
”grid-box-average”: input/output grid box intersections interpolation preserving input value integrals (conservative interpolation).
”nearest-neighbour”: choose a nearest neighbouring input point to define output point value
backend (
{"mir", "precomputed"}, default"mir") –The regridding backend to use. The possible values are as follows:
- ”mir”: Use the MIR regridding library. This is the default backend. See details in the
documentation at regrid (array-level) with MIR.
- ”precomputed”: Use pre-computed interpolation weights for some supported grid pairs and interpolation
methods. See details in the documentation at regrid (array-level) with precomputed weights.
**kwargs – Additional keyword arguments depending on data type, interpolation or backend.
- Returns:
Tuple of the regridded data as a NumPy array and the output grid spec as a dictionary. The output grid spec can be different from the input
out_gridargument, depending on the regridding backend since normalisation and other adjustments may be applied during the regridding process.- Return type:
NDArray,dict
Examples
Using the “mir” backend:
Using the “precomputed” backend:
/how-tos/precomputed/precomp_.ipynb