earthkit.meteo.vertical.fieldlist.interpolate_monotonic¶
- earthkit.meteo.vertical.fieldlist.interpolate_monotonic(data, coord=None, target_coord=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.coord (
ArrayLike | FieldList | None) – Vertical coordinates related todata. If None, the coordinates are extracted from the metadata of the input fields indata. When provided as a FieldList, it must have the same number of fields and levels asdata, but the level ordering can be different. In this case the field values define the coordinate values for each field value indataand the level metadata is only used to pair up the fields incoordanddata. The 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_coord (
ArrayLike | FieldList | Field | None, optional) – Target coordinate levels to whichdatawill be interpolated. When it is a FieldList or Field each field value provide the coordinate values the data` will be interpolated to. When provided as an ArrayLike, it must be a 1D array of coordinate values each defining a constant target level. Must be of the same type and units ascoord.coord_type (
str | None, optional) – Type of the coordinate levels incoordandtarget_coord. If None, the coordinate type is inferred from the metadata of the input fields incoord. The possible values are the same as the level types supported in earthkit.data for a Field. See: :py:earthkit.data.field.component.level_type()for details.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