earthkit.meteo.vertical.array.interpolate_pressure_to_height_levels¶
- earthkit.meteo.vertical.array.interpolate_pressure_to_height_levels(data, target_h, z, zs=None, h_type='geometric', h_reference='ground', interpolation='linear', aux_bottom_data=None, aux_bottom_h=None, aux_top_data=None, aux_top_h=None, vertical_dim=0)¶
Interpolate data from pressure levels to height levels.
New in version 1.0.0
- Parameters:
data (
ArrayLike) – Data to be interpolated. The axis corresponding to the vertical coordinate (pressure levels) is defined by thevertical_dimparameter. Must have at least two levels. Levels must be ordered in ascending or descending order with respect to pressure (i.e. monotonic).target_h (
ArrayLike) – Target height levels (m) to whichdatawill be interpolated. It can be either a scalar or a 1D array of height 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 ofdata. The type of the height and the reference level are defined byh_typeandh_reference.z (
ArrayLike) – Geopotential (m2/s2) on the same pressure levels asdata.zs (
ArrayLike|None) – Surface geopotential (m2/s2). The shape must be compatible with the non-vertical dimensions ofdataandz. Only used when andh_referenceis “ground”.h_type (
{"geometric", "geopotential"}, default"geometric") –Type of height to compute. Possible values are:
”geometric”: geometric height (m) with respect to
h_reference”geopotential”: geopotential height (m) with respect to
h_referenceDefault is “geometric”. Seegeometric_height_from_geopotential()andgeopotential_height_from_geopotential()for details.
h_reference (
{"ground", "sea"}, default"ground") –Reference level for the height calculation. Default is “ground”. Possible values are:
”ground”: height with respect to the ground/surface level
”sea”: height with respect to the sea level
interpolation (
{"linear", "log", "nearest"}, default"linear") –Interpolation mode. Default is “linear”. Possible values are:
”linear”: linear interpolation in height between the two nearest levels
”log”: linear interpolation in logarithm of height between the two nearest levels
”nearest”: nearest level interpolation
aux_bottom_data (
ArrayLike|None, optional) – Auxiliary data for interpolation to heights between the bottom pressure level andaux_bottom_h. Can be a scalar or must have the same shape as a single level ofdata.aux_bottom_h (
ArrayLike|None, optional) – Heights (m) ofaux_bottom_data. Can be a scalar or must have the same shape as a single level ofdata. The type of the height and the reference level are defined byh_typeandh_reference.aux_top_data (
ArrayLike|None, optional) – Auxiliary data for interpolation to heights between the top pressure level andaux_top_h. Can be a scalar or must have the same shape as a single level ofdata.aux_top_h (
ArrayLike|None, optional) – Heights (m) ofaux_top_data. Can be a scalar or must have the same shape as a single level ofdata. The type of the height and the reference level are defined byh_typeandh_reference.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 height levels. The shape depends on the shape of
target_h. The axis corresponding to the vertical coordinate (height levels) is defined by thevertical_dimparameter. When interpolation is not possible for a given target height level (e.g., when the target height is outside the available height range), the corresponding output values are set to nan.- Return type:
ArrayLike- Raises:
ValueError – If
datahas less than two levels.ValueError – If the first dimension of
dataand that oftarget_hdo not match.
See also
Examples
/how-tos/interpolate_pl_to_hl.ipynb