easyclimate.physics.moisture.mix#

Mixing Ratio of a Gas

Functions#

calc_mixing_ratio(→ xarray.DataArray)

Calculate the mixing ratio of a gas.

calc_saturation_mixing_ratio(→ xarray.DataArray)

Calculate the saturation mixing ratio of water vapor.

Module Contents#

easyclimate.physics.moisture.mix.calc_mixing_ratio(partial_pressure_data: xarray.DataArray, total_pressure_data: xarray.DataArray, molecular_weight_ratio: float = 0.6219569100577033) xarray.DataArray#

Calculate the mixing ratio of a gas.

This calculates mixing ratio given its partial pressure and the total pressure of the air. There are no required units for the input arrays, other than that they have the same units.

Parameters#

partial_pressure_data: xarray.DataArray.

Partial pressure of the constituent gas.

total_pressure_data: xarray.DataArray.

Total air pressure.

molecular_weight_ratiofloat, optional.

The ratio of the molecular weight of the constituent gas to that assumed for air. Defaults to the ratio for water vapor to dry air (\(\epsilon\approx0.622\)).

Note

The units of partial_pressure_data and total_pressure_data should be the same.

Returns#

The mixing ratio (xarray.DataArray), dimensionless (e.g. Kg/Kg or g/g).

easyclimate.physics.moisture.mix.calc_saturation_mixing_ratio(total_pressure_data: xarray.DataArray, temperature_data: xarray.DataArray, temperature_data_units: Literal['celsius', 'kelvin', 'fahrenheit'], total_pressure_data_units: Literal['hPa', 'Pa', 'mbar']) xarray.DataArray#

Calculate the saturation mixing ratio of water vapor.

This calculation is given total atmospheric pressure and air temperature.

Parameters#

total_pressure_data: xarray.DataArray.

Total atmospheric pressure.

temperature_data: xarray.DataArray.

Atmospheric temperature.

temperature_data_units: str.

The unit corresponding to temperature_data value. Optional values are celsius, kelvin, fahrenheit.

total_pressure_data_units: str.

The unit corresponding to total_pressure_data value. Optional values are hPa, Pa.

Returns#

The saturation mixing ratio (xarray.DataArray), dimensionless.