ppcpy.misc.molecular#

Functions

air_refractive_index

Calculate the refractive index of air.

alpha_rayleigh

Cacluate the extinction coefficient for Rayleigh scattering. Inputs: wavelength : float or array of floats Wavelegnth [nm] pressure : float or array of floats Atmospheric pressure [hPa] temperature : float Atmospheric temperature [K] C : float CO2 concentration [ppmv]. rh : float Relative humidity from 0 to 100 [%] Returns: alpha: float The molecular scattering coefficient [m-1].

beta_pi_rayleigh

Calculates the total Rayleigh backscatter coefficient. Inputs: wavelength: float Wavelength [nm] pressure: float The atmospheric pressure [hPa] temperature: float The atmospheric temperature [K] C: float CO2 concentration [ppmv]. rh: float Relative humidity from 0 to 100 [%] Returns beta_pi: array molecule backscatter coefficient. [m^{-1}Sr^{-1}].

calc_2d

calc_profiles

for a list of xarray averaged meteorology profiles, calculate the rayleigh scattering

compressibility_of_moist_air

Compressibility of moist air.

dsigma_phi_rayleigh

Calculates the angular rayleigh scattering cross section per molecule. Inputs: theta: float Scattering angle [rads] wavelength: float Wavelength [nm] pressure: float The atmospheric pressure [hPa] temperature: float The atmospheric temperature [K] C: float CO2 concentration [ppmv]. rh: float Relative humidity from 0 to 100 [%] Returns: dsigma: float rayleigh-scattering cross section [m2sr-1].

enhancement_factor_f

Enhancement factor. Inputs: pressure: float Atmospheric pressure [hPa] temperature: float Atmospehric temperature [K].

kings_factor_Ar

kings_factor_CO2

kings_factor_H2O

kings_factor_N2

approximates the King's correction factor for a specific wavenumber.

kings_factor_O2

kings_factor_atmosphere

calculate the king factor. Usage: k = king_factor_atmosphere(wavelength, C, p_e, p_t) Inputs: wavelength: float Unit: nm C: float CO2 concentration in ppmv p_e: float water vapor pressure in hPa p_t: float total air pressure in hPa :returns:.

moist_air_density

Calculate the density of moist air.

molar_fraction_water_vapour

Molar fraction of water vapor. Inputs: pressure: float Total pressure [hPa] temperature: float Atmospehric temperature [K] relative_humidity: Relative humidity from 0 to 100 [%].

molar_mass_dry_air

Molar mass of dry air as a function of CO2 concentration.

n_standard_air

Calculate the refractive index of standard air at a given wavelength.

n_standard_air_with_CO2

Calculate the refractive index of air at a specific wavelength with CO2 concentration.

n_water_vapor

Calculate the refractive index of water vapor.

number_density_at_pt

Calculate the number density for a given temperature and pressure, taking into account the compressibility of air. Inputs: pressure: float or array Pressure in hPa temperature: float or array Temperature in K relative_humidity: float or array (?) ? The relative humidity of air (Check) ideal: boolean If False, the compressibility of air is considered. If True, the compressibility is set to 1. Returns: n: array or array Number density of the atmosphere [m^{-3}].

phase_function

Calculates the phase function at an angle theta for a specific wavelegth. Inputs: theta: float Scattering angle [rads] wavelength: float Wavelength [nm] pressure: float The atmospheric pressure [hPa] temperature: float The atmospheric temperature [K] C: float CO2 concentration [ppmv]. rh: float Relative humidity from 0 to 100 [%] Returns: p: float Scattering phase function.

physical_constants

pressure_to_rh

Convert water vapour partial pressure to relative humidity.

rayleigh_scattering

Calculate the molecular volume backscatter coefficient and extinction coefficient.

rh_to_pressure

Convert relative humidity to water vapour partial pressure.

rho_atmosphere

Calculate the depolarization factor of the atmosphere.

saturation_vapor_pressure

Saturation vapor pressure of water of moist air.

sigma_rayleigh

Calculates the Rayleigh-scattering cross section per molecule.

ppcpy.misc.molecular.air_refractive_index(wavelength, pressure, temperature, C, relative_humidity)[source]#

Calculate the refractive index of air. wavelength: Wavelength [nm] pressure: Atmospheric pressure [hPa] temperature: Atmospheric temperature [K] C: CO2 concentration [ppmv] relative_humidity: Relative humidity [%] Returns: Refractive index of air.

ppcpy.misc.molecular.moist_air_density(pressure, temperature, C, Xw)[source]#

Calculate the density of moist air. pressure: Total pressure [hPa] temperature: Temperature [K] C: CO2 concentration [ppmv] Xw: Molar fraction of water vapor

ppcpy.misc.molecular.molar_mass_dry_air(C)[source]#

Molar mass of dry air as a function of CO2 concentration. C: CO2 concentration [ppmv] Returns: Molar mass of dry air [kg/mol]

ppcpy.misc.molecular.compressibility_of_moist_air(pressure, temperature, molar_fraction)[source]#

