API Reference#
molecularprofiles.molecularprofiles#
Provides MolecularProfile class, a main entry point for meteorological data analysis.
The molecular absorption cross sections have been retrieved from the HITRAN2020 database.
- class molecularprofiles.molecularprofiles.MolecularProfile(data_file: str, stat_columns: list[str] = None)#
A class for analyzing meteorological data and generating atmospheric profiles.
This class provides methods for retrieving meteorological data from various file formats, creating molecular number density profiles, computing mass density, and calculating the refractive index based on atmospheric conditions. It supports output in
ecsvformat.Methods
get_data()
Read and preprocess meteorological data from a specified file.
create_atmospheric_profile(co2_concentration, outfile, reference_atmosphere, altitude_list)
Generate a table with atmospheric parameters compatible with CORSIKA simulations and optionally write to a file.
create_molecular_density_profile(mdp_file)
Calculate molecular number density per altitude and optionally write to a file.
create_rayleigh_extinction_profile(co2_concentration, wavelength_min, wavelength_max, rayleigh_extinction_file, reference_atmosphere, rayleigh_scattering_altitude_bins)
Calculate the altitude profile of the optical depth due to Rayleigh scattering for a given range of wavelengths and optionally write to a file.
create_molecular_absorption_profile(molecule_name, molecular_cross_section_file, wavelength_min, wavelength_max, molar_mass, molecular_absorption_file, altitude_bins)
Calculate the altitude profile of the molecular absorption for a given range of wavelengths and optionally write to a file.
create_refractive_index_profile(wavelength_min, wavelength_max, refractive_index_file)
Calculate the refractive index profile for a given range of wavelengths and optionally write to a file.
convert_to_simtel_compatible(input_ecsv_file, output_file, observation_altitude)
Convert the extinction or absorption profile to a format compatible with simtelarray.
- __init__(data_file: str, stat_columns: list[str] = None)#
Initialize an instance of the MolecularProfile class.
- Parameters:
- data_filestr
The path to the txt file containing the data.
- stat_columnslist of str, optional
A list of column names for statistical data. The default columns are Pressure, Altitude, Density, Temperature, Wind Speed, Wind Direction, Relative humidity, Exponential Density, and Ozone mass mixing ratio.
- Attributes:
- data_filestr
The path to the data file provided during initialization.
- dataastropy.Table or None
The main data table, initially set to None.
- stat_dataastropy.Table or None
A table for statistical data, initially set to None.
- stat_descriptiondict of str: astropy.Table or None
A dictionary mapping statistical descriptions to their respective tables, initially set to None.
- stat_columnslist of str
The list of column names for statistical data.
- get_data() None#
Read and preprocesses meteorological data from a specified file.
This method reads meteorological data from the file specified by self.data_file. It supports reading data in either ECMWF/GDAS grib (versions 1 and 2) or ECSV formats. For grib files, it extracts the data using a dedicated method and extends it with additional processing. For ECSV files, it directly reads the data into an Astropy Table. After reading the data, it computes a statistical description of selected columns grouped by pressure.
- Raises:
- FileNotFoundError
If the specified data file does not exist.
- NotImplementedError
If the file format is neither grib (1 or 2) nor ECSV, indicating that the format is not supported.
Notes
The method updates the instance attributes self.data with the ingested data table, self.stat_data with the data table grouped by pressure, and self.stat_description with statistical descriptions (average, standard deviation, mean absolute deviation, peak-to-peak max, and peak-to-peak min) of the grouped data.
- create_atmospheric_profile(co2_concentration: float, outfile: str | None = None, reference_atmosphere: ~astropy.table.table.Table | str | None = None, altitude_list: ~astropy.units.quantity.Quantity = <Quantity [ 0., 1000., 2000., 3000., 4000., 5000., 6000., 7000., 8000., 9000., 10000., 11000., 12000., 13000., 14000., 15000., 16000., 17000., 18000., 19000., 20000., 21000., 22000., 23000., 24000., 25000., 26000., 27000., 28000., 29000., 30000., 32000., 34000., 36000., 38000., 40000., 42000., 44000., 46000., 48000., 50000., 55000., 60000., 65000., 70000., 75000., 80000., 85000., 90000., 95000., 100000., 105000., 110000., 115000., 120000.] m>) Table#
Generate a table with atmospheric parameters for CORSIKA simulations.
This method computes atmospheric parameters at specified altitudes and optionally writes them to an ECSV file. The table includes altitude, density, thickness, refractive index minus one, temperature, pressure, and partial water vapor pressure at each altitude step.
The table includes the following columns:
altitude: Altitude in kilometers. Computed atmospheric parameters are provided at these altitudes.atmospheric_density: Atmospheric density in grams per cubic centimeter.atmospheric_thickness: Atmospheric thickness in grams per square centimeter. This is calculated from pressure divided by the standard gravitational acceleration.refractive_index_m_1: Relative refractive index minus one. This is calculated based on pressure, temperature, relative humidity, a wavelength of 350 nm, and CO2 concentration.temperature: Temperature in Kelvins at the specified altitude.pressure: Pressure in hPa at the specified altitude.partial_water_pressure: Partial water vapor pressure in the same units as pressure, normalized by total pressure.
- Parameters:
- co2_concentrationfloat
The CO2 concentration value to use in the atmospheric model converted to ppm.
- outfileOptional[str], default=None
The path and name of the output file. If None, the method will not write to a file but will still return the table.
- reference_atmosphereTable | str | None, default=None
The reference atmosphere data, which can be provided as an Astropy Table or a file path to an ECSV file, This is used to extend or fill in data beyond the range covered by the input data. If not provided, the method will be constrained to the extent of the provided meteorological data.
- altitude_listQuantity, default=STD_CORSIKA_ALTITUDE_PROFILE
An array of altitudes at which to calculate atmospheric parameters. Should be an astropy Quantity with units of length.
- Returns:
- Table
An Astropy Table containing the computed atmospheric parameters at specified altitudes, formatted for CORSIKA simulations.
Notes
The method calculates atmospheric parameters based on the provided meteorological data and reference atmosphere. It interpolates or extrapolates as necessary to cover the specified altitude range. The output table is suitable for use in preparing CORSIKA atmospheric profiles, though it requires conversion to CORSIKA’s format.
- create_molecular_density_profile(mdp_file: str | None = None) Table#
Calculate the altitude profile of the molecular number density.
This method calculates the molecular number density at specified altitudes ranging from 0 to 20,000 meters, with a step of 1,000 meters. The number density is interpolated from the statistical description of the atmospheric data previously loaded. The results can be optionally written to an ECSV file.
- Parameters:
- mdp_filestr | None, default=None
The path and name of the output file where the molecular number density profile will be saved. If None, the data is not written to a file.
- Returns:
- Table
An Astropy Table containing the calculated molecular number densities at specified altitudes.
Notes
The molecular number density is calculated based on the average density values from the atmospheric data. The altitudes are converted to the same unit as the altitude in the statistical description before interpolation. This method is useful for atmospheric studies and simulations that require detailed altitude profiles.
- create_rayleigh_extinction_profile(co2_concentration: float, wavelength_min: ~astropy.units.quantity.Quantity = <Quantity 200. nm>, wavelength_max: ~astropy.units.quantity.Quantity = <Quantity 700. nm>, rayleigh_extinction_file: str | None = None, reference_atmosphere: ~astropy.table.table.Table | str | None = None, rayleigh_scattering_altitude_bins: ~astropy.units.quantity.Quantity = <Quantity [2.1, 2.2, 2.3, 2.4, 2.6, 2.8, 3.1, 3.5, 4., 4.5, 5., 5.5, 6. ] km>) Table#
Calculate the altitude profile of the optical depth due to Rayleigh scattering for a given range of wavelengths.
The optical depth (AOD) for an altitude h over the observatory is given by the integral of the monochromatic volume coefficient beta, with integration limits h_obs up to h. It is provided per altitude bins as a function of wavelength.
- Parameters:
- co2_concentrationfloat
The CO2 concentration (in ppm) to use for calculating the Rayleigh scattering coefficient.
- wavelength_minQuantity, default=200 * u.nm
The minimum wavelength for which the Rayleigh extinction profile should be calculated.
- wavelength_maxQuantity, default=700 * u.nm
The maximum wavelength for which the Rayleigh extinction profile should be calculated.
- rayleigh_extinction_filestr | None, default=None
The path and name of the output file where the Rayleigh extinction profile will be saved. If None, the data is not written to a file.
- reference_atmosphereTable | str | None, default=None
The reference atmosphere data, which can be provided as an Astropy Table or a file path to an ECSV file, This is used to extend or fill in data beyond the range covered by the input data. If not provided, the method will be constrained to the extent of the provided meteorological data.
- rayleigh_scattering_altitude_binsQuantity, default=RAYLEIGH_SCATTERING_ALTITUDE_BINS
Tuple with the altitudes that the AOD will be calculated. Units of length.
- write_to_filebool
If true, the function writes the Rayleigh scattering extinction table into the file rayleigh_extinction_file
- Returns:
- Table
A table containing the calculated Rayleigh extinction profile for each altitude bin and wavelength. The results are written to the specified file if rayleigh_extinction_file is provided.
- create_molecular_absorption_profile(molecule_name: str, molecular_cross_section_file: str, wavelength_min: ~astropy.units.quantity.Quantity = <Quantity 200. nm>, wavelength_max: ~astropy.units.quantity.Quantity = <Quantity 700. nm>, molar_mass: ~astropy.units.quantity.Quantity = <Quantity 0.048 kg / mol>, molecular_absorption_file: str | None = None, altitude_bins: ~astropy.units.quantity.Quantity = <Quantity [2.1, 2.2, 2.3, 2.4, 2.6, 2.8, 3.1, 3.5, 4., 4.5, 5., 5.5, 6. ] km>) QTable#
Calculate the optical depth due to molecular absorption for a given range of wavelengths and altitudes.
This method computes the molecular absorption optical depth by multiplying the absorption cross section (a function of wavelength) with the molecular number density (a function of altitude). The results are compiled into a table, which includes the ozone number density for each altitude bin and wavelength in the specified range.
- Parameters:
- molecule_namestr
The name of the molecule for which the absorption profile should be calculated.
- molecular_cross_section_filestr
The path to the file containing the molecular absorption cross section data.
- wavelength_minQuantity, default=200 * u.nm
The minimum wavelength for which the molecular absorption profile should be calculated.
- wavelength_maxQuantity, default=700 * u.nm
The maximum wavelength for which the molecular absorption profile should be calculated.
- molar_massQuantity, default=MOLAR_MASS_OZONE
The molar mass of the molecule for which the absorption profile should be calculated.
- molecular_absorption_filestr, optional
The path and name of the output file where the molecular absorption profile will be saved.
- altitude_binsQuantity, default=RAYLEIGH_SCATTERING_ALTITUDE_BINS
The altitude bins (in units of length) for which the molecular absorption optical depth will be calculated.
- Returns:
- QTable
An Astropy QTable containing the molecular absorption optical depth per altitude bin and per wavelength bin. The table includes columns for altitude, density, mixing ratio, and number density.
Notes
The molecular number density is calculated from the molecule mixing ratio and the mass density of the atmosphere, using the ideal gas law. The absorption cross section data must be provided in a file, which this method will read and interpolate as necessary to match the specified wavelength range.
- timeseries_analysis(outfile: str, parameter_level: Quantity, atmospheric_parameter: str, interpolation_parameter: str, m_floor: Quantity, m_ceiling: Quantity, interpolation_list: Quantity) None#
Analyze timeseries of meteorological data at a specified altitude level.
This method processes meteorological data to produce a timeseries analysis for a given atmospheric parameter (e.g., number density, temperature, pressure, relative humidity) at a specified altitude/pressure level. The analysis is focused between specified lower and upper altitude or pressure level bounds (m_floor and m_ceiling). The result is an Astropy table containing the provided atmospheric parameter at the specified level as a function of the Modified Julian Date (MJD). This table is then saved to a specified output file. The timeseries analysis can be used for various purposes, such as identifying seasons or validating data assimilation systems (DAS) against local weather station observations.
- Parameters:
- outfilestr
The path and name of the output file where the resulting table will be stored.
- parameter_levelQuantity
The specific altitude/pressure level at which the timeseries analysis will be conducted. This is typically chosen based on where significant seasonal differences are observed or where validation against local observations is desired.
- atmospheric_parameterstr
The atmospheric parameter to analyze in the timeseries. Common choices include number density (for season definition) and temperature, pressure, or relative humidity (for DAS validation).
- interpolation_parameterstr
- m_floorQuantity
The lowest level to consider in the analysis. This defines the lower bound of the parameter range.
- m_ceilingQuantity
The highest level to consider in the analysis. This defines the upper bound of the parameter range.
- interpolation_listQuantity, optional
A sequence of altitudes or pressure levels at which the atmospheric parameters will be calculated. This list should cover the range between m_floor and m_ceiling.
Notes
The method assumes that the input data includes a ‘Timestamp’ column that can be converted to MJD for the timeseries analysis. The atmospheric parameter values are interpolated for the specified altitude/pressure level across the provided interpolation list within the bounds of m_floor and m_ceiling.
- stat_analysis(atmo_parameter, altitudes, outfile)#
Perform statistical analysis on an atmospheric parameter and save the results.
This function interpolates the average, standard deviation, interquantile range, peak-to-peak maximum, and peak-to-peak minimum values of a given atmospheric parameter at specified altitudes. The results are stored in an output file as a table.
- Parameters:
- atmo_parameterstr
The name of the atmospheric parameter to analyze (e.g., “Temperature”, “Pressure”).
- altitudesastropy.units.Quantity
An array of altitude values with units of length (e.g., km, m).
- outfilestr
The output file path where the atmospheric parameter profile will be saved.
molecularprofiles.utils.grib_utils#
Set of utilities for decoding and analysing grib files.
- molecularprofiles.utils.grib_utils.get_altitude_from_geopotential_height(geopotential_height, latitude)#
Compute the real altitude from the geopotential value.
Uses expression 20 from http://dx.doi.org/10.1029/2002JB002333
- Parameters:
- geopotentialastropy.units.Quantity [u.m]
Geopotential height
- latitudeastropy.coordinates.Latitude
Geographical latitude of interest.
- Returns:
- astropy.units.Quantity [u.m]
Real altitude as fGeoidOffset.
- molecularprofiles.utils.grib_utils.get_gribfile_variables(filename)#
Return all the different variable names in a grib file.
- Parameters:
- filenamestr
Path to the grib file.
- Returns:
- list
varname (str): variable names.
- list
varshortname (str): variable short names.
- molecularprofiles.utils.grib_utils.create_table(grib_var)#
Create astropy.table.Table from grib record.
- Parameters:
- grib_var
Grib data record
- Returns:
- astropy.table.Table
Table with the different measurables together with their dimensions
- molecularprofiles.utils.grib_utils.get_grib_file_data(filename)#
Create astropy table with the data from a grib file.
This function opens a grib file, selects the parameters (e.g., Temperature, Geopotential, RH, etc.), and creates an astropy.table.Table with them.
- Parameters:
- filenamestr
Path to the grib file.
- Returns:
- astropy.table.Table
Table with grib file data including isobaric and single level parameters.
- molecularprofiles.utils.grib_utils.extend_grib_data(data)#
Extend grib data table.
Extends grib data table by filling the gaps in data and calculating additional quantities: - altitude - density - exponential density - wind direction
- Parameters:
- astropy.table.Table
Table with grib data
- Returns:
- astropy.table.Table
Extended table with grib data and additional quantities
- molecularprofiles.utils.grib_utils.save_grib_table(data, filename, fmt='ecsv')#
Save grib data in a file according to provided format.
- Parameters:
- data: astropy.table.Table
Grib data in astropy table
- filename: str
Path to the file
- fmt: str
Desired format
- molecularprofiles.utils.grib_utils.convert_to_text(data_path)#
Convert GRIB/GRIB2 files to ecsv.
- Parameters:
- data_path: path-like
Path to the folder with GRIB/GRIB2 data files
- molecularprofiles.utils.grib_utils.merge_ecsv_files(data_path)#
Merge ecsv files.
- Parameters:
- data_path: path-like
Path to the folder with GRIB/GRIB2 data files
molecularprofiles.utils.rayleigh#
Calculates properties related to Rayleigh scattering.
Adapted from MRayleigh, written by Markus Gaug <markus.gaug@uab.cat>, 04/2013
- class molecularprofiles.utils.rayleigh.Rayleigh(wavelength, co2_bkg, pressure=<Quantity 1013.25 hPa>, temperature=<Quantity 288.15 K>, relative_humidity=<Quantity 45.9 %>)#
A small Rayleigh-scattering program.
This program computes the Rayleigh-scattering optical depth in standard atmospheres. The calculations within this program are based on several key publications in the field of atmospheric optics, with specific aspects of the calculations based on the following references:
The overall computations of Rayleigh-scattering optical depth are based on the work by C. Tomasi et al. [1].
The calculation of refractive index is based on the works by P.E. Ciddor [2], [3].
The principal King factor formula is based on the work by D.R. Bates [4] and further discussed by B.A. Bodhaine et al. [5].
The calculation of the Chandrasekhar phase function is based on S. Chandrasekhar’s book [6].
Additional insights on scattering by molecules and particles are based on E.J. McCartney’s work [7].
References
[1]C. Tomasi, V. Vitale, B. Petkov, A. Lupi, A. Cacciari, “Improved algorithm for calculations of Rayleigh-scattering optical depth in standard atmospheres”, Applied Optics 44 Nr. 16 (2005) 3320.
[2]P.E. Ciddor, “Refractive index of air: new equations for the visible and near infrared”, Applied Optics 35 (1996) 1566.
[3]P.E. Ciddor, “Refractive index of air: 3. The roles of CO2, H20 and refractivity virals”, Applied Optics 41 (2002) 2292.
[4]D.R. Bates, “Rayleigh scattering by air”, Planet. Space Sci. 32 (1984) 785.
[5]B.A. Bodhaine, N.B. Wood, E.G. Dutton, J.R. Slusser, “On Rayleigh optical depth calculations”, J. Atmosph. Osceanic Technol. 16 (1999) 1854.
[6]S. Chandrasekhar, Radiative Transfer, Dover Publications, 1960.
[7]E.J. McCartney, “Optics of the Atmosphere. Scattering by Molecules and Particles”, Wiley & Sons, New York, 1977.
- __init__(wavelength, co2_bkg, pressure=<Quantity 1013.25 hPa>, temperature=<Quantity 288.15 K>, relative_humidity=<Quantity 45.9 %>)#
Create an instance of Rayleigh-scattering class.
- Parameters:
- wavelengthastropy.units.Quantity
Wavelength of light.
- co2_bkgfloat
CO2 concentration [ppmv]
- pressureastropy.units.Quantity
Atmospheric pressure
- temperatureastropy.units.Quantity
Air temperature
- relative_humidityastropy.units.Quantity
Relative humidity [%]
- property molecular_number_density#
Calculate molecular number density.
- Returns:
- astropy.units.Quantity
Molecular number density [cm^-3]
Notes
See Eq. 3 in [1].
References
[1]C. Tomasi, V. Vitale, B. Petkov, A. Lupi, A. Cacciari “Improved algorithm for calculations of Rayleigh-scattering optical depth in standard atmospheres”, Applied Optics 44 Nr. 16 (2005) 3320
- property scattering_cross_section#
Calculate Rayliegh scattering cross section.
- Returns:
- astropy.units.Quantity
Total Rayleigh scattering cross section per molecule [cm^2].
Notes
See Eq. 4 in [1].
References
[1]C. Tomasi, V. Vitale, B. Petkov, A. Lupi, A. Cacciari “Improved algorithm for calculations of Rayleigh-scattering optical depth in standard atmospheres”, Applied Optics 44 Nr. 16 (2005) 3320
- property beta#
Calculate the monochromatic volume coefficient.
- Returns:
- astropy.units.Quantity
Monochromatic volume coefficient for the total molecular scattering in cloudless air (beta) [1/km]
Notes
See Eq. 2 in [1].
References
[1]C. Tomasi, V. Vitale, B. Petkov, A. Lupi, A. Cacciari “Improved algorithm for calculations of Rayleigh-scattering optical depth in standard atmospheres”, Applied Optics 44 Nr. 16 (2005) 3320
- property refractive_index#
Calculate refractive index of moist air.
Implements Ciddor formula for calculation of refractive index in moist air. The obtained refractive index is precise to 1e-7.
- Returns:
- float
Index of refraction of moist air
Notes
Cross-checked with: http://emtoolbox.nist.gov/Wavelength/Documentation.asp#IndexofRefractionofAir
- property king_factor#
Calculate the current best estimate of the King factor of moist air.
- Returns:
- float
King factor [dimensionless]
Notes
The King factor is used to take into account effects due to the anisotropic properties of air molecules since anisotropic molecules scatter more radiation at 90 degrees scattering angles than isotropic molecules with the same index of refraction.
Precision not stated in Tomasi et al., but probably better than 1e-4. Effects of relative_humidity are of the order of several times 1e-4.
- property depolarization#
Calculate the best estimate of the depolarization factor of moist air.
Precision not stated in Tomasi et al., but probably better than 1e-4. Effects of relative_humidity are of the order of several times 1e-4.
- Returns:
- float
Depolarization factor of moist air.
- phase_function(angle)#
Calculate the Chandrasekhar phase function according to Eq. 255 of [1].
- Parameters:
- angleastropy.units.Quantity
Scattering angle.
- Returns:
- Chandrasekhar phase function for scattering of natural light.
References
[1]S. Chandrasekhar, Radiative Transfer, Dover Publications, 1960.
- back_scattering_coefficient(angle)#
Calculate back-scattering coefficient for a given scattering angle.
- Parameters:
- angleastropy.units.Quantity
Scattering angle.
- Returns:
- astropy.units.Quantity
Back-scattering coefficient [1/km]
- print_params()#
Print Rayleigh scattering parameters.
molecularprofiles.utils.humidity#
Collection of routines for calculation of moist air properties.
Provides:
density
compressibility
enhancement factor
saturation vapor pressure
molar fraction from relative humidity
partial pressure from relative humidity
Adapted from MHumidity, written by Markus Gaug <markus.gaug@uab.cat>, 04/2013
- molecularprofiles.utils.humidity.compressibility(pressure, temperature, x_w)#
Calculate the compressibility of moist air.
- Parameters:
- pressureastropy.units.Quantity
Atmospheric pressure
- temperatureastropy.units.Quantity
Air temperature
- x_wfloat
Molar fraction of water vapor
- Returns:
- float
compressibility of moist air (dimensionless constant, 0 < Z < 1)
Notes
Implemented according to Eq. 5 of [1]. Notation and constants according to Eq. 16 of [2].
References
- molecularprofiles.utils.humidity.enhancement_factor(pressure, temperature)#
Calculate the enhancement factor of water vapor in air.
- Parameters:
- pressureastropy.units.Quantity
Atmospheric pressure
- temperatureastropy.units.Quantity
Air temperature
- Returns:
- float
Enhancement factor (dimensionless constant)
Notes
Calculated according to Eq. 14 of [1].
References
[1]C. Tomasi, V. Vitale, B. Petkov, A. Lupi, A. Cacciari “Improved algorithm for calculations of Rayleigh-scattering optical depth in standard atmospheres”, Applied Optics 44 Nr. 16 (2005) 3320
- molecularprofiles.utils.humidity.saturation_vapor_pressure(temperature)#
Calculate the vapor pressure at saturation.
- Parameters:
- temperatureastropy.units.Quantity
Air temperature
- Returns:
- astropy.units.Quantity
Saturation vapor pressure
Notes
In case temperatures above 0 deg C it follows [1], see also Eq. 15 in [2]. Otherwise, Goff-Gratch equation (Eq. 1 in [3]) is used.
References
- molecularprofiles.utils.humidity.saturation_vapor_pressure_over_water(temperature)#
Calculate the vapor pressure at saturation over water.
- Parameters:
- temperatureastropy.units.Quantity
Air temperature
- Returns:
- astropy.units.Quantity
Saturation vapor pressure
Notes
Implemented according to [1]. See also [2] and [3].
References
[1]International Association for the Properties of Water and Steam, Peter H. Huang, “New equations for water vapor pressure in the temperature range -100 deg. C to 100 deg. C for use with the 1997 NIST/ASME steam tables” Papers and abstracts from the third international symposium on humidity and moisture, Vol. 1, p. 69-76, National Physical Laboratory, Teddington, Middlesex, UK, April 1998.
- molecularprofiles.utils.humidity.saturation_vapor_pressure_over_ice(temperature)#
Calculate the vapor pressure at saturation over ice.
- Parameters:
- temperature: astropy.units.Quantity
Air temperature
- Returns:
- astropy.units.Quantity
Saturation vapor pressure
Notes
Implemented according to [1]. See also [2] and [3].
References
[1]International Association for the Properties of Water and Steam, Peter H. Huang, “New equations for water vapor pressure in the temperature range -100 deg. C to 100 deg. C for use with the 1997 NIST/ASME steam tables” Papers and abstracts from the third international symposium on humidity and moisture, Vol. 1, p. 69-76, National Physical Laboratory, Teddington, Middlesex, UK, April 1998.
- molecularprofiles.utils.humidity.molar_fraction_water_vapor(pressure, temperature, relative_humidity)#
Calculate the molar fraction of water vapor in moist air.
- Parameters:
- pressureastropy.units.Quantity
Atmospheric pressure
- temperatureastropy.units.Quantity
Air temperature
- relative_humidityfloat
Relative humidity in percent
- Returns:
- float
Molar fraction of water vapor in moist air (dimensionless)
Notes
See the text above Eq. 14 in [1].
References
[1]C. Tomasi, V. Vitale, B. Petkov, A. Lupi, A. Cacciari “Improved algorithm for calculations of Rayleigh-scattering optical depth in standard atmospheres”, Applied Optics 44 Nr. 16 (2005) 3320
- molecularprofiles.utils.humidity.density_moist_air(pressure, temperature, moist_air_compressibility, x_w, co2_bkg)#
Calculate the density of moist air.
- Parameters:
- pressureastropy.units.Quantity
Atmospheric pressure
- temperatureastropy.units.Quantity
Temperature
- moist_air_compressibilityfloat
Compressibility (see compressibility() in this module)
- x_wfloat
Molar fraction of water vapor
- co2_bkgfloat
CO2 volume concentration in ppmv (different unit than in Davis!)
- Returns:
- astropy.units.Quantity
Density of moist air
Notes
Density equation of moist air, according to Eq. 1 of [1].
References
[1]R.S. Davis, “Equation for the determination of the density of moist air” Metrologia, 29 (1992) 67-70
- molecularprofiles.utils.humidity.partial_pressure_water_vapor(temperature, relative_humidity)#
Calculate the partial pressure of water vapor in the air.
- Parameters:
- temperatureastropy.units.Quantity
Temperature
- relative_humidityastropy.units.Quantity
Relative humidity
- Returns:
- astropy.units.Quantity
Water vapor partial pressure