MAKGRD

Latest: MAKGRD v2.0 (20APR18) [Download]
03DEC23

Contents

Introduction

Part of the RFM handling of Irregular Spectral Grids (
.grd files)

MAKGRD is a Fortran90 program to convert a user-supplied list of spectral axis points into the RFM .grd file format.

General Comments

  1. A .grd file contains a series of '1's and '0's on a spectral fine grid (encoded in groups of 4 as hexadecimal characters): '1' indicates a fine grid point which is to be used for the spectral and radiative transfer calculations when the RFM GRD Flag is enabled (otherwise the RFM performs calculations at all fine grid points).
  2. Generating such a file is non-trivial (the format comes from the RFM's origins as a tool to support MIPAS processing), so this program has been written to to convert a simple list of spectral points in either wavenumber [cm-1] or frequency [GHz] units.
  3. The spectral points have to be in monotonically increasing order, and must all be integer multiples of some fundamental fine grid spacing, which the user also specifies.
  4. The default option is to produce an output .grd file which exactly matches the spectral range of the user-supplied points, but the user has the option of modifying this range (any extension being filled with '0' values).

Installing makgrd

Download the source code: [makgrd.f90]

Compile with any generic FORTRAN compiler, eg

gfortran makgrd.f90 -o makgrd

Running makgrd

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

A typical run might be (user responses in bold)

makgrd
R-MAKGRD: Running MAKGRD v2.0
Fundamental resolution: 0.0005 (Note 1)
File containing spectral points: points.txt (Note 2)
Output spectral range (= 800.0000: 800.8000 [cm-1]): <CR> (Note 3)
Output .grd file: points.grd
R-MAKGRD: Successful completion

The program should run almost instantaneously.

Notes

  1. It is assumed that the user-supplied set of irregular grid points represent a sub-sampling of some underlying regular grid.
  2. User's file containing the list of spectral points (see List file, below).
  3. At this point the user has the option of setting the output file to maintain the original spectral range of the supplied grid points, or of adjusting the range. If extended, the output file will simply be padded with '0's.

List file

The user supplies a set of spectral points in a file with the following format:
HEADER (optional)
NSPC
SPC(1) SPC(2) ..
... SPC(|NSPC|)
[eof]
Where the fields are defined as follows
FieldTypeDescriptionRange
HEADER C80 Comment record First character is '!'
NSPC I No.spectral points (-ve if GHz units) | NSPC | > 1
SPC D Spectral point value [cm-1] or [GHz]
Type: I=Integer; R=Real; D=Double Precision; Cn=character string, length n.

Notes

  1. If the first character of the first record is '!' then this is interpreted as a comment record and passed to the output file as the CONFIG record (see .grd file format). If there is no initial comment record, the name of the list file is written to the CONFIG record.
  2. The first non-comment record should contain just an integer indicating the number of spectral points to follow. A negative value of NSPC indicates that the points are in [GHz], while a positive value indicates [cm-1].
  3. Then follows the set of spectral points in monotonically increasing order, read free-format.

Examples

The following is an example of a
list of points, actually just sampling a 0.0005 cm-1 grid at 0.004 cm-1 spacing.

! test data 201 800.00000 800.00400 800.00800 800.01200 800.01600 800.02000 800.02400 800.02800 800.03200 800.03600 800.04000 800.04400 800.04800 800.05200 800.05600 ... 800.78000 800.78400 800.78800 800.79200 800.79600 800.80000

This file generates the following output .grd file

! test data ! Created by program makgrd.f90 v2.0 lin 1601 201 800.0000 0.0005 0.0 120.0 80808080808080808080808080808080808080808080808080 80808080808080808080808080808080808080808080808080 80808080808080808080808080808080808080808080808080 80808080808080808080808080808080808080808080808080 80808080808080808080808080808080808080808080808080 80808080808080808080808080808080808080808080808080 80808080808080808080808080808080808080808080808080 80808080808080808080808080808080808080808080808080 8

Error Messages

Fatal error messages may occur if there are I/O errors on the input or output files, if the spectral points are not multiples of the fundamental grid, or if the user specifies a modified output range which is inconsistent with the input data.

Version History

v2.00 (20APR18)
Recoded in FORTRAN 90 but, from the user's viewpoint, unchanged.
v1.00 (23JUL15)
Original code (F77)