source: CONFIG/IPSLCM/IPSLCM5-2/EXPALL/CARD/CpiControl/COMP/lmdz_analyse_stomate_out.awk @ 1550

Last change on this file since 1550 was 1549, checked in by jgipsl, 13 years ago

Added directory EXPALL which contains the possibility to run all 5
experiences :

  • DRIVER : contains all *.driver before in COMP directory (the drivers are the same for all experiences)
  • PARAM : all files from EXP00/PARAM (not yet adapted for all experiences)
  • CARD : this directory contains one subdirectory per experience; hitorical, piControl, etc...
  • CARD/XXX : contains all *.card necessary to run experience XXX

*This revision contains the PARAM only for EXP00. In next commit,
modifications will be done so that all experience can be run correctly.
*Must be run with a modifcation in libIGCM concerning the DRIVER
directory.

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1#!/usr/bin/awk -f
2# lmdz_analyse_stomate_out - filter ORCHIDEE node output :
3# command :
4# lmdz_analyse_stomate_out.awk [-d] out_orchidee[_0000]
5
6#**************************************************************
7# Author: Martial.Mancip
8# Contact: Martial.Mancip__at__ipsl.jussieu.fr
9# $Revision:: 373                                      $ Revision of last commit
10# $Author:: sdipsl                                     $ Author of last commit
11# $Date:: 2010-10-29 12:37:36 +0200 (Fri, 29 Oct 2010) $ Date of last commit
12# IPSL (2006)
13#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
14#
15#**************************************************************
16
17#==========================
18function myprint(str) {
19  if (debug) {
20     print str
21  }
22}
23
24
25#==========================
26BEGIN {
27 # print "traitement de " ARGV[1]
28
29  nbarg=ARGC
30
31  if (ARGV[1] == "-d") {
32    debug=1
33    file=ARGV[2]
34    delete ARGV[1] 
35    nbarg--
36  } else {
37    debug=0
38    file=ARGV[1]
39  }
40
41  exit_value=0
42  if (nbarg != 2) {
43        print "Usage: lmdz_analyse_stomate_out.awk [-d] file"
44        exit_value=-1
45        exit
46  }
47
48  line=0
49
50  fluxCarbon_found=0
51  counterCO2=0
52
53  fluxLU_found=0
54  counterLU=0
55
56  fluxNBP_found=0
57  counterNBP=0
58
59  CO2file[1]=""
60  LUfile[1]=""
61  NBPfile[1]=""
62}
63
64#==========================
65{
66
67#  myprint($0)
68
69  line=line+1
70
71  if (match($0, ".*GLOBAL net_co2_flux_monthly.*")) {
72    myprint("fluxCarbon_found = 1")
73    fluxCarbon_found=1
74    counterCO2=counterCO2+1
75
76    nb=split($0,felts, "=")
77    myprint("nb  :" nb)
78    for (elt in felts) {
79        myprint(elt "- elt  :" felts[elt])
80    }
81    myprint("elts_co2  :" felts[2])
82
83    CO2file[counterCO2]=felts[2]
84  }
85  else if (match($0, ".*GLOBAL net_cflux_prod_monthly.*")) {
86    myprint("fluxLU_found = 1")
87    fluxLU_found=1
88    counterLU=counterLU+1
89
90    nb=split($0,felts, "=")
91    myprint("nb  :" nb)
92    for (elt in felts) {
93        myprint(elt "- elt  :" felts[elt])
94    }
95    myprint("elts_co2  :" felts[2])
96
97    LUfile[counterLU]=felts[2]
98  }
99
100  else if (match($0, ".*GLOBAL net_biosp_prod_monthly.*")) {
101    myprint("fluxNBP_found = 1")
102    fluxNBP_found=1
103    counterNBP=counterNBP+1
104
105    nb=split($0,felts, "=")
106    myprint("nb  :" nb)
107    for (elt in felts) {
108        myprint(elt "- elt  :" felts[elt])
109    }
110    myprint("elts_nbp  :" felts[2])
111
112    NBPfile[counterNBP]=felts[2]
113  }
114}
115
116#==========================
117END {
118  if ( exit_value != -1 ) {
119
120    if ( fluxCarbon_found == 1 ) {
121        myprint("CO2 value for " file)
122        myprint("counterCO2  :" counterCO2)
123        for (i=1; i<=counterCO2; i++) { 
124            print CO2file[i]
125            myprint("value  :" CO2file[i])
126        }
127
128        if ( fluxLU_found == 1 ) {
129            myprint("LU value for " file)
130            myprint("counterLU  :" counterLU)
131            for (i=1; i<=counterLU; i++) {
132                print LUfile[i]
133                myprint("value  :" LUfile[i])
134            }
135
136            if ( fluxNBP_found == 1 ) {
137               myprint("NBP value for " file)
138               myprint("counterNBP  :" counterNBP)
139               for (i=1; i<=counterNBP; i++) { 
140                    print NBPfile[i]
141                    myprint("value  :" NBPfile[i])
142               }
143           
144               exit_value=0
145               exit 0
146            }
147            else {
148                 myprint("ERROR : NO NBP value for " file)
149                 print "0003"
150                 exit 1
151            }
152
153            exit_value=0
154            exit 0
155        }
156        else {
157            myprint("ERROR : NO LU value for " file)
158            print "0002"
159            print "0003"
160            exit 1
161        }
162    }
163    else {
164         myprint("ERROR : NO CO2 value for " file)
165         print "0001"
166         print "0002"
167         print "0003"
168         exit 1
169       }
170  }
171  else {
172      print "0000"
173      exit 1
174  }
175}
Note: See TracBrowser for help on using the repository browser.