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 data object with the given backend.

Parameters:
  • data (NDArray) – The input data to be regridded, represented as a NumPy array, defining a single field on the in_grid.

  • in_grid (dict|str|Grid) – The grid spec describing the input grid. The supported grids depends on the regridding backend.

  • out_grid (dict|str|Grid|None) – The grid spec describing the target grid that data will be interpolated onto. The supported grids depends on the regridding backend.

  • 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:

  • **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_grid argument, 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: