ppcpy.misc#

ppcpy.misc.helper#

ppcpy.misc.helper.detect_path_type(fullpath)[source]#

Detect the type of path (Windows or Linux) based on the input.

ppcpy.misc.helper.os_name()[source]#
ppcpy.misc.helper.get_input_path(timestamp, device, raw_folder)[source]#
ppcpy.misc.helper.get_pollyxt_files(timestamp, device, raw_folder, output_path)[source]#

This function locates multiple pollyxt level0 nc-zip files from one day measurements, unzipps the files to output_path and returns a list of files to be merged and the title of the new merged nc-file

ppcpy.misc.helper.get_pollyxt_logbook_files(timestamp, device, raw_folder, output_path)[source]#

This function locates multiple pollyxt logbook-zip files from one day measurements, unzipps the files to output_path and merge them to one file

ppcpy.misc.helper.add_to_list(element, from_list, to_list)[source]#
ppcpy.misc.helper.checking_vars(timestamp, device, raw_folder, output_path)[source]#
ppcpy.misc.helper.checking_attr(timestamp, device, raw_folder, output_path)[source]#

Parameters:
timestamp

device

raw_folder

output_path

Returns:

Todo

Variables ‘force’ and ‘polly_files_list’ are not defined anywhere ..

ppcpy.misc.helper.checking_timestamp(timestamp, device, raw_folder, output_path)[source]#
ppcpy.misc.helper.concat_files(timestamp, device, raw_folder, output_path)[source]#
ppcpy.misc.helper.remove_whitespaces_and_replace_dash_with_underscore(string: str) str[source]#

remove whitespaces and replace dashes with underscores

Parameters:
stringstr

String to be modified

Returns:
new_stringstr

Modified string

ppcpy.misc.helper.find_matching_dimension(array, reference_list)[source]#

Finds the dimension of a 3D array that matches the length of the reference list.

Parameters:
array (np.ndarray): The 3D NumPy array to check.
reference_list (list): The list to compare the dimension lengths with. This can also be a dict.
Returns:
int: The index of the matching dimension, or -1 if no match is found.
ppcpy.misc.helper.channel_2_variable_mapping(data_retrievals, var, channeltags_dict)[source]#
ppcpy.misc.helper.uniform_filter(x: ndarray, win: int, fill_val: float = nan) ndarray[source]#

Uniform smoothing filter.

The smoothing is applied without padding and the original dimension of the input is recreated by filling the reduced edges with a fill value.

Parameters:
x(N,) ndarray

One dimensional input signal.

winint

(M,) Width of the filter.

fill_valfloat, optional

Value to be used for filling edges, in order to recreate the input dimension. Default is np.nan.

Returns:
outndarray

Smoothed signal.

Notes

  • Currently only support smoothing of 1D-arrays with a constant window size.

History

  • 2026-02-02: First edition by Buholdt

ppcpy.misc.helper.moving_average(x: ndarray, win: int) ndarray[source]#

Uniform smoothing filter ala. smooth(y, span, method=’moving’) in Matlab.

The smoothing is applied without padding and the original dimension of the input is recreated preforming a centered moving average filter for each edge.

Parameters:
x(N,) ndarray

One dimensional input signal.

winint

(M,) Width of the filter. Must be odd. If an even number is inputed the function will use a filter width of win - 1.

Returns:
outndarray

Smoothed signal.

Notes

  • Currently only support smoothing of 1D-arrays with a constant window size.

History

  • 2026-03-24: First edition by Buholdt

Examples

The output of __name__ for win = 5 follows the following logic: out[0] = x[0] out[1] = (x[0] + x[1] + x[2])/3 out[2] = (x[0] + x[1] + x[2] + x[3] + x[4])/5 out[3] = (x[1] + x[2] + x[3] + x[4] + x[5])/5 … out[-4] = (x[-6] + x[-5] + x[-4] + x[-3] + x[-2])/5 out[-3] = (x[-5] + x[-4] + x[-3] + x[-2] + x[-1])/5 out[-2] = (x[-3] + x[-2] + x[-1])/3 out[-1] = x[-1]

