Welcome to meteo_si’s documentation!

Meteo SI is a collection of routines for atmospheric sciences. Unless noted

otherwise, all units are SI.

Download

The code is available at https://github.com/maahn/meteo_si

Installation

Install the latest release from PyPI

pip install meteo_si

or from conda-forge

conda install conda-forge::meteo_si

or, to install from a local checkout of the source, change to the folder containing the project and do

pip install .

Density

Routines to estimate the density of air:

meteo_si.density.moist_rho_q(p, T, q, qm=0)

Compute the density of moist air from specific humidity.

Parameters:
  • p – Pressure in Pa

  • T – Temperature in K

  • q – specific humidity in kg/kg

  • qm (optional) – sum of mixing ratios in kg/kg of other species which contribute to the air mass! (ice, snow, cloud etc.)

Returns:

Density of moist air [kg/m^3]

Return type:

float

Example

moist_rho_q(p,T,q,q_ice,q_snow,q_rain,q_cloud,q_graupel,q_hail)

meteo_si.density.moist_rho_rh(p, T, rh, qm=0)

Compute the density of moist air from relative humidity.

Parameters:
  • p – Pressure in Pa

  • T – Temperature in K

  • rh – Relative humidity in Pa/Pa

  • qm (optional) – sum of mixing ratios in kg/kg of other species which contribute to the air mass! (ice, snow, cloud etc.)

Returns:

Density of moist air [kg/m^3]

Return type:

float

Example

moist_rho_rh(p,T,rh,q_ice,q_snow,q_rain,q_cloud,q_graupel,q_hail)

Humidity

Routines to work with different units of humidity:

meteo_si.humidity.a2e(a, T)

Calculate water vapor pressure from the absolute humidity and air temperature.

Parameters:
  • a – absolute humidity [kg / m3]

  • T – Temperature in K

Returns:

vapor pressure [Pa]

Return type:

float

meteo_si.humidity.a2rh(a, T, e_sat_func=<function e_sat_gg_water>)

Calculate the relative humidity from absolute humidity and air temperature. Source: Kraus, ‘Die Atmosphäre der Erde’, Chapter 8.1.2

Parameters:
  • a – absolute humidity [kg / m3]

  • T – Temperature in K

  • e_sat_func (func, optional) – Function to estimate the saturation pressure. E.g. e_sat_gg_water for water and e_sat_gg_ice for ice.

Returns:

relative humidity [Pa / Pa]

Return type:

float

meteo_si.humidity.e2a(e, T)

Calculate the absolute humidity from water vapor pressure and air temperature.

Parameters:
  • e – vapor pressure [Pa]

  • T – Temperature in K

Returns:

absolute humidity [kg / m3]

Return type:

float

meteo_si.humidity.e2q(e, p)

Calculate the specific humidity from vapor pressure and air pressure.

Parameters:
  • e – vapor pressure [Pa]

  • p – pressure [Pa]

Returns:

specific humidity [kg / kg]

Return type:

float

meteo_si.humidity.e_sat_gg_ice(T)

Calculates the saturation pressure over ice after “Guide to Meteorological Instruments and Methods of Observation” (CIMO Guide) (WMO, 2008).

Parameters:

T – Temperature in K

Returns:

saturation pressure [Pa]

Return type:

float

meteo_si.humidity.e_sat_gg_water(T)

Calculates the saturation pressure over water after “Guide to Meteorological Instruments and Methods of Observation” (CIMO Guide) (WMO, 2008).

Parameters:

T – Temperature in K

Returns:

saturation pressure [Pa]

Return type:

float

meteo_si.humidity.e_sat_goffgratch_water(T)

Calculates the saturation pressure over water after Goff and Gratch (1946). More accurate than e_sat_gg_water() over a wide temperature range (-90 degC to +80 degC), at the cost of a more expensive formula – the two are not interchangeable results, just two different approximations of the same physical quantity.

Source: Smithsonian Tables 1984, after Goff and Gratch 1946.

Parameters:

T – Temperature in K

Returns:

saturation pressure [Pa]

Return type:

float

meteo_si.humidity.q2e(q, p)

Calculate water vapor pressure from the specific humidity and air pressure.

Parameters:
  • q – specific humidity [kg / kg]

  • p – pressure [Pa]

Returns:

vapor pressure [Pa]

Return type:

float

meteo_si.humidity.q2rh(q, T, p, e_sat_func=<function e_sat_gg_water>)