Compressibility of moist air. pressure: Total pressure [hPa] temperature: Temperature [K] molar_fraction: Molar fraction of water vapor

ppcpy.misc.molecular.n_standard_air(wavelength)[source]#

Calculate the refractive index of standard air at a given wavelength.

Parameters:

wavelength (float) – Wavelength [nm].

Returns:

Refractive index of standard air.

Return type:

float

ppcpy.misc.molecular.n_standard_air_with_CO2(wavelength, C)[source]#

Calculate the refractive index of air at a specific wavelength with CO2 concentration.

Parameters:
  • wavelength (float) – Wavelength [nm].

  • C (float) – CO2 concentration [ppmv].

Returns:

Refractive index of air for the given CO2 concentration.

Return type:

float

ppcpy.misc.molecular.n_water_vapor(wavelength)[source]#

Calculate the refractive index of water vapor.

Parameters:

wavelength (float) – Wavelength [nm].

Returns:

Refractive index of water vapor.

Return type:

float

ppcpy.misc.molecular.alpha_rayleigh(wavelength, pressure, temperature, C, rh)[source]#

Cacluate the extinction coefficient for Rayleigh scattering. Inputs: wavelength : float or array of floats

Wavelegnth [nm]

pressurefloat or array of floats

Atmospheric pressure [hPa]

temperaturefloat

Atmospheric temperature [K]

Cfloat

CO2 concentration [ppmv].

rhfloat

Relative humidity from 0 to 100 [%]

Returns: alpha: float

The molecular scattering coefficient [m-1]

ppcpy.misc.molecular.beta_pi_rayleigh(wavelength, pressure, temperature, C, rh)[source]#

Calculates the total Rayleigh backscatter coefficient. Inputs: wavelength: float

Wavelength [nm]

pressure: float

The atmospheric pressure [hPa]

temperature: float

The atmospheric temperature [K]

C: float

CO2 concentration [ppmv].

rh: float

Relative humidity from 0 to 100 [%]

Returns beta_pi: array

molecule backscatter coefficient. [m^{-1}Sr^{-1}]

ppcpy.misc.molecular.dsigma_phi_rayleigh(theta, wavelength, pressure, temperature, C, rh)[source]#

Calculates the angular rayleigh scattering cross section per molecule. Inputs: theta: float

Scattering angle [rads]

wavelength: float

Wavelength [nm]

pressure: float

The atmospheric pressure [hPa]

temperature: float

The atmospheric temperature [K]

C: float

CO2 concentration [ppmv].

rh: float

Relative humidity from 0 to 100 [%]

Returns: dsigma: float

rayleigh-scattering cross section [m2sr-1]

ppcpy.misc.molecular.enhancement_factor_f(pressure, temperature)[source]#

Enhancement factor. Inputs: pressure: float

Atmospheric pressure [hPa]

temperature: float

Atmospehric temperature [K]

ppcpy.misc.molecular.kings_factor_atmosphere(wavelength, C, p_e, p_t)[source]#

calculate the king factor. Usage:

k = king_factor_atmosphere(wavelength, C, p_e, p_t)

Inputs:
wavelength: float

Unit: nm

C: float

CO2 concentration in ppmv

p_e: float

water vapor pressure in hPa

p_t: float

total air pressure in hPa

Returns:

float

total atmospheric King’s factor

Return type:

k

References

https://bitbucket.org/iannis_b/lidar_molecular

ppcpy.misc.molecular.kings_factor_N2(wavenumber)[source]#

approximates the King’s correction factor for a specific wavenumber. According to Bates, the agreement with experimental values is “rather better than 1 per cent.”

Inputs: wavenumber : float Wavenumber (defined as 1/lamda) in cm-1 Returns: Fk : float Kings factor for N2 Notes: The King’s factor is estimated as: .. math:: F_{N_2} = 1.034 + 3.17 cdot 10^{-4} cdot lambda^{-2} where \(\lambda\) is the wavelength in micrometers. References: Tomasi, C., Vitale, V., Petkov, B., Lupi, A. & Cacciari, A. Improved algorithm for calculations of Rayleigh-scattering optical depth in standard atmospheres. Applied Optics 44, 3320 (2005). Bates, D. R.: Rayleigh scattering by air, Planetary and Space Science, 32(6), 785-790, doi:10.1016/0032-0633(84)90102-8, 1984.

ppcpy.misc.molecular.kings_factor_O2(wavenumber)[source]#
ppcpy.misc.molecular.kings_factor_Ar()[source]#
ppcpy.misc.molecular.kings_factor_CO2()[source]#
ppcpy.misc.molecular.kings_factor_H2O()[source]#
ppcpy.misc.molecular.molar_fraction_water_vapour(pressure, temperature, relative_humidity)[source]#

Molar fraction of water vapor. Inputs: pressure: float

Total pressure [hPa]

temperature: float

Atmospehric temperature [K]

relative_humidity:

Relative humidity from 0 to 100 [%]

ppcpy.misc.molecular.number_density_at_pt(pressure, temperature, relative_humidity, ideal)[source]#