ppcpy.misc.helper.savgol_filter(x: ndarray, window_length: int, polyorder: int = 2, deriv: int = 0, delta: float = 1.0, fill_val: float = nan) ndarray[source]#

Savitzky-Golay filter

A Savitzky-Golay filter that works with NaN values.

Parameters:
xndarray

Signal to be smoothed

window_lengthint

Width of savgol filter

polyorderint, optional

The order of the polynomial used to make the filter. must be less than ‘window_length’. Default is 2.

derivint, optional

The order of the derivative to compute for the filter. Default is 0.

deltafloat, optional

The spacing of which the filter will be applied. This is only used if ‘deriv’ > 0. Defualt is 1.0.

fill_valfloat, optional

Value to be used for filling edges in order to recreate the input dimension. Default is np.nan.

Returns:
outndarray

Smoothed signal

Notes

This function is inspiered by scipy.signal’s Savitzky-Golay filter [1].

References

[1] Virtanen, et al., Scipy 1.0: Fundamental Algorithms for Scientific Computing in Python, Nature Methods, 2020, 17, 261-272, https://rdcu.be/b08Wh, 10.1038/s41592-019-0686-2 [2] A. Savitzky, M. J. E. Golay, Smoothing and Differentiation of Data by Simplified Least Squares Procedures. Analytical Chemistry, 1964, 36 (8), pp 1627-1639. [3] Jianwen Luo, Kui Ying, and Jing Bai. 2005. Savitzky-Golay smoothing and differentiation filter for even number data. Signal Process. 85, 7 (July 2005), 1429-1434.

ppcpy.misc.helper.mean_stable(x: ndarray, win: int, minBin: int = None, maxBin: int = None, minRelStd: float = None) tuple[source]#

Calculate the mean value of x based on the least fluctuated segment of x. The searching is based on the std inside each window of x.

Parameters:
xndarray

Signal array.

winint

Window width for calculating the relative standard deviation.

minBinint, optional

The start index for the mean calculation (default: 1).

maxBinint, optional

The end index for the mean calculation (default: length of x).

minRelStdfloat, optional

Minimum relative standard deviation threshold.

Returns:
xStablefloat

Stable mean value.

xIndxndarray

Index of the elements used to calculate the mean value.

xRelStdfloat

Relative uncertainty of the sequences used to calculate the mean values.

Notes

History

  • 2021-05-30: First edition by Zhenping

  • 2026-02-04: Changed from scipy.ndimage.uniform_filter1d to uniform_filter

ppcpy.misc.helper.smooth2a(matrix_in: ndarray, Nr: int, Nc: int = None) ndarray[source]#

Smooths 2D array data while ignoring NaNs.

This function smooths the data in matrix_in using a mean filter over a rectangle of size (2*Nr+1)-by-(2*Nc+1). Each element is replaced by the mean of the surrounding rectangle, ignoring NaN elements. If an element is NaN, it remains NaN in the output. At the edges, as much of the rectangle as fits is used.

Parameters:
matrix_inndarray

Original matrix to be smoothed.

Nrint

Number of points used to smooth rows.

Ncint, optional

Number of points used to smooth columns. If not specified, Nc = Nr.

Returns:
matrix_outndarray

Smoothed version of the input matrix.

References

  • Written by Greg Reeves, March 2009, Division of Biology, Caltech.

  • Inspired by “smooth2” by Kelly Hilands, October 2004, Applied Research Laboratory, Penn State University.

  • Developed from code by Olof Liungman, 1997, Dept. of Oceanography, Earth Sciences Centre, Göteborg University.

ppcpy.misc.helper.get_wv_pol_telescope_from_dictkeyname(keyname: str) tuple[source]#

translate {wavelength}_{total|cross|parallel|rr}_{NR|FR|DFOV} to wavelength, polarisation, telescope separataly.

