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 to data. A valid value must be provided. When it is a FieldList, it must have the same number of fields and levels as data, but the level ordering can be different. The field values in coords define the vertical coordinate values for each corresponding field in data. The level metadata is only used to pair up the fields in coords and data. 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 in data.

  • target_coords (ArrayLike | FieldList | Field | None) – Target coordinate levels to which data will be interpolated. When it is a FieldList or Field each field value provides 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. The values must be of the same type of coordinate as that of coords.

  • coord_type (str | None) – Type of the coordinate levels in coord and target_coords. The possible values are level types supported in a Field in earthkit.data. See: LevelType for 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 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

Examples