Latest: TABMRG v1.21 (05AUG15)




Part of the RFM handling of
Look-Up Tables.

tabmrg.f is a FORTRAN77 program to merge and/or extend (in the spectral domain) RFM-generated look-up tables of pre-tabulated absorption coefficient (.tab files, created using the TAB option). It can also be used simple for binary-ASCII conversion of .tab files.

Separate .tab files, each covering for example a particular absorption band of a molecule, can be merged into a single file with zero absorption assumed between the bands and over any additional spectral range outside the bands.

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).
  4. Where multiple files are merged, the files must be supplied in order of increasing upper wavenumber limit. Any spectral overlaps between files are removed with the first-supplied file taking precedence. So, for example, if merging two files covering ranges 940:941 cm-1 and 941:942 cm-1, the output file will use the k-values for 941.000 cm-1 from the first file. If you want to change this, you have to manually remove overlaps (in this case the 941.000 data from the first file) using the tabcut program.
  5. If a second file has a lower lower wavenumber limit than the first file, all records will be removed up to and including the upper wavenumber limit of the first file. You can't use this program to insert one file into another. Instead you have to cut the second file up (using the tabcut program) into the individual pieces that you want to concatenate.

Extending Range

.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.

To take an 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 would simply be 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 constant δν value = 0.001 is set by a program PARAMETER DVNOM. Even if the LUTs are used at finer spectral resolution than 0.001 cm-1, any spectral point within the range, say, νUU + δν will be interpolated between the (presumably) small original kU) value and the inserted zero kU+ δν) value, so it unlikely that the user will need to change this.

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 given by the PARAMETER DVNOM, i.e., greater than 0.002 cm-1. 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.

Installing tabmrg

First download the source code: [tabmrg.f]

Then compile with any FORTRAN77 compiler, eg

f77 tabmrg.f -o tabmrg

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

Running tabmrg

To run the program, type tabmrg and respond to the prompts.

A typical run might be (user responses in bold)

tabmrg R-TABMRG: Running TABMRG v1.0 List of input files, terminated with <CR> Input file: sf6_940_950.asc Input file: sf6_950_960.asc Input file: <CR> Summary of spectral ranges to be merged File# 1: 940.0000: 950.0000 File# 2: 950.0000: 960.0000 Truncated to 951.0000: 960.000 Range of new merged file (<CR>= 940.0000 960.0000): 900 1000 Output file: sf6_900_1000.asc 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


  1. The first line tells you which version (1.0) of the program is being executed.
  2. The second line asks you to start typing in the list of .tab files to be merged, terminating the list with a carriage return (<CR>)
  3. The user-supplied list of input files has to be in order of increasing upper wavenumber. These can be binary, ASCII or a mix.
  4. After the user has terminated the list of input files, the program prints a summary of the spectral ranges of each file. In this case both files contained a common spectral point at 950 cm-1, so this point is taken from the 1st file and values used from the 2nd file values start from the next spectral point, 951 cm-1 in this case.
  5. The next line asks the user to specify the output range, the default (typing <CR>) being the min/max spectral points in the input files. In this case an extended range is selected, 900-1000 cm-1 (see Extending Range). Any user-specified range must encompass the full spectral range of the input files (use the tabcut program if you want to reduce the range).
  6. The next line asks for the name of the merged file. If this contains the string ".bin" then it will be assumed that this is to be a binary file, otherwise ASCII.
  7. The processing finishes with a 'Successful Completion' message.

To use the program for basic ASCII to binary conversion,

tabmrg R-TABMRG: Running TABMRG v1.0 List of input files, terminated with <CR> Input file: sf6_900_1000.asc Input file: <CR> Summary of spectral ranges to be merged File# 1: 900.0000: 1000.0000 Range of new merged file (<CR>= 900.0000 1000.0000): <CR> Output file: sf6_900_1000.bin I-TABMRG: Converting to Binary file R-TABMRG: Successful completion

Note the additional message informing you that the input and output formats are different (similarly if you convert binary to ASCII).

Error Messages

When running the program, after responding to the prompt for the input file, the program may halt with a message printed to the terminal

F-RWAXIS: No.p*T*q-axis pts > MAXX'

This is because the total number of Np × NT × Nq axis points exceeds the local array size 10000. To fix this, edit the source code and set PARAMETER MAXX to be ≥ Np × NT × Nq. Similarly for other array size error messages.

Version History

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