brightwind.analyse.analyse.calc_air_density¶
-
brightwind.analyse.analyse.
calc_air_density
(temperature, pressure, elevation_ref=None, elevation_site=None, lapse_rate=-0.113, specific_gas_constant=286.9)¶ Calculates air density for a given temperature and pressure and extrapolates that to the site if both reference and site elevations are given.
- Parameters
temperature (float or pandas.Series or pandas.DataFrame) – Temperature values in degree Celsius
pressure (float or pandas.Series or pandas.DataFrame) – Pressure values in hectopascal, hPa, (1,013.25 hPa = 101,325 Pa = 101.325 kPa = 1 atm = 1013.25 mbar)
elevation_ref (Floating point value (decimal number)) – Elevation, in meters, of the reference temperature and pressure location.
elevation_site (Floating point values (decimal number)) – Elevation, in meters, of the site location to calculate air density for.
lapse_rate (Floating point value (decimal number)) – Air density lapse rate kg/m^3/km, default is -0.113
specific_gas_constant (Floating point value (decimal number)) – Specific gas constant, R, for humid air J/(kg.K), default is 286.9
- Returns
Air density in kg/m^3
- Return type
float or pandas.Series depending on the input
Example usage
- ::
import brightwind as bw
#For a series of air densities data = bw.load_campbell_scientific(bw.datasets.demo_campbell_scientific_site_data) air_density = bw.calc_air_density(data.T2m, data.P2m)
#For a single value bw.calc_air_density(15, 1013)
#For a single value with ref and site elevation bw.calc_air_density(15, 1013, elevation_ref=0, elevation_site=200)