meteodatalab.operators.vertical_interpolation

Vertical interpolation operators.

Functions

interpolate_k2any(field, mode, tc_field, tc, ...)

Interpolate a field from model levels to coordinates w.r.t.

interpolate_k2p(field, mode, p_field, ...)

Interpolate a field from model (k) levels to pressure coordinates.

interpolate_k2theta(field, mode, th_field, ...)

Interpolate a field from model levels to potential temperature coordinates.

meteodatalab.operators.vertical_interpolation.interpolate_k2any(field: DataArray, mode: Literal['low_fold', 'high_fold'], tc_field: DataArray, tc: TargetCoordinates, h_field: DataArray) DataArray[source]

Interpolate a field from model levels to coordinates w.r.t. an arbitrary field.

Example for vertical interpolation to isosurfaces of a target field that is no monotonic function of height.

Parameters:
  • field (xarray.DataArray) – field to interpolate (only typeOfLevel=”generalVerticalLayer” is supported)

  • mode (str) – interpolation algorithm, one of {“low_fold”, “high_fold”}

  • tc_field (xarray.DataArray) – target field (only typeOfLevel=”generalVerticalLayer” is supported)

  • tc (TargetCoordinates) – target coordinate definition

  • h_field (xarray.DataArray) – height on k levels (only typeOfLevel=”generalVerticalLayer” is supported)

Returns:

field_on_tc – field on target coordinates

Return type:

xarray.DataArray

meteodatalab.operators.vertical_interpolation.interpolate_k2p(field: DataArray, mode: Literal['linear_in_p', 'linear_in_lnp', 'nearest_sfc'], p_field: DataArray, p_tc_values: Sequence[float], p_tc_units: Literal['Pa', 'hPa']) DataArray[source]

Interpolate a field from model (k) levels to pressure coordinates.

Example for vertical interpolation to isosurfaces of a target field, which is strictly monotonically decreasing with height.

Parameters:
  • field (xarray.DataArray) – field to interpolate (only typeOfLevel=”generalVerticalLayer” is supported)

  • mode (str) – interpolation algorithm, one of {“linear_in_p”, “linear_in_lnp”, “nearest_sfc”}

  • p_field (xarray.DataArray) – pressure field on k levels in Pa (only typeOfLevel=”generalVerticalLayer” is supported)

  • p_tc_values (list of float) – pressure target coordinate values

  • p_tc_units (str) – pressure target coordinate units

Returns:

field_on_tc – field on target (i.e., pressure) coordinates

Return type:

xarray.DataArray

meteodatalab.operators.vertical_interpolation.interpolate_k2theta(field: DataArray, mode: Literal['low_fold', 'high_fold', 'undef_fold'], th_field: DataArray, th_tc_values: Sequence[float], th_tc_units: Literal['K', 'cK'], h_field: DataArray) DataArray[source]

Interpolate a field from model levels to potential temperature coordinates.

Example for vertical interpolation to isosurfaces of a target field that is no monotonic function of height.

Parameters:
  • field (xarray.DataArray) – field to interpolate (only typeOfLevel=”generalVerticalLayer” is supported)

  • mode (str) – interpolation algorithm, one of {“low_fold”, “high_fold”, “undef_fold”}

  • th_field (xarray.DataArray) – potential temperature theta on k levels in K (only typeOfLevel=”generalVerticalLayer” is supported)

  • th_tc_values (list of float) – target coordinate values

  • th_tc_units (str) – target coordinate units

  • h_field (xarray.DataArray) – height on k levels (only typeOfLevel=”generalVerticalLayer” is supported)

Returns:

field_on_tc – field on target (i.e., theta) coordinates

Return type:

xarray.DataArray