regrid (high-level) with MIR¶
- regrid(data, in_grid=None, out_grid=None, in_dims=None, out_dims=None, interpolation='linear', backend='mir')
Regrid the high-level
dataobject (with geography information) using MIR (Meteorological Interpolation and Regridding).The
backendparameter is set to “mir” by default so it is not necessary to specify it explicitly.- Parameters:
data (
FieldList,Field,xarray.DataArray,xarray.Dataset, bytes,io.BytesIO) –The data to be regridded. The following input data types are supported:
earthkit-data
FieldListearthkit-data
FieldGRIB message as a bytes or
io.BytesIOobject
in_grid (dict, str,
Grid) – the gridspec describing the input grid. It is only needed when the input grid cannot be automatically inferred from the input data. This can be the case for Xarray, where at present the grid information can only be accessed via the “earthkit.grid_spec” attribute, and if it is missing or does not contain the necessary informationin_gridneeds to be provided. Whenin_gridis provided, it takes precedence over the metadata of the input data. For the list of supported grids, please refer to the gridspec documentation.out_grid (dict, str,
Grid) – the gridspec describing the target grid thatdatawill be interpolated onto. For the list of supported grids, please refer to the gridspec documentation.in_dims (list, tuple, None) – the names of the geographical dimensions in the Xarray input data. It is only needed when the dimension names cannot be automatically inferred. When it is provided, it takes precedence over the metadata of the input data.
out_dims (list, tuple, None) – the names of the geographical dimensions in the Xarray output data. It is only needed when the dimension names cannot be automatically inferred. When it is provided, it takes precedence over the metadata of the input data.
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
- Returns:
Return the regridded data with the same type as
databut with the grid changed to the output grid.- Return type:
The same type of data as
data.
Notes¶
The interpolation only works if both the input and output grid are supported. For the list of supported grids, please refer to the gridspec documentation.