Changes between Version 1 and Version 2 of Documentation/UserGuide/CompareRunDefs


Ignore:
Timestamp:
2020-02-28T16:47:46+01:00 (4 years ago)
Author:
pmaugis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/UserGuide/CompareRunDefs

    v1 v2  
    1 == Compare run.defs from different model versions == 
    2 Older versions of ORCHIDEE use a single run.def whereas newer version make use of a run.def an orchidee.def and a orchidee_pft.def. How to compare the single used run.def of an old version with these three new xxx.defs files? 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. 
     1== How to compare run.def files from different model versions == 
     2Author: S. Luyssaert, L. Fairhead 
     3 
     4Last revision: 2020/02/28 P. Maugis 
     5 
     6 
     7Older 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. 
     8 
    39  
    4 Laurent Fairhead (LMDz) proposed the following: (1) create a new file (make sure the permission for that file is rwx), (2) copy the script (see below in the file) and (3) run the script. 
    5 {{{  
    6 #!/bin/bash 
    7 awk '!/^#/' $1 |awk '/\y/'| sort > tmp1 
    8 awk '!/^#/' $2 |awk '/\y/'| sort > tmp2 
    9 diff -y --suppress-common-lines tmp1 tmp2 
    10 \rm -r tmp1 tmp2 
    11 }}} 
     10Laurent Fairhead (LMDz) proposed the following __to compare two .def files__:  
     111. copy the script below to a file, for example 'comp_rundef.sh' 
     12  {{{  
     13  #!/bin/bash 
     14  awk '!/^#/' $1 |awk '/\y/'| sort -u > tmp1 
     15  awk '!/^#/' $2 |awk '/\y/'| sort -u > tmp2 
     16  diff -y --suppress-common-lines tmp1 tmp2 
     17  \rm -r tmp1 tmp2 
     18  }}} 
     192. make that file executable: {{{chmod 755 comp_rundef.sh}}} 
     203. run the script, specifying your two files to compare: {{{./comp_rundef.sh <file1.def> <file2.def>}}} 
     21 
     22This 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. 
     23 
     24If 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: 
     25  {{{  
     26  # to compare 3 .def files in 'path1' to 1 run.def file in 'path2' 
     27  cat path1/run.def path1/orchidee.def path1/orchidee_pft.def > path1/tot.def 
     28  ./comp_rundef.sh path1/tot.def path2/run.def 
     29 
     30  # to compare 3 .def files in 'path1' to 3 .def files in 'path2' 
     31  cat path1/run.def path1/orchidee.def path1/orchidee_pft.def > path1/tot.def 
     32  cat path2/run.def path2/orchidee.def path2/orchidee_pft.def > path2/tot.def 
     33  ./comp_rundef.sh path1/tot.def path2/tot.def 
     34  }}} 
     35 
     36This allow 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.