Introducing the RC files

By providing inputs to scripts around TM5 and also to the TM5
executable at runtime, TM5 Resource Configuration (rc) files became the
main interface with the model.

TM5 works with one main rc file, which refers to 3 other rcfiles: one
for the meteo settings, one for advanced model settings, and one for
the hardware settings. The latter may itself include a compiler
specific rc file. When using the chemistry module, another file with
emissions information is also included.


An rc file is an ASCII (text) file that defines variables in a flexible way.
A value is simply assigned to a variable (or key) name as:
name : value
where value can be a anything, numbers or characters, lists,
but also some special variables described below. Finally:

  • Lines that start with an exclamation mark (!) are comments.
  • Empty lines are ignored.

Special Variables

There are four types of special variables.

Parameter Substitution

Basic variable expansion in rc file is available and similar to
variable expansion found in Unix/Linux shells. The variables
${var} or $var are expanded when read by the script that
process rc files. Two cases are possible:

  • If var refers to another key in the rc file, the value of that key is used, even if it appears after in the file, or in an encapsulated file.
  • If var refers to an environment variable, the value of that variable will be used. For example, ${PWD} will be replaced by the path to current directory when the file is read.

Predefined keys

Two predefined keys are available:
  • ${pid} : evaluates to the process id of the calling script
  • ${script} : evaluates to the name of the calling script

<var> keys

Defined only for post/pre-processing, <...> variables are only expanded
by the underlying python script that uses the pre/postprocessing keys.
Currently available are:

  • <output.dir> : fully qualified path to the main (top) output directory
  • <rcfile> : name of the rc file
  • <bindir> : bin directory, where the executable is found

%{var} keys

Those are similar to ${..} but expanded only at the end of the run in the "rs" file. See post-processing settings, where this
type of key is used, for details and example. If no "rs" file is found, the rc file is searched for the key.


  • Rc file names have typically the ".rc" extension. It is recommended to follow this convention.
  • The my.* keys are just intermediate keys and not read by the scripts or the program. They are only used to fill other keys in the rc file.


Additional flexibility is obtained with the possibility to include one
rc file into another. The syntax is:

#include /path/to/another/rcfile.rc

The path can be relative to the current directory. TM5 uses this
feature to separate advanced meteo and hardware settings from the main rc file.

Script Snippet

It is also possible to include python code within an rc file. This technique should be used with parsimony, and limited to "if..then..else" tests. You can find several examples in the
distributed rc files.

Coloured syntax in emacs

Add the following to your .emacs file:

(require 'generic-x)
(setq auto-mode-alist (append '(("\\.rc$" . x-resource-generic-mode)) auto-mode-alist))

Coloured syntax in Vi, Vim, gVim

You need the rc.vim file, which is available in the rc directory of the model. Put it in your


To link the extension *.rc to the filetype rc in vim, open (or create if missing):


and add this line:

au BufNewFile,BufRead *.rc    setf rc

This literally means: If you open or read a file of which the name fulfills '*.rc', then set the file type to 'rc'. The latter means that for syntax highlighting ~/.vim/rc.vim is taken.

It is possible that this line is already in filetype.vim because of another format with the name 'rc'. Just replace it then.