meteo_utils package

Created on Apr 6 2015 @author: Hector Nieto (hnieto@ias.csic.es)

Modified on feb 3 2016 @author: Hector Nieto (hnieto@ias.csic.es)

DESCRIPTION

This package contains functions for estimating meteorological variables needed in resistance energy balance models.

PACKAGE CONTENTS

pyTSEB.meteo_utils.calc_c_p(p, ea)[source]

Calculates the heat capacity of air at constant pressure.

Parameters:
  • p (float) – total air pressure (dry air + water vapour) (mb).
  • ea (float) – water vapor pressure at reference height above canopy (mb).
Returns:

c_p

Return type:

heat capacity of (moist) air at constant pressure (J kg-1 K-1)

References

based on equation (6.1) from Maarten Ambaum (2010): Thermal Physics of the Atmosphere (pp 109).

pyTSEB.meteo_utils.calc_lambda(T_A_K)[source]

Calculates the latent heat of vaporization.

Parameters:T_A_K (float) – Air temperature (Kelvin).
Returns:Lambda – Latent heat of vaporisation (J kg-1).
Return type:float

References

based on Eq. 3-1 Allen FAO98

pyTSEB.meteo_utils.calc_pressure(z)[source]

Calculates the barometric pressure above sea level.

Parameters:z (float) – height above sea level (m).
Returns:p – air pressure (mb).
Return type:float
pyTSEB.meteo_utils.calc_psicr(c_p, p, Lambda)[source]

Calculates the psicrometric constant.

Parameters:
  • c_p (float) – heat capacity of (moist) air at constant pressure (J kg-1 K-1).
  • p (float) – atmopheric pressure (mb).
  • Lambda (float) – latent heat of vaporzation (J kg-1).
Returns:

psicr – Psicrometric constant (mb C-1).

Return type:

float

pyTSEB.meteo_utils.calc_rho(p, ea, T_A_K)[source]

Calculates the density of air.

Parameters:
  • p (float) – total air pressure (dry air + water vapour) (mb).
  • ea (float) – water vapor pressure at reference height above canopy (mb).
  • T_A_K (float) – air temperature at reference height (Kelvin).
Returns:

rho – density of air (kg m-3).

Return type:

float

References

based on equation (2.6) from Brutsaert (2005): Hydrology - An Introduction (pp 25).

pyTSEB.meteo_utils.calc_rho_w(T_K)[source]

density of air-free water ata pressure of 101.325kPa :param T_K: :return: density of water (kg m-3)

pyTSEB.meteo_utils.calc_stephan_boltzmann(T_K)[source]

Calculates the total energy radiated by a blackbody.

Parameters:T_K (float) – body temperature (Kelvin)
Returns:M – Emitted radiance (W m-2)
Return type:float
pyTSEB.meteo_utils.calc_theta_s(xlat, xlong, stdlng, doy, year, ftime)[source]

Calculates the Sun Zenith Angle (SZA).

Parameters:
  • xlat (float) – latitude of the site (degrees).
  • xlong (float) – longitude of the site (degrees).
  • stdlng (float) – central longitude of the time zone of the site (degrees).
  • doy (float) – day of year of measurement (1-366).
  • year (float) – year of measurement .
  • ftime (float) – time of measurement (decimal hours).
Returns:

theta_s – Sun Zenith Angle (degrees).

Return type:

float

References

Adopted from Martha Anderson’s fortran code for ALEXI which in turn was based on Cupid.

pyTSEB.meteo_utils.calc_sun_angles(lat, lon, stdlon, doy, ftime)[source]

Calculates the Sun Zenith and Azimuth Angles (SZA & SAA).

Parameters:
  • lat (float) – latitude of the site (degrees).
  • long (float) – longitude of the site (degrees).
  • stdlng (float) – central longitude of the time zone of the site (degrees).
  • doy (float) – day of year of measurement (1-366).
  • ftime (float) – time of measurement (decimal hours).
Returns:

  • sza (float) – Sun Zenith Angle (degrees).
  • saa (float) – Sun Azimuth Angle (degrees).

pyTSEB.meteo_utils.calc_vapor_pressure(T_K)[source]

Calculate the saturation water vapour pressure.

Parameters:T_K (float) – temperature (K).
Returns:ea – saturation water vapour pressure (mb).
Return type:float
pyTSEB.meteo_utils.calc_delta_vapor_pressure(T_K)[source]

Calculate the slope of saturation water vapour pressure.

Parameters:T_K (float) – temperature (K).
Returns:s – slope of the saturation water vapour pressure (kPa K-1)
Return type:float
pyTSEB.meteo_utils.calc_mixing_ratio(ea, p)[source]

Calculate ratio of mass of water vapour to the mass of dry air (-)

Parameters:
  • ea (float or numpy array) – water vapor pressure at reference height (mb).
  • p (float or numpy array) – total air pressure (dry air + water vapour) at reference height (mb).
Returns:

r – mixing ratio (-)

Return type:

float or numpy array

pyTSEB.meteo_utils.calc_lapse_rate_moist(T_A_K, ea, p)[source]

Calculate moist-adiabatic lapse rate (K/m)

Parameters:
  • T_A_K (float or numpy array) – air temperature at reference height (K).
  • ea (float or numpy array) – water vapor pressure at reference height (mb).
  • p (float or numpy array) – total air pressure (dry air + water vapour) at reference height (mb).
Returns:

Gamma_w – moist-adiabatic lapse rate (K/m)

Return type:

float or numpy array

pyTSEB.meteo_utils.flux_2_evaporation(flux, t_k=293.15, time_domain=1)[source]

Converts heat flux units (W m-2) to evaporation rates (mm time-1) to a given temporal window

Parameters:
  • flux (float or numpy array) – heat flux value to be converted, usually refers to latent heat flux LE to be converted to ET
  • T_K (float or numpy array) – environmental temperature in Kelvin. Default=20 Celsius
  • time_domain (float) – Temporal window in hours. Default 1 hour (mm h-1)
Returns:

et – evaporation rate at the time_domain. Default mm h-1

Return type:

float or numpy array