Calculate relative humidity from specific humidity. Source: Kraus, ‘Die Atmosphäre der Erde’, Chapter 8.1.2

Parameters:
  • q – specific humidity [kg / kg]

  • T – Temperature in K

  • p – pressure [Pa]

  • e_sat_func (func, optional) – Function to estimate the saturation pressure. E.g. e_sat_gg_water for water and e_sat_gg_ice for ice.

Returns:

relative humidity [Pa / Pa]

Return type:

float

meteo_si.humidity.rh2a(rh, T, e_sat_func=<function e_sat_gg_water>)

Calculate the absolute humidity from relative humidity, air temperature, and pressure.

Parameters:
  • rh – Relative humidity in Pa / Pa

  • T – Temperature in K

  • e_sat_func (func, optional) – Function to estimate the saturation pressure. E.g. e_sat_gg_water for water and e_sat_gg_ice for ice.

Returns:

absolute humidity [kg / m3]

Return type:

float

meteo_si.humidity.rh2q(rh, T, p, e_sat_func=<function e_sat_gg_water>)

Calculate the specific humidity from relative humidity, air temperature, and pressure.

Parameters:
  • rh – Relative humidity in Pa / Pa

  • T – Temperature in K

  • p – pressure [Pa]

  • e_sat_func (func, optional) – Function to estimate the saturation pressure. E.g. e_sat_gg_water for water and e_sat_gg_ice for ice.

Returns:

specific humidity [kg / kg]

Return type:

float

meteo_si.humidity.rh_to_iwv(relhum_lev, temp_lev, press_lev, hgt_lev, e_sat_func=<function e_sat_gg_water>)

Integrate relative humidity to obtain the integrated water vapor (IWV) column.

Parameters:
  • relhum_lev – relative humidity at levels humidity [Pa / Pa]

  • temp_lev – Temperature at levels [K]

  • press_lev – pressure at levels [Pa]

  • hgt_lev – altitude of levels [m]

  • e_sat_func (func, optional) – Function to estimate the saturation pressure. E.g. e_sat_gg_water for water and e_sat_gg_ice for ice.

Returns:

IWV [kg / m^2]

Return type:

float

Temperature

Routines to convert from and to virtual temperature and Celsius.

meteo_si.temperature.T_virt_q(T, q)

Calculate the virtual temperature from air temperature and specific humidity.

Parameters:
  • T – Temperature in in K

  • q – specific humidity in kg/kg

Returns:

Virtual temperature in K

Return type:

T_virt

meteo_si.temperature.T_virt_rh(T, rh, p)

Calculate the virtual temperature from air temperature, pressure, and relative humidity.

Parameters:
  • T – Temperature in in K

  • rh – relative humidity in Pa/Pa

  • p – pressure in Pa

Returns:

Virtual temperature in K

Return type:

T_virt

meteo_si.temperature.celsius_to_kelvin(C)

Convert the temperature from Celsius to Kelvin.

Parameters:

C – Temperature in Celsius.

Returns:

Temperature in Kelvin.

Return type:

T

meteo_si.temperature.kelvin_2_celsius(T)

Convert the temperature from Kelvin to Celsius.

Parameters:

T – Temperature in Kelvin.

Returns:

Temperature in Celsius.

Return type:

C

Wind

Functions to work with wind observations.

Functions to deal with wind observations.

meteo_si.wind.circular_mean(angles)

Compute the arithmetic circular mean, not ignoring NaNs.

Parameters:

angles (list or array) – The angles for averaging in radians.

Returns:

mean – The circular mean in radians.

Return type:

float

meteo_si.wind.circular_mean_deg(angles)

Compute the arithmetic circular mean, not ignoring NaNs.

Parameters:

angles (list or array) – The angles for averaging in degrees.

Returns:

mean – The circular mean in degrees.

Return type:

float

meteo_si.wind.nan_circular_mean(angles)

Compute the arithmetic circular mean, ignoring NaNs.

Parameters:

angles (list or array) – The angles for averaging in radians.

Returns:

mean – The circular mean in radians.

Return type:

float

meteo_si.wind.nan_circular_mean_deg(angles)

Compute the arithmetic circular mean, ignoring NaNs.

Parameters:

angles (list or array) – The angles for averaging in degrees.

Returns:

mean – The circular mean in degrees.

Return type:

float

Indices and tables