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¶
Change to the folder containing the project and do
python setup.py install
in the terminal. If you do not have root privileges, you can also do
python setup.py install --user
which will install meteo_si in userbase/lib/pythonX.Y/site-packages or
python setup.py install --home=~
which will install meteo_si in ~/lib/python.
Density¶
Routines to estimate the density of air:
-
meteo_si.density.
moist_rho_rh
(p, T, rh, qm=0)¶ Compute the arithmetic circular mean, ignoring NaNs.
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: Example
moist_rho_rh(p,T,rh,q_ice,q_snow,q_rain,q_cloud,q_graupel,q_hail)
-
meteo_si.density.
moist_rho_q
(p, T, q, qm=0)¶ Compute the arithmetic circular mean, ignoring NaNs.
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: Example
moist_rho_q(p,T,q,q_ice,q_snow,q_rain,q_cloud,q_graupel,q_hail)
Humidity¶
Routines to work with different units of humidity:
-
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:
-
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:
-
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:
-
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 / kg]
Return type:
-
meteo_si.humidity.
rh_to_iwv
(relhum_lev, temp_lev, press_lev, hgt_lev)¶ 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_levels – altitude of levels [m]
Returns: IWV [kg / m^2]
Return type:
-
meteo_si.humidity.
e_sat_gg_ice
(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_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.
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 [kg / kg]
Return type:
-
meteo_si.humidity.
a2rh
(a, T, e_sat_func=<function e_sat_gg_water>)¶ Calculate the absolute humidity from relative humidity, air temperature, and pressure. Source: Kraus, ‘Die Atmosphäre der Erde’, Chapter 8.1.2
Parameters: - a – absolute humidity [kg / kg]
- 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 [kg / kg]
Return type:
Temperature¶
Routines to convert from and to virtual temperature and Celsius.
-
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
-
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.
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.
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
Wind¶
Functions to work 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