TABMRG

Latest: TABMRG v2.0 (09MAR20) [Download]
20JUL23
Contents

Introduction

Part of the RFM handling of
Look-Up Tables.

tabmrg.f90 is a FORTRAN program to manipulate (in the spectral domain) RFM-generated look-up tables of pre-tabulated absorption coefficient (.tab files, created using the TAB option).

General Comments

  1. This program can only be used to merge files with the same molecule/isotope ID and with identical p,T,q axes and embedded profiles of Temperature and VMR. Therefore you should create the individual .tab files using the same RFM driver tables changing only the spectral range, and you should not run the tabcmp_x program on the component files before merging (since this changes the p,T,q tabulation axes).
  2. The program can be run on either ASCII or binary versions of the .tab file, and the output can be either binary or ASCII, and the program can also be used simply for converting between the two.
  3. The program asks for an output spectral range which by default is the minimum range spanning the input files. However it may be useful to extend the defined range with zero k-values (see Extending Range), or use this program to reduce the spectral range.
  4. Where multiple files are merged, in the case of any spectral overlaps data from the last file is used.

Installing tabmrg

Download the source code: [tabmrg.f90] and the auxiliary modules [tabaux.f90]

Copile with any generic FORTRAN compiler, eg

gfortran tabaux.f90 tabmrg.f90 -o tabmrg

NB: if using binary .tab files use the same compiler as for the RFM - see Binary Files.

Running tabmrg

The following is a rather contrived example just designed to show how the program works.

To run the program, type tabmrg and respond to the prompts (user-typed responses in red)

tabmrg R-TABMRG: Running TABMRG v2.0 List of input files, terminated with <CR> Input file: tab_co.asc_20-50 Input file: tab_co.asc_30-40 Input file: tab_co.asc_60-80 Input file: tab_co.asc_70-90 Input file: <CR> Summary of spectral ranges to be merged Index Wavenumber File# 1 2120.0000 1 1000 2129.9900 1 1001 2130.0000 2 2001 2140.0000 2 2002 2140.0100 1 3001 2150.0000 1 3002 2150.0100 Gap - set abs=0 3003 2159.9900 Gap - set abs=0 3004 2160.0000 3 4003 2169.9900 3 4004 2170.0000 4 6004 2190.0000 4 Range of new merged file (<CR>= 2120.0000 2190.0000): 2100 2180 Output file: tab_co.asc_00-80 STOP R-TABMRG: Successful completion

The program should take a few seconds at most, essentially just copying records from the input files to the output file

Notes

  1. The example merges 4 input files covering different spectral ranges (2120-2150 for file#1, 2130-2140 for file#2 etc)
  2. The Summary lists the structure of the merged data, specifically where the data source switches from one input file to another. Index refers to data points on the underlying fine grid, 0.001 cm-1 in the files used here. File# refers to the input file from which the data will be taken
  3. In this example there is also a gap in the input files from 2150-2160, the edges of which are also shown in the Summary.
  4. The output file range is, by default, the range spanned by the input files, but here the user extends the lower limit down to 2100 cm-1 and truncates the upper limit to 2180 cm-1.
  5. If the name of the output file contains the string .asc it will be an ASCII (text) file, .bin will produce a binary file, and if neither the output file will be the same type as the last input file.
  6. The output file header starts with an extra comment record indicating
    ! Merged/extended using program TABMRG v.2.0
    but otherwise copies that of the last input file, with the necessary adjustments to the spectral information.

Extending Range

A
.tab file contains a tabulation of absorption coefficient k [m2/kmol] over a defined spectral range, νLU, represented by the first and last data records within the file.

When re-used within the RFM as a Look-Up Table (entered via the *LUT section of the Driver Table) the file has to have a defined range completely spanning the spectral range (defined in the *SPC section of the Driver Table) for the RFM calculation otherwise it will be ignored and the RFM will revert to using HITRAN (*HIT) or cross-section (*XSC) data.

For example: the SF6 molecule has a single absorption feature between 925-955 cm-1. If a .tab file is created spanning just this range, it could not then be used for an RFM calculation over the range 900-1000 cm-1 since it contains no information on the SF6 absorption outside 925-955 cm-1 (the equivalent .xsc file which the RFM will then use by default also only contains the same spectral feature but the difference is that with .xsc files the RFM assumes zero absorption outside any tabulated cross-section data whereas with .tab files it makes no such assumption).

The crude solution would be to create the initial .tab file over the wider range, resulting in a much larger file containing many records at high spectral resolution with just k=0 values (although this could then be compressed with the tabcmp_v program).

The more elegant solution is simply to add four additional spectral points of k=0 values, so that the new .tab file contains the following spectral points

Thus the file now defines SF6 to have zero absorption beyond the original tabulated range out to new limits of 900 and 1000 cm-1.

The end values (900 and 1000 cm-1) are supplied by the user (and there is no advantage in restricting the range if you know that there are no other SF6 features that can be modelled, eg 0:10000 cm-1 makes the file even more versatile.

The additional records located at 924.999 and 955.001 cm-1 are inserted at intervals ∓δν relative to the original range νLU, where δν value = 0.001 is the fundamental resolution obtained from the input file header. This is to ensure that any absorption in, say, the range 900-924.999 cm-1 will be interpolated between two zero records rather than between zero at 900 cm-1 and whatever k value the original file contained at 925 cm-1.

Filling Gaps

In principle the spectral records of two files can be concatenated with the RFM then simply interpolating the k value (actually linearly in ln k) in the gap from the tabulated k values at the upper wavenumber limit of the first file ν1U and the lower limit of the second file ν2L (the .tab format always stores records in order of increasing wavenumber).

However this gives unpredictable values of k within the data gap ν1U2L since it depends on the tabulated values at the edges of the component files (although these are presumably small k value if they represent the edges of physical absorption bands).

A 'gap' is defined as a spectral interval greater than 2δν, where δν is the fundamental grid spacing of the input file. When a gap is encountered between files then two spectral points with k=0 values are inserted at the borders of the input file ranges: ν1U+δν, ν2L-δν, thus defining the absorption between bands to be zero.

Version History

v2.0 (09MAR20)
Convert to FORTRAN 90
v1.21 (05AUG15)
Change '$' in WRITE statements to avoid gfortran warnings
v1.2 (24FEB15)
Improve auto-detection of input file-type
v1.1 (21DEC14)
Allow for extra format identifier record in .tab file header
v1.01 (02DEC14)
Internal coding changes only, no difference to function.
v1.00 (04NOV14)
Original code