Parameters:
keynamestr

e.g. 532_total_FR.

Returns:
wavelengthstr

eg. ‘532’

polarisationstr

eg. ‘total’

telescopestr

eg. ‘FR’

ppcpy.misc.helper.idx2time(cldFreeIdx: ndarray[int, int], nIdx: int, nHour: int) str[source]#

Convert cloud free indecis to cloud free times.

Parameters:
cldFreeIdxnp.ndarray

Cloud free group (start idx, end idx).

nIdxint

Number of idx / length of time dimension.

nHourint

Number of hours represented in the time dimension.

Returns:
outstr

Time stamps of cldFreeIdx as a string (eg. 0920_1020)

ppcpy.misc.helper.default_to_regular(d)[source]#

defaultdict to regular dict

ppcpy.misc.json2nc_mapping#

ppcpy.misc.json2nc_mapping.read_json_to_dict(file_path)[source]#

Reads in an existing json-file and outputs a dict-structure

ppcpy.misc.json2nc_mapping.create_netcdf_from_dict(nc_file_path: str, data_cube, data_dict: dict, compression_level: int, prod: str, cldFreeIndx: int = None)[source]#

Creates a NetCDF file from a structured dictionary.

Parameters:
nc_file_pathstr

Path to the NetCDF file to create.

data_cubeobject

the data-object of class PicassoProc.

data_dictdict

Dictionary with keys ‘global_attributes’, ‘dimensions’, and ‘variables’.

compression_levelint

a nc-compressionlevel of 1 is a good reference.

prodstr

e.g. profile, OC_profile, NR_profile, …

cldFreeIndxint, optional

If the product to be saved are optical profiles; index of the cloud free region for the saved profiles. Else; None. Default is None.

Examples

Example of data_dict structure:

{
    "global_attributes": {
        "title": "Example NetCDF File",
        "institution": "My Organization"
    },
    "dimensions": {
        "time": None,  // Unlimited dimension
        "lat": 10,
        "lon": 20
    },
    "variables": {
        "temperature": {
            "dimensions": ("time", "lat", "lon"),
            "dtype": "float32",
            "attributes": {
                "units": "K",
                "long_name": "Surface temperature"
            },
            "data": np.random.rand(5, 10, 20)  // Example data
        },
        "pressure": {
            "dimensions": ("time", "lat", "lon"),
            "dtype": "float32",
            "attributes": {
                "units": "Pa",
                "long_name": "Surface pressure"
            },
            "data": np.random.rand(5, 10, 20)  // Example data
        }
    }
}
ppcpy.misc.json2nc_mapping.add_variable_2_json_dict_mapper(data_dict, new_key, reference_key, new_data=None, new_attributes=None)[source]#

Adds a new variable to the ‘variables’ section of the given dictionary.

Parameters:

data_dict (dict): The original dictionary structure. reference_key (str): The name of the existing variable to reference to (template for new key/variable) new_key (str): The name of the new variable to add. new_data (np.ndarray, optional): The data for the new variable. new_attributes (dict, optional): Additional or updated attributes for the new variable.

ppcpy.misc.json2nc_mapping.remove_variable_from_json_dict_mapper(data_dict, key_to_remove)[source]#

Removes a specific variable from the ‘variables’ section of the given dictionary.

Parameters:

data_dict (dict): The original dictionary structure. key_to_remove (str): The name of the variable to remove.

ppcpy.misc.json2nc_mapping.remove_empty_keys_from_dict(data_dict)[source]#
ppcpy.misc.json2nc_mapping.update_variable_attribute_of_json_dict_mapper(data_dict, variable_key, attribute_key, new_value)[source]#

Updates the value of a specific attribute for a specified variable in the data dictionary.

Parameters:

data_dict (dict): The dictionary containing the variables and attributes. variable_key (str): The key of the variable to update. attribute_key (str): The key of the attribute to update. new_value (any): The new value to set for the attribute.

