User interface : RC files

From tm5
Jump to: navigation, search

By providing inputs to scripts around TM5 and also to the TM5 executable at runtime, TM5 Resource Configuration (rc) files are 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 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, series of them, but also some special variables descirbed below.

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:

Predefined keys

Two predefined keys are available:

${pid}       : evalutates to the process id of the calling script
${script}    :  "          "  "   name       "  "   "       "

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



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

Personal tools