improver.psychrometric_calculations.precipitable_water module#

Module to generate precipitable water

class PrecipitableWater[source]#

Bases: BasePlugin

Plugin to calculate precipitable water from a humidity mixing ratio cube.

This plugin integrates the humidity mixing ratio over pressure levels to compute the precipitable water in metres. It assumes pressure levels are in Pascals and uses constants for gravity and water density to convert the result into liquid water equivalent thickness.

_abc_impl = <_abc._abc_data object>#
calculate_layer_bounds(sorted_pressure)[source]#

Calculate pressure layer boundaries from a 1D array of pressure levels.

This method estimates the boundaries between pressure levels by computing midpoints between adjacent levels. It assumes that the topmost and bottommost layers are half as thick as the internal layers, and extrapolates their bounds accordingly.

Parameters:

sorted_pressure (ndarray) – 1D array of pressure levels in Pascals.

Return type:

ndarray

Returns:

1D array of pressure layer boundaries in Pascals.

static calculate_precipitable_water(humidity_data, delta_p)[source]#

Calculate precipitable water using sorted humidity data and pressure thickness.

Parameters:
  • humidity_data (ndarray) – Humidity mixing ratio data sorted by pressure levels.

  • delta_p (ndarray) – Pressure thickness values reshaped to match the data dimensions.

Return type:

ndarray

Returns:

Array of precipitable water values in metres.

static calculate_pressure_thickness(layer_bounds, cube_data)[source]#

Calculate the pressure thickness of each atmospheric layer.

Parameters:
  • layer_bounds (ndarray) – 1D array of pressure layer boundaries in Pascals.

  • cube_data (ndarray) – N-dimensional array of humidity mixing ratio values.

Return type:

ndarray

Returns:

N-dimensional array of pressure thickness values reshaped to match the dimensions of the input data.

process(humidity_mixing_ratio_cube)[source]#

Calculate precipitable water on pressure levels.

Parameters:

humidity_mixing_ratio_cube (Cube) – Cube containing humidity mixing ratio data with pressure levels.

Return type:

Cube

Returns:

Cube containing precipitable water in metres, with updated metadata, on pressure levels.

ensure_no_float_64(cube)[source]#

Convert float64 data and coordinates in the cube to float32 to ensure workflow compatibility.

Return type:

Cube