ppcpy.misc.molecular#

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

Calculate the refractive index of air.

Parameters:
wavelengthfloat

Wavelength [nm].

pressurendarray

Atmospheric pressure [hPa].

temperaturendarray

Atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

relative_humidityndarray

Relative humidity [%].

Returns:
n_airndarray

Refractive index of air.

ppcpy.misc.molecular.moist_air_density(pressure: float | ndarray, temperature: float | ndarray, C: float, Xw: float | ndarray) tuple[source]#

Calculate the density of moist air.

Parameters:
pressurefloat or ndarray

Total pressure [hPa].

temperaturefloat or ndarray

Temperature [K].

Cfloat

CO2 concentration [ppmv].

Xwfloat or ndarray

Molar fraction of water vapor.

Returns:
rhofloat or ndarray

rho_airfloat or ndarray

rho_wvfloat or ndarray

Notes

Todo

Finish docstring.

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

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

Parameters:
Cfloat

CO2 concentration [ppmv].

Returns:
Mafloat

Molar mass of dry air [kg/mol].

ppcpy.misc.molecular.compressibility_of_moist_air(pressure: float | ndarray, temperature: float | ndarray, molar_fraction: float | ndarray) float | ndarray[source]#

Compressibility of moist air.

Parameters:
pressurefloat or ndarray

Total pressure [hPa].

temperaturefloat or ndarray

Temperature [K].

molar_fractionfloat or ndarray

Molar fraction of water vapor.

Returns:
Zfloat or ndarray

Notes

Todo

Finish docstring.

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

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

Parameters:
wavelengthfloat

Wavelength [nm].

Returns:
nsfloat

Refractive index of standard air.

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

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

Parameters:
wavelengthfloat

Wavelength [nm].

Cfloat

CO2 concentration [ppmv].

Returns:
n_axsfloat

Refractive index of air for the given CO2 concentration.

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

Calculate the refractive index of water vapor.

Parameters:
wavelengthfloat

Wavelength [nm].

Returns:
n_wsfloat

Refractive index of water vapor.

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

Cacluate the extinction coefficient for Rayleigh scattering.

Parameters:
wavelengthfloat

Wavelegnth [nm].

pressurefloat or ndarray

Atmospheric pressure [hPa].

temperaturefloat or ndarray

Atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

rhfloat or ndarray

Relative humidity from 0 to 100 [%].

Returns:
alpha: float or ndarray

The molecular scattering coefficient [m^{-1}].

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

Calculates the total Rayleigh backscatter coefficient.

Parameters:
wavelengthfloat

Wavelength [nm].

pressurefloat or ndarray

The atmospheric pressure [hPa].

temperaturefloat or ndarray

The atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

rhfloat or ndarray

Relative humidity from 0 to 100 [%].

Returns:
beta_pifloat or ndarray

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

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

Calculates the angular rayleigh scattering cross section per molecule.

Parameters:
thetafloat

Scattering angle [rads].

wavelengthfloat

Wavelength [nm].

pressurefloat or ndarray

The atmospheric pressure [hPa].

temperaturefloat or ndarray

The atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

rhfloat or ndarray

Relative humidity from 0 to 100 [%].

Returns:
dsigmafloat or ndarray

rayleigh-scattering cross section [m2sr-1].

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

Enhancement factor.

Parameters:
pressurefloat or ndarray

Atmospheric pressure [hPa].

temperaturefloat or ndarray

Atmospehric temperature [K].

Returns:
ffloat or ndarray

Enhancment factor.

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

Calculate the king factor.

Parameters:
wavelengthfloat

Wavelength [nm].

Cfloat

CO2 concentration [ppmv].

p_e: float or ndarray

Water vapor pressure [hPa].

p_tfloat or ndarray

Total air pressure [hPa].

Returns:
kfloat or ndarray

Total atmospheric King’s factor.

References

https://bitbucket.org/iannis_b/lidar_molecular

