FREQCOR_LUT_CF
Look-up table construction for spectral correction factors (CF).
Functions
Build the correction factor (CF) look-up table. |
Exceptions
|
Exception raised for errors in FREQCOR_LUT_CF. |
- exception FREQCOR_LUT_CF.FREQCORLUTCFError(message)[source]
Exception raised for errors in FREQCOR_LUT_CF.
- FREQCOR_LUT_CF.FREQCOR_LUT_CF(Icos_CF, nspec, sts, gss, WS, Zeta, WD, meteo_df, LUT_cof, classnum, classnumCF, nfreq, freq, freqn, sps, tf_sonic, tf_peltola, outputpath, plot, massman_coef, run_tag)[source]
Build the correction factor (CF) look-up table.
For each half-hourly cospectrum, the routine retrieves cut-off frequencies from LUT_cof, builds transfer functions (Lorentz/Gauss, optionally Peltola form), computes correction factors via numerical integration, then aggregates them into a LUT sorted by a first variable (wind direction for CO2 or relative humidity for H2O) and by wind speed classes.
CF LUT uncertainties: -
unc_*_tf: transfer-function-related uncertainty component, computed as themaximum deviation from the central CF value (“M”) within each WS class.
unc_*_sd: within-class spread of CF values, computed as the standard deviation of CF values after outlier removal.
Total uncertainties are not produced; users can recompute them from the component uncertainties if needed.
- Parameters:
Icos_CF (
pandas.DataFrame) – Cospectra used for CF computation.nspec (
int) – Number of total initial valid (co)spectra files.sts (
int) – Stability class selector (1: unstable, 2: stable).gss (
int) – Gas species selector.WS (
pandas.Series) – Wind speed, stability parameter, and wind direction time series.Zeta (
pandas.Series) – Wind speed, stability parameter, and wind direction time series.WD (
pandas.Series) – Wind speed, stability parameter, and wind direction time series.meteo_df (
pandas.DataFrame) – Half-hourly meteorological and flux data (used for RH when gss == 2).LUT_cof (
dict) – Cut-off frequency look-up table.classnum (
int) – Number of wind speed classes used for cut-off frequency LUT construction.classnumCF (
int) – Number of wind speed classes used for CF LUT construction.nfreq (
int) – Number of frequency bins.freq (
pandas.Series) – Natural frequencies (Hz).freqn (
pandas.DataFrame) – Normalized frequencies per time step.sps (
int) – Approach selector (cospectral or spectral).tf_sonic (
int) – If 1, apply theoretical correction to sonic cospectra.tf_peltola (
int) – If 1, use the Peltola et al. (2021) transfer function form where applicable.outputpath (
str) – Output directory.plot (
list[int]) – Plotting options selector.massman_coef (
array-like) – Massman coefficients for the site (e.g.,[A0, kf0, mu]).run_tag (
str) – Run identifier used to generate output filenames.
- Returns:
LUT_CF (
dict) – Correction factor look-up table.matsortCF (
pandas.DataFrame) – Sorting matrix with meteorology and correction factors (after filtering missing values).classize_ws (
int) – Number of (co)spectra used per wind speed class in the LUT.
- Raises:
ValueError – If run_tag is missing.
FREQCORLUTCFError – If there are not enough cospectra to populate the wind speed classes.