wiki:Documentation/UserGuide/CompareRunDefs

How to compare run.def files from different model versions

Author: S. Luyssaert, L. Fairhead

Last revision: 2020/02/28 P. Maugis

Older versions of ORCHIDEE use a single 'run.def' file whereas newer versions make use of three : 'run.def', 'orchidee.def' and 'orchidee_pft.def'. How to compare the single used run.def of an old version with these three new ones? Also, following changes in the model configurations information could be moved from one xxx.def to another, i.e., a parameter could be made pft-specific.

Laurent Fairhead (LMDz) proposed the following to compare two .def files:

  1. copy the script below to a file, for example 'comp_rundef.sh'
    #!/bin/bash
    awk '!/^#/' $1 |awk '/\y/'| sort -u > tmp1
    awk '!/^#/' $2 |awk '/\y/'| sort -u > tmp2
    diff -y --suppress-common-lines tmp1 tmp2
    \rm -r tmp1 tmp2
    
  2. make that file executable: chmod +x comp_rundef.sh
  3. run the script, specifying your two files to compare: ./comp_rundef.sh <file1.def> <file2.def>

This will allow you to compare files two by two. Files 'tmp1' and 'tmp2' will be created or overwritten then deleted, so if they are precious to you, you should move/rename them before running the script.

If you want to compare an old-version run.def file with the three new-version ones, or two versions that use both three .def files, you can gather them three by three in single files, then use the script above with the new bunches. For example:

# to compare 3 .def files in 'path1' to 1 run.def file in 'path2'
cat path1/run.def path1/orchidee.def path1/orchidee_pft.def > path1/tot.def
./comp_rundef.sh path1/tot.def path2/run.def

# to compare 3 .def files in 'path1' to 3 .def files in 'path2'
cat path1/run.def path1/orchidee.def path1/orchidee_pft.def > path1/tot.def
cat path2/run.def path2/orchidee.def path2/orchidee_pft.def > path2/tot.def
./comp_rundef.sh path1/tot.def path2/tot.def

This allows you to compare prescribing .def files that the modele reads at start to get your options. If you want to compare the full set of options that were effectively used during the run, you should process as above but using instead 'used_run.def' and 'used_orchidee.def' and 'used_orchidee_pft.def' if any.

Last modified 4 years ago Last modified on 2020-05-11T17:41:25+02:00