Calculate the number density for a given temperature and pressure, taking into account the compressibility of air. Inputs: pressure: float or array

Pressure in hPa

temperature: float or array

Temperature in K

relative_humidity: float or array (?)

? The relative humidity of air (Check)

ideal: boolean

If False, the compressibility of air is considered. If True, the compressibility is set to 1.

Returns: n: array or array

Number density of the atmosphere [m^{-3}]

ppcpy.misc.molecular.phase_function(theta, wavelength, pressure, temperature, C, rh)[source]#

Calculates the phase function at an angle theta for a specific wavelegth. Inputs: theta: float

Scattering angle [rads]

wavelength: float

Wavelength [nm]

pressure: float

The atmospheric pressure [hPa]

temperature: float

The atmospheric temperature [K]

C: float

CO2 concentration [ppmv].

rh: float

Relative humidity from 0 to 100 [%]

Returns: p: float

Scattering phase function

Notes: The formula is derived from Bucholtz (1995). A different formula is given in Miles (2001).

The use of this formula insetad of the wavelenght independent 3/4(1+cos(th)**2) improves the results for back and forward scatterring by ~1.5%

Anthony Bucholtz, “Rayleigh-scattering calculations for the terrestrial atmosphere”, Applied Optics 34, no. 15 (May 20, 1995): 2765-2773.

R. B Miles, W. R Lempert, and J. N Forkey, “Laser Rayleigh scattering”, Measurement Science and Technology 12 (2001): R33-R51

ppcpy.misc.molecular.physical_constants()[source]#
ppcpy.misc.molecular.pressure_to_rh(partial_pressure, temperature)[source]#

Convert water vapour partial pressure to relative humidity.

Parameters:
  • partial_pressure (float) – Water vapour partial pressure [hPa]

  • temperature (float) – Temperature [K]

Returns:

Relative humidity from 0 to 100 [%]

Return type:

float

ppcpy.misc.molecular.rh_to_pressure(rh, temperature)[source]#

Convert relative humidity to water vapour partial pressure.

Parameters:
  • rh (float) – Relative humidity from 0 to 100 [%]

  • temperature (float) – Temperature [K]

Returns:

Water vapour pressure [hPa]

Return type:

float

ppcpy.misc.molecular.rho_atmosphere(wavelength, C, p_e, p_t)[source]#

Calculate the depolarization factor of the atmosphere.

Parameters:
  • wavelength (float or array) – Wavelength in nm

  • C (float) – CO2 concentration in ppmv

  • p_e (float) – water-vapor pressure [hPa]

  • p_t (float) – total air pressure [hPa]

Returns:

Depolarization factor

Return type:

float or array

ppcpy.misc.molecular.saturation_vapor_pressure(temperature)[source]#

Saturation vapor pressure of water of moist air.

Parameters:

temperature (float) – Atmospheric temperature [K]

Returns:

Saturation vapor pressure [hPa]

Return type:

float

ppcpy.misc.molecular.sigma_rayleigh(wavelength, pressure, temperature, C, rh)[source]#

Calculates the Rayleigh-scattering cross section per molecule.

Parameters:
  • wavelength (float) – Wavelength [nm]

  • pressure (float) – The atmospheric pressure [hPa]

  • temperature (float) – The atmospheric temperature [K]

  • C (float) – CO2 concentration [ppmv]

  • rh (float) – Relative humidity from 0 to 100 [%]

Returns:

Rayleigh-scattering cross section [m2]

Return type:

float

ppcpy.misc.molecular.rayleigh_scattering(wavelength, pressure, temperature, C, rh)[source]#

Calculate the molecular volume backscatter coefficient and extinction coefficient.

Parameters:#

wavelengthfloat

Wavelength in nanometers [nm].

pressurefloat

Atmospheric pressure [hPa].

temperaturefloat

Atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

rhfloat

Relative humidity as a percentage (0 to 100).

Returns:#

beta_molfloat

Molecular backscatter coefficient [m^{-1}*sr^{-1}].

alpha_molfloat

Molecular extinction coefficient [m^{-1}].

References:#

Bucholtz, A.: Rayleigh-scattering calculations for the terrestrial atmosphere, Appl. Opt. 34, 2765-2773 (1995). A. Behrendt and T. Nakamura, “Calculation of the calibration constant of polarization lidar and its dependency on atmospheric temperature,” Opt. Express, vol. 10, no. 16, pp. 805-817, 2002.

History:#

First edition by Zhenping, 2017-12-16. Based on the Python source code of Ioannis Binietoglou’s [repo](https://bitbucket.org/iannis_b/lidar_molecular). AI-Translated, 2024-12-03

ppcpy.misc.molecular.calc_profiles(met_profiles, wavelengths=[355, 387, 407, 532, 607, 1058, 1064], CO2=400)[source]#

for a list of xarray averaged meteorology profiles, calculate the rayleigh scattering

ppcpy.misc.molecular.calc_2d(met, wavelengths=[355, 387, 407, 532, 607, 1058, 1064], CO2=400)[source]#