source: branches/publications/ORCHIDEE_CAMEO_gmd_2022/src_parameters/script_livestockparametersvar.awk

Last change on this file was 6929, checked in by maureen.beaudor, 4 years ago

adding the scripts for livestock parameters files generation

File size: 4.9 KB
Line 
1BEGIN{
2FS="::"
3toanalyse=0
4okprintomp=0
5
6print "! MODULE       : livestock_parameters_var                                                                                                                                                                                                                                                                                   "
7print "!                                                                                                                                                                                                                                                                                                                     "
8print "! CONTACT      : orchidee-help _at_ listes.ipsl.fr                                                                                                                                                                                                                                                                    "
9print "!                                                                                                                                                                                                                                                                                                                     "
10print "! LICENCE      : IPSL (2011)                                                                                                                                                                                                                                                                                          "
11print "! This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC                                                                                                                                                                                                                                    "
12print "!                                                                                                                                                                                                                                                                                                                     "
13print "!>\BRIEF        This module contains the variables in function of livestock type (livestock).                                                                                                                                                                                                                         "
14print "!!                                                                                                                                                                                                                                                                                                                    "
15print "!! DESCRIPTION: This module contains the declarations for the externalized variables in function of the                                                                                                                                                                                                       "
16print "!!                livestock type(livestock). \n                                                                                                                                                                                                                                                                       "
17print "!!                The module is already USE in module livestock_parameters. Therefor no need to USE it seperatly except                                                                                                                                                                                               "
18print "!!                if the subroutines in module livestock_parameters are not needed.\n                                                                                                                                                                                                                                         "
19print "!!                                                                                                                                                                                                                                                                                                                    "
20print "!! RECENT CHANGE(S): None                                                                                                                                                                                                                                                                                             "
21print "!!                                                                                                                                                                                                                                                                                                                    "
22print "!! REFERENCE(S) : None                                                                                                                                                                                                                                                                                                "
23print "!!                                                                                                                                                                                                                                                                                                                    "
24print "!! SVN          :                                                                                                                                                                                                                                                                                                     "
25print "!! $HeadURL: $                                                                                                                                                                                                                                                                                                        "
26print "!! $Date: $                                                                                                                                                                                                                                                                   "
27print "!! $Revision: $                                                                                                                                                                                                                                                                                               "
28print "!! \n                                                                                                                                                                                                                                                                                                                 "
29print "!_ ================================================================================================================================                                                                                                                                                                                   "
30print "                                                                                                                                                                                                                                                                                                                      "
31print "MODULE livestock_parameters_var                                                                                                                                                                                                                                                                                       "
32print "                                                                                                                                                                                                                                                                                                                      "
33print "  USE defprec                                                                                                                                                                                                                                                                                                         "
34print "                                                                                                                                                                                                                                                                                                                      "
35print "  IMPLICIT NONE                                                                                                                                                                                                                                                                                                       "
36
37
38print " INTEGER(i_std), ALLOCATABLE, SAVE, DIMENSION(:) :: livestock_to_lmtc  !! Table of conversion : we associate one pft to one metaclass "
39print "                                                                 !! (1-13, unitless)"
40print "!$OMP THREADPRIVATE(livestock_to_lmtc)"
41print
42print " LOGICAL, SAVE   :: l_first_livestock_parameters = .TRUE.             !! To keep first call trace of the module (true/false)"
43print "!$OMP THREADPRIVATE(l_first_livestock_parameters)"
44
45}
46{
47    if($2!="")
48    { 
49
50        if(toanalyse &&(myvar != "")&& !okprintomp)
51        {
52            print "!$OMP THREADPRIVATE("myvar")"
53        }
54
55        okprintomp=0
56        var="echo \""$2"\"|sed -e 's/\=\.\*//'"
57        var | getline myvar
58        close(var)
59
60        var="echo \""myvar"\"|sed -e 's/_lmtc//'"
61        var | getline myvar
62        close(var)
63
64        var="echo \""myvar"\"|sed -e 's/\ //g'"
65        var | getline myvar
66        close(var)
67
68
69        if(myvar=="nlmc") toanalyse=1
70
71        if(myvar=="nlmc") myvar="nlm"
72        if(myvar=="LMTC_name") myvar="LIVESTOCK_name"
73
74        if(myvar=="nlm")
75        {
76            declar="echo \""$1"\"|sed -e 's/PARAMETER/SAVE/'"
77            declar | getline mydeclar
78            close(declar)
79        }
80        else
81        {
82            declar="echo \""$1"\"|sed -e 's/PARAMETER/ALLOCATABLE, SAVE/'"
83            declar | getline mydeclar
84            close(declar)
85        }
86        declar="echo \""mydeclar"\"|sed -e 's/nlmc/:/'"
87        declar | getline mydeclar
88        close(declar)
89
90
91        comment="echo \""$2"\"|sed -e 's/\\(.*\\)\!!\\(.*\\)/!!\\2/'"
92        comment | getline mycomment
93        close(comment)
94
95       
96        if(toanalyse) printf("\n%s %s %s\t%s\n", mydeclar, " :: ",myvar,mycomment)
97    }
98    else
99    {
100        comment="echo \""$1"\"|sed -e 's/\ //g'"
101        comment | getline mycomment
102        close(comment)
103        if(substr(mycomment,1,1)=="!") 
104        {
105            if(!okprintomp &&(myvar != "") )
106            {
107                print "!$OMP THREADPRIVATE("myvar")"
108                okprintomp=1
109            }
110            if(toanalyse) print $0
111        }
112        else
113        {
114            comment="echo \""$1"\"|sed -e 's/\\([^!]*\\)\\(.*\\)/\\2/'"
115            comment | getline mycomment
116            close(comment) 
117            if(toanalyse &&(mycomment!="")) printf("\t\t\t\t\t\t\t\t%s\n",mycomment)
118        }
119    }
120}
121END{
122    print "!$OMP THREADPRIVATE("myvar")"
123    print "END MODULE livestock_parameters_var"
124}
Note: See TracBrowser for help on using the repository browser.