improver.psychrometric_calculations.wet_bulb_temperature module

Module to contain wet-bulb temperature plugins.

class WetBulbTemperature(precision=0.005, model_id_attr=None)[source]

Bases: BasePlugin

A plugin to calculate wet bulb temperatures from air temperature, relative humidity, and pressure data. Calculations are performed using a Newton iterator, with saturated vapour pressures drawn from a lookup table using linear interpolation.

The svp_table used in this plugin is imported (see top of file). It is a table of saturated vapour pressures calculated for a range of temperatures. The import also brings in attributes that describe the range of temperatures covered by the table and the increments in the table.

References

Met Office UM Documentation Paper 080, UM Version 10.8, last updated 2014-12-05.

__init__(precision=0.005, model_id_attr=None)[source]

Initialise class.

Parameters:
  • precision (float) – The precision to which the Newton iterator must converge before returning wet bulb temperatures.

  • model_id_attr (str) – Name of the attribute used to identify the source model for blending.

_abc_impl = <_abc_data object>
static _calculate_enthalpy(mixing_ratio, specific_heat, latent_heat, temperature)[source]

Calculate the enthalpy (total energy per unit mass) of air (J kg-1).

Method from referenced UM documentation.

References

Met Office UM Documentation Paper 080, UM Version 10.8, last updated 2014-12-05.

Parameters:
  • mixing_ratio (ndarray) – Array of mixing ratios.

  • specific_heat (ndarray) – Array of specific heat capacities of moist air (J kg-1 K-1).

  • latent_heat (ndarray) – Array of latent heats of condensation of water vapour (J kg-1).

  • temperature (ndarray) – Array of air temperatures (K).

Return type:

ndarray

Returns:

Array of enthalpy values calculated at the same points as the input cubes (J kg-1).

static _calculate_enthalpy_gradient(mixing_ratio, specific_heat, latent_heat, temperature)[source]

Calculate the enthalpy gradient with respect to temperature.

Method from referenced UM documentation.

Parameters:
  • mixing_ratio (ndarray) – Array of mixing ratios.

  • specific_heat (ndarray) – Array of specific heat capacities of moist air (J kg-1 K-1).

  • latent_heat (ndarray) – Array of latent heats of condensation of water vapour (J kg-1).

  • temperature (ndarray) – Array of temperatures (K).

Return type:

ndarray

Returns:

Array of the enthalpy gradient with respect to temperature.

static _calculate_specific_heat(mixing_ratio)[source]

Calculate the specific heat capacity for moist air by combining that of dry air and water vapour in proportion given by the specific humidity.

Parameters:

mixing_ratio (ndarray) – Array of specific humidity (fractional).

Return type:

ndarray

Returns:

Specific heat capacity of moist air (J kg-1 K-1).

_calculate_wet_bulb_temperature(pressure, relative_humidity, temperature)[source]

Calculate an array of wet bulb temperatures from inputs in the correct units.

A Newton iterator is used to minimise the gradient of enthalpy against temperature. Assumes that the variation of latent heat with temperature can be ignored.

Parameters:
  • pressure (ndarray) – Array of air Pressure (Pa).

  • relative_humidity (ndarray) – Array of relative humidities (1).

  • temperature (ndarray) – Array of air temperature (K).

Return type:

ndarray

Returns:

Array of wet bulb temperature (K).

static _slice_inputs(temperature, relative_humidity, pressure)[source]

Create iterable or iterator over cubes on which to calculate wet bulb temperature

create_wet_bulb_temperature_cube(temperature, relative_humidity, pressure)[source]

Creates a cube of wet bulb temperature values

Parameters:
  • temperature (Cube) – Cube of air temperatures.

  • relative_humidity (Cube) – Cube of relative humidities.

  • pressure (Cube) – Cube of air pressures.

Return type:

Cube

Returns:

Cube of wet bulb temperature (K).

process(cubes)[source]

Call the calculate_wet_bulb_temperature function to calculate wet bulb temperatures. This process function splits input cubes over vertical levels to mitigate memory issues when trying to operate on multi-level data.

Parameters:

cubes (Union[List[Cube], CubeList]) –

containing:
temperature:

Cube of air temperatures.

relative_humidity:

Cube of relative humidities.

pressure:

Cube of air pressures.

Return type:

Cube

Returns:

Cube of wet bulb temperature (K).

class WetBulbTemperatureIntegral(model_id_attr=None)[source]

Bases: BasePlugin

Calculate a wet-bulb temperature integral.

__init__(model_id_attr=None)[source]

Initialise class.

_abc_impl = <_abc_data object>
process(wet_bulb_temperature)[source]

Calculate the vertical integral of wet bulb temperature from the input wet bulb temperatures on height levels.

Parameters:

wet_bulb_temperature (Cube) – Cube of wet bulb temperatures on height levels.

Return type:

Cube

Returns:

Cube of wet bulb temperature integral (Kelvin-metres).