TABHDR

Latest: [Fortran90, 16DEC19] [Python, 25APR25]

08AUG24

Introduction

Part of the RFM handling of
Look-Up Tables (LUTs)

TABHDR is a Fortran90 program and a Python procedure to extract axis and profile information from RFM look-up tables of pre-tabulated absorption coefficient (.tab files, created using the TAB option).

For example, this could be useful for generating subsequent LUTs with similar axes to a given LUT (assuming the rfm.drv file used to generate the original LUT no longer exists).

General Comments

  1. This program can be run on any .tab file, in either ASCII or binary format.
  2. As well as a summary printed to the terminal, up to 5 files will be created containing axis and profile information:
    tab.pre
    Pressure axis values [hPa], in .dat file format, suitable as PFILE input in the *DIM section of the rfm.drv file.
    tab.tem
    Temperature axis values [K], suitable as TFILE input
    tab.vmr (only generated if more than 1 q-axis point in .tab file)
    VMR-scaling axis values [%], as QFILE input.
    tab.atm
    Pressure axis and embedded Temperature and VMR profiles in .atm file format, suitable as FILATM input in the *ATM section of the rfm.drv file.
    tab.grd (only generated for irregular spectral grid)
    Spectral grid values in .grd file format, suitable as FILGRD input in the *GRD section of the rfm.drv file.
    For the Fortran program, these filenames are fixed, set by fairly obvious PARAMETER statements near the top of the source code.

    The Python version is a procedure, and these filenames form part of the default parameters.

Installing TABHDR

Fortran: Download the program source [
tabhdr.f90] and the auxiliary modules [tabaux.f90]

Compile with any generic FORTRAN compiler, eg

gfortran tabaux.f90 tabhdr.f90 -o tabhdr

(although, if using binary .tab files, use the same compiler as for the RFM which created the original files — see Overview).

Python: Download the source [tabhdr.py] and the class object [rfm_tab_class.py]

Running TABHDR

To run the Fortran program, type tabhdr (or possibly ./tabhdr on some systems) and respond to the prompts.

A typical run might be (user input)

tabhdr R-TABHDR: Running TABHDR v2.0 Input file: tab_co.asc_cmp MolecID: 5 co Summary: NPts <---- Range ----> p-axis: 51 1.017E+03 1.955E-05 T-axis: 13 180. 300. q-axis: 1 100. 100. v-axis: 2501 2000.0000 2250.0000 Writing p-axis values to file: tab.pre Writing T-axis values to file: tab.tem Writing profile values to file: tab.atm Writing irregular spectral grid to file: tab.grd R-TABHDR: Succesful completion
The program takes a few seconds to run with an irregular grid (since every record has to be read) but is instantaneous with regularly gridded data (since only the file header is read).

The Python version is a procedure that could, for example, be run interactively within Python as

>>>from tabhdr import tabhdr >>>tabhdr('tab_co.asc_cmp') R-tabhdr: Running tabhdr v25APR25 MolecID: 5 co Summary: NPts <---- Range ----> p-axis: 51 1017 1.955e-05 T-axis: 13 180 300 q-axis: 1 100 100 v-axis: 2501 2000.0000 2250.0000 Writing p-axis values to file: tab.pre Writing T-axis values to file: tab.tem Writing profile values to file: tab.atm Writing irregular spectral grid to file: tab.grd R-tabhdr: Succesful completion >>>

Error Messages

The only error messages expected are associated with reading/writing files.

Version History

25APR25
Python version added
v2.0 (16DEC19)
Recoded in Fortran 90
v1.31 (05AUG15)
Change '$' in WRITE statements to avoid gfortran warnings
v1.3 (16APR15)
Correction: add local function MOLIDX
v1.2 (24FEB15)
Improve auto-detection of input file-type
v1.1 (17DEC14)
Allow for extra format identifier record in .tab file header
v1.00 (05NOV14)
Original code