earthkit.meteo.vertical.fieldlist.interpolate_monotonic¶
- earthkit.meteo.vertical.fieldlist.interpolate_monotonic(data, coords=None, target_coords=None, coord_type=None, interpolation='linear', aux_min_level_data=None, aux_min_level_coord=None, aux_max_level_data=None, aux_max_level_coord=None)¶
Interpolate data between the same type of monotonic coordinate levels.
- Parameters:
data (
FieldList) – Data to be interpolated. Must have at least two fields.coords (
ArrayLike | FieldList | None) – Vertical coordinates related todata. A valid value must be provided. When it is a FieldList, it must have the same number of fields and levels asdata, but the level ordering can be different. The field values incoordsdefine the vertical coordinate values for each corresponding field indata. The level metadata is only used to pair up the fields incoordsanddata. The vertical coordinate values defined in this way must be monotonic along the vertical axis when sorted by the level (either ascending or descending). When provided as an ArrayLike, it must be a 1D array with each value corresponding to the field at the same position indata.target_coords (
ArrayLike | FieldList | Field | None) – Target coordinate levels to whichdatawill be interpolated. When it is a FieldList or Field each field value provides the coordinate values thedatawill be interpolated to. When provided as an ArrayLike, it must be a 1D array of coordinate values each defining a constant target level. The values must be of the same type of coordinate as that ofcoords.coord_type (
str | None) – Type of the coordinate levels incoordandtarget_coords. The possible values are level types supported in a Field in earthkit.data. See:LevelTypefor details. A valid value must be provided.interpolation (
{"linear", "log", "nearest"}, default"linear") –Interpolation mode. Default is
"linear". Possible values:"linear": linear interpolation between the two nearest levels"log": linear interpolation in logarithm of coordinate"nearest": nearest level interpolation
aux_min_level_data (
float | FieldList | Field | None, optional) – Auxiliary data for interpolation to target levels below the minimum level ofcoordand above aux_min_level_coord. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together withaux_min_level_coord.aux_min_level_coord (
ArrayLike | float | FieldList | Field | None, optional) – Coordinates ofaux_min_level_data. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together withaux_min_level_data.aux_max_level_data (
float | FieldList | Field | None, optional) – Auxiliary data for interpolation to target levels above the maximum level ofcoordand below aux_max_level_coord. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together withaux_max_level_coord.aux_max_level_coord (
ArrayLike | float | FieldList | Field | None, optional) – Coordinates ofaux_max_level_data. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together withaux_max_level_data.
- Returns:
Data interpolated to the target levels. When interpolation is not possible for a given target level, the corresponding output values are set to NaN. The metadata of the output fields are copied from the first field in
dataand updated with the target level type and value.- Return type:
FieldList
Examples