Examples

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

ppcpy.misc.molecular.kings_factor_N2(wavenumber: float) float[source]#
Approximates the King’s correction factor of N2 for a specific wavenumber.

According to Bates, the agreement with experimental values is “rather better than 1 per cent.”

Parameters:
wavenumberfloat

Wavenumber (defined as 1/lamda) [cm^{-1}].

Returns:
kfloat

Kings factor for N2.

Notes

The King’s factor is estimated as

\[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: float)[source]#
Approximates the King’s correction factor of O2 for a specific wavenumber.

According to Bates, the agreement with experimental values is “rather better than 1 per cent.”

Parameters:
wavenumberfloat

Wavenumber (defined as 1/lamda) [cm^{-1}].

Returns:
kfloat

Kings factor for O2.

Notes

The King’s factor is estimated as

\[F_{O_2} = 1.096 + 1.385 \cdot 10^{-3} \cdot \lambda^{-2} + 1.448 \cdot 10^{-4} \cdot \lambda^{-4}\]

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_Ar() float[source]#

King’s correction factor for Ar.

Returns:
float

Kings factor for Ar.

ppcpy.misc.molecular.kings_factor_CO2() float[source]#

King’s correction factor for CO2.

Returns:
float

Kings factor for CO2.

ppcpy.misc.molecular.kings_factor_H2O() float[source]#

King’s correction factor for H2O.

Returns:
float

Kings factor for H2O.

ppcpy.misc.molecular.molar_fraction_water_vapour(pressure: float | ndarray, temperature: float | ndarray, relative_humidity: float | ndarray) float | ndarray[source]#

Molar fraction of water vapor.

Parameters:
pressurefloat or ndarray

Total pressure [hPa].

temperaturefloat or ndarray

Atmospehric temperature [K] .

relative_humidityfloat or ndarray

Relative humidity from 0 to 100 [%].

Returns
Xwfloat or ndarray

Molar fraction of water vapor.

ppcpy.misc.molecular.number_density_at_pt(pressure: float | ndarray, temperature: float | ndarray, relative_humidity: float | ndarray, ideal: bool) float | ndarray[source]#

Calculate the number density for a given temperature and pressure, taking into account the compressibility of air.

Parameters:
pressurefloat or array

Pressure [hPa].

temperaturefloat or array

Temperature [K].

relative_humidity: float or array (?)

? The relative humidity of air (Check)

ideal: bool

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

Returns:
nfloat or array

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

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

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

Parameters:
thetafloat

Scattering angle [rads].

wavelengthfloat

Wavelength [nm].

pressurefloat or ndarray

The atmospheric pressure [hPa].

temperaturefloat or ndarray

The atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

rhfloat or ndarray

Relative humidity from 0 to 100 [%].

Returns:
pfloat or ndarray

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() dict[source]#

Physical constants.

Returns:
dict
hfloat

cfloat

k_bfloat

Rfloat

Notes

Todo

Finish docstring.

ppcpy.misc.molecular.pressure_to_rh(partial_pressure: float | ndarray, temperature: float | ndarray) float | ndarray[source]#

Convert water vapour partial pressure to relative humidity.

Parameters:
partial_pressurefloat or ndarray

Water vapour partial pressure [hPa].

temperaturefloat or ndarray

Temperature [K].

Returns:
rhfloat or ndarray

Relative humidity from 0 to 100 [%]

ppcpy.misc.molecular.rh_to_pressure(rh: float | ndarray, temperature: float | ndarray) float | ndarray[source]#

Convert relative humidity to water vapour partial pressure.

Parameters:
rhfloat or ndarray

Relative humidity from 0 to 100 [%].

temperaturefloat or ndarray

Temperature [K].

Returns:
p_wvfloat or ndarray

Water vapour pressure [hPa].

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

Calculate the depolarization factor of the atmosphere.

Parameters:
wavelengthfloat

Wavelength [nm].

Cfloat

