lbl2xs
index
/users/schrei_f/src/py4CAtS/lbl/lbl2xs.py

lbl2xs
 computation of line-by-line molecular absorption cross sections
 
 usage:
 lbl2xs [options] line_parameter_file(s)
 
 -h            help
 -c  char      comment character(s) used in input,output file (default '#')
 -o  string    output file for saving of cross sections (if not given: write to StdOut)
               (in case of a list of input files / molecules, use a star as wildcard:
                this will be replaced by the molecule name)
 
 -p  float(s)  pressure(s) (in mb,  default: p_ref of linefile, usually 1013.25mb=1atm)
 -T  float(s)  Temperature(s) (in K, default: T_ref of linefile, usually 296K)
--pT file      with list of pressures in mb (first column) and temperatures in K (second column)
--cpT 2ints    a pair of (non-negative) integers indicating the pressure and temperature columns in the pT file
               (default 0,1 for the very first and second column)
 
 -n  int       number of grids --- selects 'multigrid mode' for nGrids=2 or 3 (default) (nGrids=1 brute force)
 -g  int       gridRatio = ratio of coarse to fine grid spacing (only 2, 4, or 8, default 8)
 -W  float     transition from fine to coarse grid (in units of half widths, default 25.0)
 
 -a  float     air broadening half width, only used when not given in line list file
 -f  string    format for output file:  'a'='t'='xy' tabular ascii  OR  'h' hitran  OR  "."="p" pickled (default)
 -i  string    interpolation method   [default: '3' three-point Lagrange,  choices are one of "234lqcs"]
               (only required for multigrid approach or when cross sections for several p,T pairs are saved in xy format)
 -L  char      Lineshape: V(oigt), L(orentz), G(auss)     [default: Voigt]
 -s  float     sampling rate used for x-grid (default: 5.0 grid points per (mean) half width)
 -w  float     wing extension (cutoff wavenumber, default 10.0cm-1)
               (Currently no impact on the lbl computation,
               it only expands the interval set by the -x option when reading the line data files)
 -x  Interval  lower,upper wavenumbers (comma separated pair of floats [no blanks!],
                                       default set according to range of lines in datafile)
 
 If several line parameter files are given (usually for several molecules)
 AND if an output file (extension) has been specified (-o option)
 a cross section file will be generated for each line file:
 * if all line files have the same extension,
   the cross section files will have the old basename with the extension as specified by the -o option
 * otherwise the input file name will be augmented by the string specified as -o option
 
 For more information use
 lbl2xs --help

 
Modules
       
numpy

 
Functions
       
init_xSection(vLow, vHigh, gammaMean, sampling=5.0, gridRatio=1, nGrids=1, verbose=False)
Set up equidistant wavenumber grid appropriate to typical line width and allocate corresponding cross section array.
lbl2xs(lineData, pressure=None, temperature=None, xLimits=None, lineShape='Voigt', sampling=5.0, nGrids=3, gridRatio=8, nWidths=25.0, lagrange=2, verbose=False)
Compute cross sections for some molecule(s) and some pressure(s),temperature(s) by summation of line profiles.
 
The returned data depends on the type of the incoming lineData, pressure, and temperature:
* lineData dictionary:  a dictionary of (list of) cross section dictionaries, molecule-by-molecule
* lineData list:        a list       of (list of) cross section dictionaries, molecule-by-molecule
* lineData (structured) numpy array:
  If there are several pressure(s) or temperature(s), a list of cross section dictionaries is returned;
  For a single p,T a 'plain' cross section dictionary is returned.
 
For each mol,p,T a subclassed numpy array "xsArray" is returned with the cross section 'spectrum'
(defined on an equidistant wavenumber grid)
along with attributes such as molecule, p, T, and wavenumber interval.
 
ARGUMENTS:
----------
 
lineData:     a structured numpy array of line core parameters for a single molecule
              or a dictionary/list thereof (for several molecules)
pressure:     a float or a list/array of floats with p[dyn/cm**2]
              (default:  line parameter database pressure)
              If a list is given, you can specify the pressure unit in the first or last entry.
temperature:  a float or a list/array of floats with T[K]
              (default:  line parameter database temperature)
xLimits:      Interval with lower and upper wavenumber [cm-1] (default: first and last line)
lineShape:    "Voigt" default, alternatives are:
              "Lorentz", "Gauss", "Rautian", "speed Voigt/Rautian", "vanVleck Huber/Weisskopf"
              optionally with line mixing
              short aliases:  SDV, SDVM, SDR, SDRM
