improver.psychrometric_calculations.air_density module#

Plugin to calculate air density from virtual temperature.

class AirDensity[source]#

Bases: BasePlugin

Calculate air density from virtual temperature.

_abc_impl = <_abc._abc_data object>#
_get_pressure_cube(cubes)[source]#

Extract pressure cube if present.

Return type:

Cube

_get_temperature_cube(cubes)[source]#

Extract virtual temperature cube.

Return type:

Cube

process(inputs)[source]#

Calculate air density from virtual temperature.

If an explicit pressure cube is provided the pressure is taken from here. Otherwise the virtual temperature cube needs to be on pressure levels. The cube arguments are not checked explicitly for conformant dimensions but must have the same shape.

Air Density Calculation#

Density is calculated using the Ideal Gas Law equation of state with moisture effects included via the virtual temperature calculation.

\[\rho=\frac{p}{R_d T_v}\]

where:

\(\rho\) = air density (kgm⁻³)

\(p\) = pressure (Pa)

\(R_d\) = gas constant for dry air = 287.05 Jkg⁻¹K⁻¹ (See R_DRY_AIR constant in IMPROVER.constants)

\(T_v\) = virtual temperature (K), which needs calculating

Key interpretation#

If temperature goes up, density goes down.

If moisture goes up, density goes down [*]

If pressure goes up, density goes up.

type inputs:

Union[Cube, CubeList]

param inputs:

Either: - A single Cube (virtual temperature), or - A CubeList containing virtual temperature and optionally pressure.

rtype:

Cube

returns:

Cube containing air density (kg m-3) on the same grid/levels as virtual temmperature