CO2 concentration [ppmv].

p_efloat or ndarray

water-vapor pressure [hPa].

p_tfloat or ndarray

total air pressure [hPa].

Returns:
rhofloat or ndarray

Depolarization factor.

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

Saturation vapor pressure of water of moist air.

Parameters:
temperaturefloat

Atmospheric temperature [K].

Returns:
Efloat

Saturation vapor pressure [hPa].

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

Calculates the Rayleigh-scattering cross section per molecule.

Parameters:
wavelengthfloat

Wavelength [nm].

pressurefloat or ndarray

The atmospheric pressure [hPa].

temperaturefloat or ndarray

The atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

rhfloat or ndarray

Relative humidity from 0 to 100 [%].

Returns:
sigfloat or ndarray

Rayleigh-scattering cross section [m2].

ppcpy.misc.molecular.rayleigh_scattering(wavelength: float, pressure: float | ndarray, temperature: float | ndarray, C: float, rh: float | ndarray) tuple[source]#

Calculate the molecular volume backscatter coefficient and extinction coefficient.

Parameters:
wavelengthfloat

Wavelength in nanometers [nm].

pressurefloat or ndarray

Atmospheric pressure [hPa].

temperaturefloat or ndarray

Atmospheric temperature [K].

Cfloat

CO2 concentration [ppmv].

rhfloat or ndarray

Relative humidity as a percentage (0 to 100).

Returns:
beta_molfloat or ndarray

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

alpha_molfloat or ndarray

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

Notes

History

  • 2017-12-16: First edition by Zhenping.

  • 2024-12-03: AI-Translated.

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.

ppcpy.misc.molecular.calc_profiles(met_profiles: list, wavelengths: list = [355, 387, 407, 532, 607, 1058, 1064], CO2: float = 400, flagPicassoComparison: bool = False) dict[source]#

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

Parameters:
met_profileslist

List of xarray averaged meteorology profiles

wavelengthslist, optional

List of wavelengths to perform the rayleigh scattering calculation [nm]. Default is [355, 387, 407, 532, 607, 1058, 1064]

CO2float, optional

CO2 concentration [ppmv].

flagPicassoComparisonbool, optional

If true, use Picasso values and logic. Default is False.

Returns:
dict

Molecular backscatter, extinction, and number density profiles for each input wavelength.

ppcpy.misc.molecular.calc_2d(met: Dataset, wavelengths: list = [355, 387, 407, 532, 607, 1058, 1064], CO2: float = 400, flagPicassoComparison: bool = False) Dataset[source]#

For a two dimensional xarray dataset of meteorology profiles, calculate the rayleigh scattering.

Parameters:
metDataset

Dataset of meteorology profiles (temperature, pressure, relative humidity, specific humidity).

wavelengthslist, optional

List of wavelengths to perform the rayleigh scattering calculation [nm]. Default is [355, 387, 407, 532, 607, 1058, 1064]

CO2float, optional

CO2 concentration [ppmv].

flagPicassoComparisonbool, optional

If true, use Picasso values and logic. Default is False.

Returns:
ds_molxr.Dataset

xarray dataset with dimensions time and height and variables molecular backscatter (mBsc) and molecular extinction (mExt) per wavelength.

ppcpy.misc.plot#

ppcpy.misc.plot.plot_optical_analysis(profiles, height, times, plot_settings={}, smooth=None, refH=None)[source]#

quick first version of the optical profiles plotting function

ppcpy.misc.pollyChannelTags#

ppcpy.misc.pollyChannelTags.pollyChannelTags(chTagsIn: list, **Channels) list[source]#
ppcpy.misc.pollyChannelTags.polly_config_channel_corrections(chTagsOut_ls, polly_config_dict)[source]#
ppcpy.misc.pollyChannelTags.pollyChannelflags(channel_dict_length, **Channels)[source]#

ppcpy.misc.startscreen#

ppcpy.misc.startscreen.startscreen()[source]#