sampling:     sampling rate used for x-grid (default: 5.0 grid points per (mean) half width)
nGrids:       number of grids used for speedup: 1 bruteforce; 2 coarse and fine; 3 coarse, medium, and fine
gridRatio:    ratio of grid point intervals in the finer to coarser grid (2, 4, or default: 8)
nWidths:      defines the limits of the fine grid (default: 25.0)
lagrange:     Lagrange 2 (default), 3, or 4 point interpolation for medium and coarse grid cross sections
lbl_2grids(positions, strengths, gammaL, gammaD, vLimits, sampling=5.0, gridRatio=8, nWidths=25.0, lagrange=3, verbose=False)
Compute lbl cross sections using two grids: fine grid near line center, coarse grid everywhere.
lbl_3grids(positions, strengths, gammaL, gammaD, uLimits, sampling=5.0, gridRatio=8, nWidths=25.0, lagrange=3, verbose=False)
Compute lbl cross sections using three grids: fine grid near line center, medium grid, and coarse grid everywhere.
(xs to be computed on monochromatic uniform grid in interval (uLow,uHigh) with spacing defined by half widths.
lbl_brute(voigtLines, vLimits, lineShape='Voigt', sampling=5.0, temperature=None, verbose=False)
Compute lbl cross sections the usual way (brute force, no cutoff in wings).
 
voigtLines    effective line parameters adjusted to p,T
              !!! for lineshapes "beyond Voigt" additional parameters are also included here !!!
vLimits       wavenumber limits (default: first and last line)
lineShape     default "voigt"  (NOTE:  lower case!)
sampling      number of grid points per mean half width (default 5.0)
temperature   to be used for vanVleck-Huber line shape
verbose

 
Data
        interpolationDict = {(2, 2): <function lagrange2_interpolate2>, (2, 4): <function lagrange2_interpolate4>, (2, 8): <function lagrange2_interpolate8>, (3, 2): <function lagrange3_interpolate2>, (3, 4): <function lagrange3_interpolate4>, (3, 8): <function lagrange3_interpolate8>, (4, 2): <function lagrange4_interpolate2>, (4, 4): <function lagrange4_interpolate4>, (4, 8): <function lagrange4_interpolate8>}
molecules = {'BrO': {'NumDeg': [1], 'TempExpGL': 0.5, 'TempExpQR': 1.0, 'VibFreq': [500.0], 'isotopes': ['69', '61'], 'mass': 95.0}, 'C2H2': {'NumDeg': [1, 1, 1, 2, 2], 'TempExpGL': 0.75, 'TempExpQR': 1.0, 'VibFreq': [3374.0, 1974.0, 3289.0, 629.0, 730.0], 'geisa': 24, 'hitran': 26, 'isotopes': ['1221', '1231', '1222'], 'mass': 26.03, 'sao': 26}, 'C2H4': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 'TempExpGL': 0.5, 'TempExpQR': 1.5, 'VibFreq': [3026, 1625, 1342, 1023, 3103, 1236, 949, 943, 3106, 826, 2989, 1444], 'geisa': 25, 'hitran': 38, 'isotopes': ['221', '311'], 'mass': 28.0}, 'C2H6': {'NumDeg': [1, 1, 1, 1, 1, 1, 2, 1, 2], 'TempExpGL': 0.75, 'TempExpQR': 1.9, 'VibFreq': [2899.0, 1375.0, 993.0, 275.0, 2954.0, 1379.0, 2994.0, 1486.0, 822.0], 'geisa': 22, 'hitran': 27, 'isotopes': ['1221', '1231'], 'mass': 30.07, 'sao': 27}, 'C2HD': {'NumDeg': [1, 1, 1, 2, 2], 'VibFreq': [3374.0, 1974.0, 3289.0, 629.0, 730.0], 'geisa': 48, 'isotopes': ['122'], 'mass': 17.0}, 'C2N2': {'NumDeg': [1, 1, 1, 1, 1], 'VibFreq': [2330, 846, 2158, 503, 234], 'geisa': 29, 'hitran': 48, 'isotopes': ['4224'], 'mass': 52.0}, 'C3H4': {'NumDeg': [1, 1, 1, 1, 1, 2, 2, 2, 2, 2], 'VibFreq': [3334, 2918, 2142, 1382, 931, 3008, 1452, 1053, 633, 328], 'geisa': 40, 'mass': 40.0}, 'C3H8': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...], 'VibFreq': [2977, 2962, 2887, 1476, 1462, 1392, 1158, 869, 369, 2967, 1451, 1278, 940, 216, 2968, 2887, 1464, 1378, 1338, 1054, ...], 'geisa': 28, 'isotopes': ['221'], 'mass': 44.0}, 'C4H2': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1], 'VibFreq': [3293, 2184, 874, 3329, 2020, 627, 482, 630, 231], 'geisa': 30, 'hitran': 43, 'isotopes': ['221'], 'mass': 50.0}, 'C6H6': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 'VibFreq': [3062, 992, 1326, 673, 3068, 1010, 995, 703, 1310, 1150, 849, 3063, 1486, 1038, 3047, 1596, 1178, 606, 975, 410], 'geisa': 47, 'isotopes': ['266'], 'mass': 78.0}, ...}
pressureUnits = {'N/m**2': 10.0, 'N/m^2': 10.0, 'Pa': 10.0, 'Torr': 1333.22, 'atm': 1013250.0, 'bar': 1000000.0, 'dyn/cm**2': 1.0, 'dyn/cm^2': 1.0, 'g/(cm*s**2)': 1.0, 'g/(cm*s^2)': 1.0, ...}