earthkit.meteo.vertical.array.interpolate_hybrid_to_pressure_levels

earthkit.meteo.vertical.array.interpolate_hybrid_to_pressure_levels(data, target_p, sp, A, B, alpha_top='ifs', interpolation='linear', aux_bottom_data=None, aux_bottom_p=None, aux_top_data=None, aux_top_p=None, vertical_dim=0)

Interpolate data from hybrid full-levels (IFS model levels) to pressure levels.

New in version 1.0.0

Parameters:
  • data (ArrayLike) – Data to be interpolated. The axis corresponding to the vertical coordinate (hybrid levels) is defined by the vertical_dim parameter. Must have at least two levels. Levels must be ordered in ascending order with respect to the model level number. By convention, model level numbering starts at 1 at the top of the atmosphere and increases towards the surface. Not all the levels must be present, but a contiguous level range including the bottom-most level must be used. E.g. if the vertical coordinate system has 137 model levels using only a subset of levels between e.g. 137-96 is allowed.

  • target_p (ArrayLike) – Target pressure levels (Pa) to which data will be interpolated. It can be either a scalar or a 1D array of pressure levels. Alternatively, it can be a multidimensional array with a vertical axis defined by vertical_dim. In this case the other axes/dimensions must match those of data.

  • sp (ArrayLike) – Surface pressure (Pa). The shape must be compatible with the non-vertical dimensions of data.

  • A (ArrayLike) – A-coefficients defining the hybrid levels. Must contain all the half-levels in ascending order with respect to the model level number. See hybrid_level_parameters() for details.

  • B (ArrayLike) – B-coefficients defining the hybrid levels. Must contain all the half-levels in ascending order with respect to the model level number. Must have the same size as A. See hybrid_level_parameters() for details.

  • alpha_top ({"ifs", "arpege"}, default "ifs") – Option to initialise the alpha parameters on the top of the model atmosphere (first half-level in the vertical coordinate system). See pressure_on_hybrid_levels() for details.

  • interpolation ({"linear", "log", "nearest"}, default "linear") –

    Interpolation mode. Default is “linear”. Possible values are:

    • ”linear”: linear interpolation in pressure between the two nearest levels

    • ”log”: linear interpolation in logarithm of pressure between the two nearest levels

    • ”nearest”: nearest level interpolation

  • aux_bottom_data (ArrayLike|None) – Auxiliary data for interpolation to targets below the bottom hybrid full-level and above the level specified by aux_bottom_p. Can be a scalar or must have the same shape as a single level of data.

  • aux_bottom_p (ArrayLike|None) – Pressures (Pa) of aux_bottom_data. Can be a scalar or must have the same shape as a single level of data.

  • aux_top_data (ArrayLike|None) – Auxiliary data for interpolation to targets above the top hybrid full-level and below the level specified by aux_top_p. Can be a scalar or must have the same shape as a single level of data.

  • aux_top_p (ArrayLike|None) – Pressures (Pa) of aux_top_data. Can be a scalar or must have the same shape as a single level of data.

  • vertical_dim (int) – Axis corresponding to the vertical coordinate (hybrid full-levels) in the input arrays and also in the output array. Default is 0 (first axis).

Returns:

Data interpolated to the target levels. The shape depends on the shape of target_p. The axis corresponding to the vertical coordinate (hybrid levels) is defined by the vertical_dim parameter. When interpolation is not possible for a given target pressure level (e.g., when the target pressure is outside the available pressure range), the corresponding output values are set to nan.

Return type:

ArrayLike

Raises:
  • ValueError – If data has less than two levels.

  • ValueError – If the first dimension of data and that of target_p do not match.

Examples

  • /how-tos/interpolate_hybrid_to_pl.ipynb