Humidity functions¶
The CalcHums module contains a set of functions for calculating humidity variables.
At present, it can only cope with scalars, not arrays.
There are routines for: specific humidity from dew point temperature and temperature and pressure vapour pressure from dew point temperature and temperature and pressure relative humidity from dew point temperature and temperature and pressure wet bulb temperature from dew point temperature and temperature and pressure dew point depression from dew point temperature and temperature
There are also routines for: vapour pressure from specific humidity and pressure and temperature dew point temperature from vapour pressure and temperature and pressure relative humidity from vapour pressure and temperature and pressure wet bulb temperature from vapour pressure and dew point temperature and temperature (and pressure?)
Where vapour pressure is used as part of the equation a pseudo wet bulb temperature is calculated. If this is at or below 0 deg C then the ice bulb equation is used.
ALL NUMBERS ARE RETURNED TO ONE SIGNIFICANT DECIMAL FIGURE.
THIS ROUTINE CANNOT COPE WITH MISSING DATA
THIS ROUTINE HAS a roundit=True/False. The default is True - round to one decimal place. Otherwise - set roundit=False
Written by Kate Willett 7th Feb 2016
- marine_qc.calculate_humidity.dpd(td, t, roundit=True)[source]
Calculate dew point depression from dew point temperature and dry bulb temperature.
- Parameters:
- Return type:
- Returns:
float– Dew point depression in degrees C (array or scalar).
Notes
Ref:
TESTED! dpd = dpd(10..,15.) dpd = 5.0
- marine_qc.calculate_humidity.rh(td, t, p, roundit=True)[source]
Calculate relative humidity from dew point temperature, dry bulb temperature and pressure.
It calculates the saturated vapour pressure from t. It requires a sea (station actually but sea level ok for marine data) level pressure value. This can be a scalar or an array, even if vapour pressure is an array (CHECK). To test whether to apply the ice or water calculation a dewpoint and dry bulb temperature are needed. We can assume that the dry bulb t is the same as the wet bulb t at saturation. This allows calculation of a pseudo-wet bulb temperature (imprecise) first. If the wet bulb temperature is at or below 0 deg C then the ice calculation is used.
- Parameters:
td (
float) – Dew point temperature in degrees C (array or scalar).t (
float) – Dry bulb temperature in degrees C (array or scalar).p (
float) – Pressure at observation level in hPa (array or scalar - can be scalar even if others are arrays).roundit (
bool) – Flag to tell function to round to one decimal place, default TRUE.
- Return type:
- Returns:
float– Relative humidity in %rh (array or scalar).
Notes
Ref:
TESTED! rh = rh(10.,15.,1013.) rh = 72.0
- marine_qc.calculate_humidity.sh(td, t, p, roundit=True)[source]
Calculate specific humidity dew point temperature, dry bulb temperature and pressure.
It requires a sea (station actually but sea level ok for marine data) level pressure value. This can be a scalar or an array, even if vapour pressure is an array (CHECK).
- Parameters:
td (
float) – Dew point temperature in degrees C (array or scalar).t (
float) – Dry bulb temperature in degrees C (array or scalar).p (
float) – Pressure at observation level in hPa (array or scalar - can be scalar even if others are arrays).roundit (
bool) – Flag to tell function to round to one decimal place, default TRUE.
- Return type:
- Returns:
float– Specific humidity in g/kg (array or scalar).
Notes
Peixoto & Oort, 1996, Ross & Elliott, 1996 Peixoto, J. P. and Oort, A. H.: The climatology of relative humidity in the atmosphere, J. Climate, 9, 3443?3463, 1996.
TESTED! sh = sh(10.,15.,1013.) sh = 7.6
- marine_qc.calculate_humidity.sh_from_vap(e, p, roundit=True)[source]
Calculate specific humidity from vapour pressure and pressure.
It requires a sea (station actually but sea level ok for marine data) level pressure value. This can be a scalar or an array, even if vapour pressure is an array (CHECK).
- Parameters:
- Return type:
- Returns:
float– Specific humidity in g/kg (array or scalar).
Notes
Peixoto & Oort, 1996, Ross & Elliott, 1996 Peixoto, J. P. and Oort, A. H.: The climatology of relative humidity in the atmosphere, J. Climate, 9, 3443?3463, 1996.
TESTED! sh = sh(10.,15.,1013.) sh = 7.6
- marine_qc.calculate_humidity.td_from_vap(e, p, t, roundit=True)[source]
Calculate dew point depression from vapour pressure, pressure and dry bulb temperature.
It also requires temperature to check whether the wet bulb temperature is <= 0.0 - if so the ice bulb calculation is used.
- Parameters:
e (
float) – Vapour pressure in hPa (array or scalar).p (
float) – Pressure at observation level in hPa (array or scalar - can be scalar even if others are arrays).t (
float) – Dry bulb temperature in degrees C (array or scalar).roundit (
bool) – Flag to tell function to round to one decimal place, default TRUE.
- Return type:
- Returns:
float– Dew point depression in degrees C (array or scalar).
Notes
Buck 1981 Buck, A. L.: New equations for computing vapor pressure and enhancement factor, J. Appl. Meteorol., 20, 1527?1532, 1981. Jenson et al. 1990 Jensen, M. E., Burman, R. D., and Allen, R. G. (Eds.): Evapotranspiration and Irrigation Water Requirements: ASCE Manuals and Reports on Engineering Practices No. 70, American Society of Civil Engineers, New York, 360 pp., 1990.
TESTED! td = td_from_vap(12.3,1013.,15.) td = 10.0
- marine_qc.calculate_humidity.vap(td, t, p, roundit=True)[source]
Calculate vapour pressure from dew point temperature, dry bulb temperature and pressure.
It requires a sea (station actually but sea level ok for marine data) level pressure value. This can be a scalar or an array, even if dewpoint temperature is an array (CHECK). To test whether to apply the ice or water calculation a dry bulb temperature is needed. This allows calculation of a pseudo-wet bulb temperature (imprecise) first. If the wet bulb temperature is at or below 0 deg C then the ice calculation is used.
- Parameters:
td (
float) – Dew point temperature in degrees C (array or scalar).t (
float) – Dry bulb temperature in degrees C (array or scalar).p (
float) – Pressure at observation level in hPa (array or scalar - can be scalar even if others are arrays).roundit (
bool) – Flag to tell function to round to one decimal place, default TRUE.
- Return type:
- Returns:
float– Vapour pressure in hPa (array or scalar).
Notes
Buck 1981 Buck, A. L.: New equations for computing vapor pressure and enhancement factor, J. Appl. Meteorol., 20, 1527?1532, 1981. Jenson et al. 1990 Jensen, M. E., Burman, R. D., and Allen, R. G. (Eds.): Evapotranspiration and Irrigation Water Requirements: ASCE Manuals and Reports on Engineering Practices No. 70, American Society of Civil Engineers, New York, 360 pp., 1990.
TESTED! e = vap(10.,15.,1013.) e = 12.3
- marine_qc.calculate_humidity.vap_from_sh(sh, p, roundit=True)[source]
Calculate vapour pressure from specific humidity and pressure.
It requires a sea (station actually but sea level ok for marine data) level pressure value. This can be a scalar or an array, even if specific humidity is an array (CHECK).
- Parameters:
- Return type:
- Returns:
float– Vapour pressure in hPa (array or scalar).
Notes
Peixoto & Oort, 1996, Ross & Elliott, 1996 Peixoto, J. P. and Oort, A. H.: The climatology of relative humidity in the atmosphere, J. Climate, 9, 3443?3463, 1996.
TESTED! e = vap_from_sh(7.6,1013.) e = 12.3
- marine_qc.calculate_humidity.wb(td, t, p, roundit=True)[source]
Calculate wet bulb temperature from dew point temperature, dry bulb temperature and pressure.
It requires a sea (station actually but sea level ok for marine data) level pressure value. This can be a scalar or an array, even ifvapour pressure is an array (CHECK). To test whether to apply the ice or water calculation a dewpoint and dry bulb temperature are needed. This allows calculation of a pseudo-wet bulb temperature (imprecise) first. If the wet bulb temperature is at or below 0 deg C then the ice calculation is used.
- Parameters:
td (
float) – Dew point temperature in degrees C (array or scalar).t (
float) – Dry bulb temperature in degrees C (array or scalar).p (
float) – Pressure at observation level in hPa (array or scalar - can be scalar even if others are arrays).roundit (
bool) – Flag to tell function to round to one decimal place, default TRUE.
- Return type:
- Returns:
float– Wet bulb temperature in degrees C (array or scalar).
Notes
Ref: Jenson et al. 1990 Jensen, M. E., Burman, R. D., and Allen, R. G. (Eds.): Evapotranspiration and Irrigation Water Requirements: ASCE Manuals and Reports on Engineering Practices No. 70, American Society of Civil Engineers, New York, 360 pp., 1990.
TESTED! wb = wb(10.,15.,1013) wb = 12.2