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 to data. If None, the coordinates are extracted from the metadata of the input fields in data. When provided as a FieldList, it must have the same number of fields and levels as data, but the level ordering can be different. In this case the field values define the coordinate values for each field value in data and the level metadata is only used to pair up the fields in coord and data. 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 in data.

  • target_coord (ArrayLike | FieldList | Field | None, optional) – Target coordinate levels to which data will 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 as coord.

  • coord_type (str | None, optional) – Type of the coordinate levels in coord and target_coord. If None, the coordinate type is inferred from the metadata of the input fields in coord. 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 of coord and above aux_min_level_coord. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together with aux_min_level_coord.

  • aux_min_level_coord (ArrayLike | float | FieldList | Field | None, optional) – Coordinates of aux_min_level_data. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together with aux_min_level_data.

  • aux_max_level_data (float | FieldList | Field | None, optional) – Auxiliary data for interpolation to target levels above the maximum level of coord and below aux_max_level_coord. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together with aux_max_level_coord.

  • aux_max_level_coord (ArrayLike | float | FieldList | Field | None, optional) – Coordinates of aux_max_level_data. Can be a number, a single Field or a FieldList containing exactly one Field. Must be provided together with aux_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 data and updated with the target level type and value.

Return type:

FieldList