1 | #!/bin/bash -x |
---|
2 | main='WRF+LMDZ_graphics.bash' |
---|
3 | errormsg='ERROR -- error -- ERROR -- error' |
---|
4 | HOMEpy=/home/lfita/etudes/WRF_LMDZ/svn/LMDZ_WRF/tools |
---|
5 | |
---|
6 | function variables_values(){ |
---|
7 | ## Function to provide values to plot the different variables |
---|
8 | # return: |
---|
9 | # 1: var name |
---|
10 | # 2: std name |
---|
11 | # 3: minimum |
---|
12 | # 4: maximum |
---|
13 | # 5: long name ('|' for spaces) |
---|
14 | # 6: units |
---|
15 | # 7: color palette (following: |
---|
16 | # http://matplotlib.org/1.3.1/examples/color/colormaps_reference.html) |
---|
17 | # |
---|
18 | # $ variables_values 'WRFght' |
---|
19 | # zg geopotential_height 0. 80000. geopotential|height m2s-2 rainbow |
---|
20 | |
---|
21 | fname='variables_values' |
---|
22 | |
---|
23 | variablesfile=${HOME}/bats/variables.inf |
---|
24 | |
---|
25 | if test ! -f ${variablesfile}; then |
---|
26 | echo ${errormsg} |
---|
27 | echo " "${fname}": variables file '"${variablesfile}"' does not exist !!!" |
---|
28 | fi |
---|
29 | |
---|
30 | case $1 in |
---|
31 | 'a_tht'|'LA_THT') varname='a_tht' ;; |
---|
32 | 'bils'|'LBILS') varname='bils' ;; |
---|
33 | 'clt'|'CLT'|'cldt'|'Total cloudiness') varname='clt' ;; |
---|
34 | 'cll'|'cldl'|'Low-level cloudiness') varname='cll' ;; |
---|
35 | 'clm'|'cldm'|'Mid-level cloudiness') varname='clm' ;; |
---|
36 | 'clh'|'cldh'|'High-level cloudiness') varname='clh' ;; |
---|
37 | 'dtcon'|'LDTCON') varname='dtcon' ;; |
---|
38 | 'evspsbl'|'QFX'|'evap'|'LEVAP') varname='evspsbl' ;; |
---|
39 | 'hfls'|'LH'|'flat'|'LFLAT') varname='hfls' ;; |
---|
40 | 'hfss'|'sens'|'LSENS') varname='hfss' ;; |
---|
41 | 'hus'|'WRFrh'|'LMDZrh') varname='hus' ;; |
---|
42 | 'huss'|'WRFrhs'|'LMDZrhs') varname='huss' ;; |
---|
43 | 'lat'|'XLAT') varname='lat' ;; |
---|
44 | 'lon'|'XLONG') varname='lon' ;; |
---|
45 | 'pr'|'RAINTOT'|'precip'|'Precip Totale liq+sol') varname='pr' ;; |
---|
46 | 'pracc'|'ACRAINTOT') varname='pracc' ;; |
---|
47 | 'prc'|'WRFprc'|'LPLUC'|'pluc') varname='prc' ;; |
---|
48 | 'pres'|'presnivs'|'pressure') varname='pres' ;; |
---|
49 | 'prls'|'WRFprls'|'LPLUL'|'plul') varname='prls' ;; |
---|
50 | 'prw'|'WRFprw') varname='prw' ;; |
---|
51 | 'ps'|'psfc'|'PSFC'|'psol'|'Surface Pressure') varname='ps' ;; |
---|
52 | 'q_th') varname='q_th' ;; |
---|
53 | 'r'|'QVAPOR') varname='r' ;; |
---|
54 | 'rsds'|'SWdnSFC'|'SWdn at surface'|'SWDOWN') varname='rsds' ;; |
---|
55 | 'rsdsacc') varname='rsdsacc' ;; |
---|
56 | 's_pblh'|'LS_PBLH') varname='zmla' ;; |
---|
57 | 's_pblt'|'LS_PBLT') varname='tmla' ;; |
---|
58 | 's_therm'|'LS_THERM') varname='s_therm' ;; |
---|
59 | 'ta'|'WRFt'|'temp'|'Air temperature') varname='ta' ;; |
---|
60 | 'tmlap'|'LS_PBLT'|'s_pblt') varname='tmla' ;; |
---|
61 | 'tas'|'T2'|'t2m'|'Temperature 2m') varname='tas' ;; |
---|
62 | 'time'|'time_counter') varname='time' ;; |
---|
63 | 'ua'|'vitu'|'U'|'Zonal wind') varname='ua' ;; |
---|
64 | 'uas'|'u10m'|'U10'|'Vent zonal 10m') varname='uas' ;; |
---|
65 | 'va'|'vitv'|'V'|'Meridional wind') varname='va' ;; |
---|
66 | 'vas'|'v10m'|'V10'|'Vent meridien 10m') varname='vas' ;; |
---|
67 | 'wake_h'|'LWAKE_H') varname='wakeh' ;; |
---|
68 | 'wake_s'|'LWAKE_S') varname='wakes' ;; |
---|
69 | 'wss'|'SPDUV') varname='wss' ;; |
---|
70 | 'xtime'|'XTIME') varname='xtime' ;; |
---|
71 | 'zg'|'WRFght'|'Geopotential height') varname='zg' ;; |
---|
72 | 'zmax_th'|'LZMAX_TH') varname='zmax_th' ;; |
---|
73 | 'zmla'|'LS_PBLH'|'s_pblh') varname='zmla' ;; |
---|
74 | *) |
---|
75 | echo $errormsg |
---|
76 | echo " "${fname}": variable '"$1"' not defined !!!" |
---|
77 | exit |
---|
78 | ;; |
---|
79 | esac |
---|
80 | |
---|
81 | varvals=`cat ${variablesfile} | grep ' '${varname}' ' | tr '@' ' '` |
---|
82 | varvalsT=`cat ${variablesfile} | grep ' '${varname}' ' | tr ' ' '#'` |
---|
83 | Lvarvals=`expr length ${varvalsT}'0'` |
---|
84 | |
---|
85 | if test ${Lvarvals} -le 1; then |
---|
86 | echo ${errormsg} |
---|
87 | echo " "${fname}": variable name '"${varname}"' not defined in file '" \ |
---|
88 | ${variablesfile}"' !!!" |
---|
89 | exit |
---|
90 | fi |
---|
91 | |
---|
92 | echo ${varvals} |
---|
93 | } |
---|
94 | |
---|
95 | function isin_list() { |
---|
96 | # Function to check whether a value is in a list |
---|
97 | list=$1 |
---|
98 | value=$2 |
---|
99 | |
---|
100 | is=`echo ${list} | tr ':' '\n' | awk '{print "@"$1"@"}' | grep '@'${value}'@' | wc -w` |
---|
101 | if test ${is} -eq 1 |
---|
102 | then |
---|
103 | true |
---|
104 | else |
---|
105 | false |
---|
106 | fi |
---|
107 | } |
---|
108 | |
---|
109 | ####### ####### |
---|
110 | ## MAIN |
---|
111 | ####### |
---|
112 | |
---|
113 | ifold='/bdd/PCER/workspace/lfita/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ' |
---|
114 | #ofold='/san0/lflmd/etudes/WRF_LMDZ/WaquaL/LMDZ' |
---|
115 | ofold='/bdd/PCER/workspace/lfita/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ' |
---|
116 | |
---|
117 | experiments='AR40:NPv31' |
---|
118 | #varkinds='mean:sfc:diag' |
---|
119 | varkinds='sfc' |
---|
120 | |
---|
121 | mean_variables='dim2mean|WRFt:dim2mean|U:dim2mean|V:dim2mean|WRFght:dim2mean|WRFrh' |
---|
122 | |
---|
123 | # Variables to compute longitudinal means for a Hovmoeller |
---|
124 | sfc_variables='dim2mean|T2:dim2mean|U10:dim2mean|V10:dim2mean|PSFC:dim2mean|RAINTOT:' |
---|
125 | sfc_variables=${sfc_variables}'dim2mean|SWDOWN:dim2mean|WRFprw:dim2mean|WRFrhs:' |
---|
126 | sfc_variables=${sfc_variables}'dim2mean|HFX:dim2mean|LH:dim2mean|Q2:' |
---|
127 | sfc_variables=${sfc_variables}'dim2mean|PBLH:dim2mean|QFX:' |
---|
128 | sfc_variables='dim2mean|RAINTOT' |
---|
129 | sfc_variables_AR40=${sfc_variables} |
---|
130 | sfc_variables_NPv31=${sfc_variables}':dim2mean|LWAKE_S:dim2mean|LWAKE_H:dim2mean|LS_THERM:' |
---|
131 | sfc_variables_NPv31=${sfc_variables_NPv31}'dim2mean|LZMAX_TH' |
---|
132 | |
---|
133 | # Variables to get from the diagnostics |
---|
134 | diag_variables='dim2mean|clt:dim2mean|cllmh:' |
---|
135 | diag_variables=${diag_variables}'dim2mean|WRFprc:dim2mean|WRFprls:' |
---|
136 | #diag_variables=${diag_variables}'dim2mean|WRFbils' |
---|
137 | |
---|
138 | # Variables to compute temporal means on a 2D map |
---|
139 | #var2Dtmeans_AR40='WRFprc:WRFprls:PBLH:QFX:HFX:LH:WRFbils' |
---|
140 | var2Dtmeans_AR40='WRFprc:WRFprls:PBLH:QFX:HFX:LH' |
---|
141 | var2Dtmeans_AR40='WRFprc:WRFprls:PBLH:QFX:HFX:LH:WRFbils:RAINTOT:U10:V10:T2:' |
---|
142 | var2Dtmeans_AR40=${var2Dtmeans_AR40}'PSFC:clt:cll:clm:clh:cllmh:WRFprw:Q2:pr:prw' |
---|
143 | |
---|
144 | var2Dtmeans_NPv31=${var2Dtmeans_AR40}':LWAKE_S:LWAKE_H:LS_THERM:LZMAX_TH' |
---|
145 | |
---|
146 | #inst_variables='mclt_lmdz:pr_lmdz:mwss' |
---|
147 | graph_couples_mean='hus@ta:va@ua' |
---|
148 | graph_couples_sfc='tas@ps:uas@vas:pr@rsds:prw@huss:prls@prc:' |
---|
149 | #graph_couples_sfc=${graph_couples_sfc}'hfls@hfss:evspsbl@bils' |
---|
150 | graph_couples_sfc=${graph_couples_sfc}'hfls@hfss' |
---|
151 | graph_couples_sfc_AR40=${graph_couples_sfc} |
---|
152 | graph_couples_sfc_NPv31=${graph_couples_sfc}':zmaxth@stherm:wakeh@wakes:zmaxth@stherm' |
---|
153 | graph_couples_diag='prls@prc:clt@cll:clh@clm' |
---|
154 | #graph_couples_z='dtcon@pluc' |
---|
155 | |
---|
156 | #graph_couples_diag='prls@prc' |
---|
157 | |
---|
158 | lon2DZsecvars='WRFt:U:V:WRFrh:WRFght' |
---|
159 | lon2DZsecpts=9:15:21 |
---|
160 | |
---|
161 | # Differences between experiments |
---|
162 | diffkinds='diffZ:diffH' |
---|
163 | diffZvars='ua:va:ta:hus' |
---|
164 | diffHvars='uas:vas:ps:pr' |
---|
165 | |
---|
166 | filenmean='vertical_interpolation_WRFp.nc' |
---|
167 | #ifoldmean='/media/data1/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ' |
---|
168 | ifoldmean='/bdd/PCER/workspace/lfita/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ' |
---|
169 | |
---|
170 | filensfc='wrfout_d01_1980-03-01_00:00:00' |
---|
171 | #ifoldsfc='/media/data1/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ' |
---|
172 | ifoldsfc='/bdd/PCER/workspace/lfita/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ' |
---|
173 | |
---|
174 | filendiag='diagnostics.nc' |
---|
175 | ifolddiag='/bdd/PCER/workspace/lfita/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ' |
---|
176 | |
---|
177 | timeval='tstep' |
---|
178 | zval='null' |
---|
179 | dimval='lon,lat,pressure,time' |
---|
180 | kindval='pdf' |
---|
181 | |
---|
182 | compute=0 |
---|
183 | computetlon=false |
---|
184 | plot=false |
---|
185 | single2Dplot=false |
---|
186 | lonZsec=false |
---|
187 | differences=true |
---|
188 | |
---|
189 | plevels='100000.,97500.,95000.,92500.,90000.,85000.,80000.,75000.,70000.,' |
---|
190 | plevels=${plevels}'65000.,60000.,55000.,50000.,45000.,40000.,35000.,30000.,' |
---|
191 | plevels=${plevels}'25000.,20000.,15000.,10000.,5000.,2500.,1000.,' |
---|
192 | plevels=${plevels}'500.,250.' |
---|
193 | |
---|
194 | # Couples to draw on a 2D map |
---|
195 | coup2D_AR40='prls@prc::zmla@tmla:hfls@hfss:evspsbl@bils' |
---|
196 | coup2D_NPv31=${coup2D_AR40}':wakeh@wakes:zmaxth@stherm' |
---|
197 | |
---|
198 | combosfile=${HOMEpy}/diagnostics.inf |
---|
199 | |
---|
200 | errmsg='ERROR -- error -- ERROR -- error' |
---|
201 | ####### ###### ##### #### ### ## # |
---|
202 | |
---|
203 | exps=`echo ${experiments} | tr ':' ' '` |
---|
204 | varks=`echo ${varkinds} | tr ':' ' '` |
---|
205 | |
---|
206 | istep=0 |
---|
207 | |
---|
208 | if test ${compute} -eq 1; then |
---|
209 | for exp in ${exps}; do |
---|
210 | echo "exp: "${exp} |
---|
211 | if test ${exp} == 'AR40'; then |
---|
212 | var2Dtmeans=${var2Dtmeans_AR40} |
---|
213 | else |
---|
214 | var2Dtmeans=${var2Dtmeans_NPv31} |
---|
215 | fi |
---|
216 | for vark in ${varks}; do |
---|
217 | echo " vark: "${vark} |
---|
218 | |
---|
219 | if test ${vark} = 'mean'; then |
---|
220 | fileorig=${ifoldmean}/${exp}/${filenmean} |
---|
221 | if test ! -f ${fileorig}; then |
---|
222 | fileworig=${filensfc} |
---|
223 | dvals='T:Time,Z:bottom_top,Y:south_north,X:west_east' |
---|
224 | dimnames='T:Time,Z:bottom_top,Y:south_north,X:west_east' |
---|
225 | python ${HOMEpy}/vertical_interpolation.py \ |
---|
226 | -f ${ofold}/${exp}/${filensfc} -o WRFp -i ${plevels} -k 'lin' \ |
---|
227 | -v WRFt,U,V,WRFrh,WRFght -d ${dimnames} -D T:Times,Z:ZNU,Y:XLAT,X:XLONG |
---|
228 | if test $? -ne 0; then |
---|
229 | echo ${errormsg} |
---|
230 | echo " python failed!" |
---|
231 | echo " python ${HOMEpy}/vertical_interpolation.py" \ |
---|
232 | "-f ${ofold}/${exp}/${filensfc} -o WRFp -i ${plevels} -k 'lin'" \ |
---|
233 | "-v WRFt,U,V,WRFrh,WRFght -d ${dimnames} -D T:Times,Z:ZNU,Y:XLAT,X:XLONG" |
---|
234 | rm ${ofold}/${exp}/vertical_interpolation_WRFp.nc >& /dev/null |
---|
235 | exit |
---|
236 | fi |
---|
237 | mv vertical_interpolation_WRFp.nc ${ofold}/${exp} |
---|
238 | fi |
---|
239 | vars=`echo ${mean_variables} | tr ':' ' '` |
---|
240 | ofile='mean_variables' |
---|
241 | elif test ${vark} = 'sfc'; then |
---|
242 | fileorig=${ifoldsfc}/${exp}/${filensfc} |
---|
243 | if test ! -f ${fileorig}; then |
---|
244 | fileworig=${filensfc} |
---|
245 | cp ${ifoldsfc}/${exp}/${fileworig} ${ifoldsfc}/${exp}/${filensfc} |
---|
246 | python ${HOMEpy}/nc_var.py -o WRF_CFxtime_creation -f ${ifoldsfc}/${exp}/${filensfc} \ |
---|
247 | -S 19491201000000,hours -v time |
---|
248 | python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -f ${ifoldsfc}/${exp}/${filensfc}\ |
---|
249 | -S longitude,latitude -v XLONG,XLAT |
---|
250 | fi |
---|
251 | if test ${exp} = 'AR40'; then |
---|
252 | vars=`echo ${sfc_variables_AR40} | tr ':' ' '` |
---|
253 | else |
---|
254 | vars=`echo ${sfc_variables_NPv31} | tr ':' ' '` |
---|
255 | fi |
---|
256 | ofile='sfc_variables' |
---|
257 | elif test ${vark} = 'diag'; then |
---|
258 | fileorig=${ifolddiag}/${exp}/${filendiag} |
---|
259 | vars=`echo ${diag_variables} | tr ':' ' '` |
---|
260 | if test ! -f ${fileorig}; then |
---|
261 | values='Time@XTIME,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
262 | ivar=0 |
---|
263 | varcombos='' |
---|
264 | for var in ${vars}; do |
---|
265 | echo " var:"${var} |
---|
266 | varn=`echo ${var} | tr '_' ' ' | awk '{print $2}'` |
---|
267 | combo=`python ${HOMEpy}/diagnostics.py -f ${combosfile} -d variable_combo -v ${varn}\ |
---|
268 | | grep COMBO | awk '{print $2}'` |
---|
269 | if test ${combo} = 'ERROR'; then |
---|
270 | echo ${errormsg} |
---|
271 | echo " No variable '"${varn}"' in '"${combosfile}"' !!" |
---|
272 | exit |
---|
273 | fi |
---|
274 | if test ${ivar} -eq 0; then |
---|
275 | varcombos=${varn}'|'${combo} |
---|
276 | else |
---|
277 | varcombos=${varcombos}','${varn}'|'${combo} |
---|
278 | fi |
---|
279 | ivar=`expr ${ivar} + 1` |
---|
280 | done |
---|
281 | python ${HOMEpy}/diagnostics.py -d ${values} -f ${ifoldsfc}/${exp}/${filensfc} -v \ |
---|
282 | ${varcombos} |
---|
283 | if test $? -ne 0; then |
---|
284 | echo ${errormsg} |
---|
285 | echo " python failed!!" |
---|
286 | echo python ${HOMEpy}/diagnostics.py -d ${values} -f ${ifoldsfc}/${exp}/${filensfc}\ |
---|
287 | -v ${varcombos} |
---|
288 | exit |
---|
289 | fi |
---|
290 | python ${HOMEpy}/nc_var.py -o WRF_CFxtime_creation -f diagnostics.nc \ |
---|
291 | -S 19491201000000,hours -v time |
---|
292 | python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -f diagnostics.nc \ |
---|
293 | -S longitude,latitude -v XLONG,XLAT |
---|
294 | mv diagnostics.nc ${ifolddiag}/${exp} |
---|
295 | fi |
---|
296 | ofile='diag_variables' |
---|
297 | elif test ${vark} = 'z'; then |
---|
298 | fileorig=${ifoldmean}/${exp}/${filenmean} |
---|
299 | vars=`echo ${z_variables} | tr ':' ' '` |
---|
300 | ofile='z_variables' |
---|
301 | fi |
---|
302 | |
---|
303 | # Averaging |
---|
304 | ## |
---|
305 | echo " averaging..." |
---|
306 | ivar=0 |
---|
307 | for varn in ${vars}; do |
---|
308 | file=${fileorig} |
---|
309 | echo " var: "${varn} |
---|
310 | var=`echo ${varn} | tr '|' ' ' | awk '{print $2}'` |
---|
311 | varval=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | grep all_values | awk '{print $3}'` |
---|
312 | varname=`echo ${varval} | tr ',' ' ' | awk '{print $1}'` |
---|
313 | |
---|
314 | echo " std name: "${varname} |
---|
315 | varhead=`echo ${varname} | tr '_' ' ' | awk '{print $1}'` |
---|
316 | vartail=`echo ${varname} | tr '_' ' ' | awk '{print $2}'` |
---|
317 | |
---|
318 | if test ${vark} = 'mean'; then |
---|
319 | vals='time:-1|z:-1|y:-1|x:-1,time:x,mean,pressure:lat' |
---|
320 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var} |
---|
321 | pyexec=$? |
---|
322 | if test ${pyexec} -ne 0; then |
---|
323 | echo ${errormsg} |
---|
324 | echo " "${main}": python fai1ls!" |
---|
325 | echo "python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var}" |
---|
326 | exit |
---|
327 | else |
---|
328 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
329 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${varname}${oper}.nc |
---|
330 | fi |
---|
331 | elif test ${vark} = 'z'; then |
---|
332 | vals='time:-1|z:-1|y:-1|x:-1,time:x,mean,pressure:lat' |
---|
333 | echo "NOT FINISHED!!!!" |
---|
334 | exit |
---|
335 | else |
---|
336 | vals='Time:-1|south_north:-1|west_east:-1,west_east,mean,time:XLAT' |
---|
337 | if test ${var} = 'ACRAINTOT'; then |
---|
338 | files='add|'${file}'|RAINC,add|'${file}'|RAINNC' |
---|
339 | python ${HOMEpy}/nc_var.py -S 'time|XLAT|XLONG@'${files} -o compute_opersvarsfiles \ |
---|
340 | -v ${var} |
---|
341 | mv opersvarsfiles_${var}.nc ${ofold}/${exp} |
---|
342 | file=${ofold}/${exp}/opersvarsfiles_${var}.nc |
---|
343 | elif test ${var} = 'RAINTOT'; then |
---|
344 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
345 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'RAINTOT|RAINC@RAINNC@time' -f ${file} |
---|
346 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
347 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
348 | var='pr' |
---|
349 | elif test ${var} = 'cllmh'; then |
---|
350 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
351 | clouds='cll:clm:clh' |
---|
352 | cls=`echo ${clouds} | tr ':' ' '` |
---|
353 | for cl in ${cls}; do |
---|
354 | file=${ofold}/${exp}/diagnostics.nc |
---|
355 | var=${cl} |
---|
356 | echo " var: "${var} |
---|
357 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cl} |
---|
358 | pyexec=$? |
---|
359 | if test ${pyexec} -ne 0; then |
---|
360 | echo ${errormsg} |
---|
361 | echo " "${main}": python fails!" |
---|
362 | echo python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cl} |
---|
363 | exit |
---|
364 | fi |
---|
365 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${cl}${oper}.nc |
---|
366 | vals='Time:-1|south_north:-1|west_east:-1,Time,mean,XLONG:XLAT' |
---|
367 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
368 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cl} |
---|
369 | pyexec=$? |
---|
370 | if test ${pyexec} -ne 0; then |
---|
371 | echo ${errormsg} |
---|
372 | echo " "${main}": python fails!" |
---|
373 | exit |
---|
374 | else |
---|
375 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
376 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${cl}t${oper}.nc |
---|
377 | fi |
---|
378 | done |
---|
379 | # break |
---|
380 | elif test ${var} = 'WRFbils' && test ! -f ${ofold}/${exp}/diagnostics_${varname}.nc; then |
---|
381 | dims='Time@time,south_north@XLAT,west_east@XLONG' |
---|
382 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'WRFbils|HFX@LH' -f ${file} |
---|
383 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
384 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
385 | var='bils' |
---|
386 | elif test ${var} = 'WRFprw' && test ! -f ${ofold}/${exp}/diagnostics_${varname}.nc; then |
---|
387 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
388 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'WRFprw|WRFdens@QVAPOR' -f ${file} |
---|
389 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
390 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
391 | var='prw' |
---|
392 | elif test ${var} = 'WRFrhs' && test ! -f ${ofold}/${exp}/diagnostics_${varname}.nc; then |
---|
393 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
394 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'WRFrhs|PSFC@T2@Q2' -f ${file} |
---|
395 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
396 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
397 | var='huss' |
---|
398 | elif test ${var} = 'WRFprc'; then |
---|
399 | vals='Time:-1|south_north:-1|west_east:-1,west_east,mean,time:XLAT' |
---|
400 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
401 | var='prc' |
---|
402 | elif test ${var} = 'WRFprls'; then |
---|
403 | vals='Time:-1|south_north:-1|west_east:-1,west_east,mean,time:XLAT' |
---|
404 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
405 | var='prls' |
---|
406 | fi |
---|
407 | if test ! -f ${ofold}/${exp}/${varname}${oper}.nc; then |
---|
408 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var} |
---|
409 | pyexec=$? |
---|
410 | if test ${pyexec} -ne 0; then |
---|
411 | echo ${errormsg} |
---|
412 | echo " "${main}": python fails!" |
---|
413 | exit |
---|
414 | else |
---|
415 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${varname}${oper}.nc |
---|
416 | fi |
---|
417 | fi |
---|
418 | fi |
---|
419 | echo "HereLluis"${var} |
---|
420 | # Time means |
---|
421 | if $(isin_list ${var2Dtmeans} ${var}); then |
---|
422 | echo "Computing time means!!" |
---|
423 | if test ${var} = 'cllmh'; then |
---|
424 | clouds='cll:clm:clh' |
---|
425 | clds=`echo ${clouds} | tr ':' ' '` |
---|
426 | for cld in ${clds}; do |
---|
427 | vals='Time:-1|south_north:-1|west_east:-1,Time,mean,XLONG:XLAT' |
---|
428 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
429 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cld} |
---|
430 | pyexec=$? |
---|
431 | if test ${pyexec} -ne 0; then |
---|
432 | echo ${errormsg} |
---|
433 | echo " "${main}": python fails!" |
---|
434 | exit |
---|
435 | else |
---|
436 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
437 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${cld}t${oper}.nc |
---|
438 | fi |
---|
439 | done |
---|
440 | else |
---|
441 | vals='Time:-1|south_north:-1|west_east:-1,Time,mean,XLONG:XLAT' |
---|
442 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
443 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var} |
---|
444 | pyexec=$? |
---|
445 | if test ${pyexec} -ne 0; then |
---|
446 | echo ${errormsg} |
---|
447 | echo " "${main}": python fails!" |
---|
448 | exit |
---|
449 | else |
---|
450 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
451 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${varname}t${oper}.nc |
---|
452 | fi |
---|
453 | fi |
---|
454 | fi |
---|
455 | if test ${var} = 'cllmh'; then exit; fi |
---|
456 | ivar=`expr ${ivar} + 1` |
---|
457 | # exit |
---|
458 | # end of vars |
---|
459 | done |
---|
460 | |
---|
461 | # end of kind vars |
---|
462 | done |
---|
463 | |
---|
464 | done |
---|
465 | # end of compute |
---|
466 | fi |
---|
467 | # Longitudinal means of tmeans |
---|
468 | ## |
---|
469 | if ${computetlon}; then |
---|
470 | echo "Computing Longitudinal means of temporal means..." |
---|
471 | for exp in ${exps}; do |
---|
472 | echo " exp:"${exp} |
---|
473 | for tmean in ${ofold}/${exp}/*tmean.nc; do |
---|
474 | fname=`basename ${tmean}` |
---|
475 | var=`ncdump -h ${tmean} | grep float | grep mean | tr '(' ' ' | awk '{print $2}'` |
---|
476 | vals='south_north:-1|west_east:-1,west_east,mean,XLAT' |
---|
477 | dims='bottom_top@bottom_top,south_north@south_north,west_east@west_east' |
---|
478 | if test ! -f ${ofold}/${exp}/${var}t-lonmean.nc; then |
---|
479 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${tmean} -v ${var} |
---|
480 | pyexec=$? |
---|
481 | if test ${pyexec} -ne 0; then |
---|
482 | echo ${errormsg} |
---|
483 | echo " "${main}": python fails!" |
---|
484 | exit |
---|
485 | else |
---|
486 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${var}t-lonmean.nc |
---|
487 | fi |
---|
488 | # exit |
---|
489 | fi |
---|
490 | done |
---|
491 | |
---|
492 | done |
---|
493 | fi |
---|
494 | |
---|
495 | if ${plot}; then |
---|
496 | # Plots |
---|
497 | ## |
---|
498 | |
---|
499 | for exp in ${exps}; do |
---|
500 | echo "exp: "${exp} |
---|
501 | for vark in ${varks}; do |
---|
502 | echo " vark: "${vark} |
---|
503 | if test ${vark} = 'mean'; then |
---|
504 | gcoups=`echo ${graph_couples_mean} | tr ':' ' '` |
---|
505 | elif test ${vark} = 'sfc'; then |
---|
506 | if test ${exp} = 'AR40'; then |
---|
507 | gcoups=`echo ${graph_couples_sfc_AR40} | tr ':' ' '` |
---|
508 | else |
---|
509 | gcoups=`echo ${graph_couples_sfc_NPv31} | tr ':' ' '` |
---|
510 | fi |
---|
511 | elif test ${vark} = 'diag'; then |
---|
512 | gcoups=`echo ${graph_couples_diag} | tr ':' ' '` |
---|
513 | fi |
---|
514 | |
---|
515 | for gpair in ${gcoups}; do |
---|
516 | shdvar=`echo ${gpair} | tr '@' ' ' | awk '{print $1}'` |
---|
517 | cntvar=`echo ${gpair} | tr '@' ' ' | awk '{print $2}'` |
---|
518 | echo " couple: "${shdvar}'-'${cntvar} |
---|
519 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${shdvar} | grep all_values | awk '{print $3}'` |
---|
520 | cntvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${cntvar} | grep all_values | awk '{print $3}'` |
---|
521 | files=${ofold}'/'${exp}'/'${shdvar}'mean.nc,'${ofold}'/'${exp}'/'${cntvar}'mean.nc' |
---|
522 | |
---|
523 | Lshdvals=`expr length ${shdvals}0` |
---|
524 | if test ${Lshdvals} -lt 2; then |
---|
525 | echo ${errormsg} |
---|
526 | echo " Error in drawing_tools.py 'variables_values'!!" |
---|
527 | echo " variable '"${shdvar}"' NOT found!" |
---|
528 | exit |
---|
529 | fi |
---|
530 | |
---|
531 | Lcntvals=`expr length ${cntvals}0` |
---|
532 | if test ${Lcntvals} -lt 2; then |
---|
533 | echo ${errormsg} |
---|
534 | echo " Error in drawing_tools.py 'variables_values'!!" |
---|
535 | echo " variable '"${cntvar}"' NOT found!" |
---|
536 | exit |
---|
537 | fi |
---|
538 | |
---|
539 | shdstdn=`echo ${shdvals} | tr ',' ' ' | awk '{print $1}'` |
---|
540 | shdcbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
541 | shdmin=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
542 | shdmax=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
543 | |
---|
544 | cntstdn=`echo ${cntvals} | tr ',' ' ' | awk '{print $1}'` |
---|
545 | cntmin=`echo ${cntvals} | tr ',' ' ' | awk '{print $3}'` |
---|
546 | cntmax=`echo ${cntvals} | tr ',' ' ' | awk '{print $4}'` |
---|
547 | |
---|
548 | if test ${shdstdn} = 'ERROR' || test ${cntstdn} = 'ERROR'; then |
---|
549 | echo ${errmsg} |
---|
550 | echo " "${main}": wrong variable names!!!" |
---|
551 | echo " shdvals: "${shdvals} |
---|
552 | echo " cntvals: "${cntvals} |
---|
553 | echo " shdvar: "${shdvar}" cntvar: "${cntvar} |
---|
554 | exit |
---|
555 | fi |
---|
556 | |
---|
557 | cntcolor='black' |
---|
558 | cntfmt='%g' |
---|
559 | |
---|
560 | if test ${gpair} = 'va@ua'; then |
---|
561 | shdmin=`echo ${shdmin} | awk '{print $1/4.}'` |
---|
562 | shdmax=`echo ${shdmax} | awk '{print $1/4.}'` |
---|
563 | cntmin=`echo ${cntmin} | awk '{print $1/3.}'` |
---|
564 | cntmax=`echo ${cntmax} | awk '{print $1 + 20.}'` |
---|
565 | elif test ${gpair} = 'tas@ps'; then |
---|
566 | shdmin=`echo ${shdmin} | awk '{print $1 + 50.}'` |
---|
567 | shdmax=`echo ${shdmax} | awk '{print $1 - 15.}'` |
---|
568 | cntmin=`echo ${cntmin} | awk '{print $1 + 15000.}'` |
---|
569 | cntmax=`echo ${cntmax} | awk '{print $1 - 2000.}'` |
---|
570 | elif test ${gpair} = 'uas@vas'; then |
---|
571 | cntmin=`echo ${cntmin} | awk '{print $1 * 0.1}'` |
---|
572 | cntmax=`echo ${cntmax} | awk '{print $1 * 0.1}'` |
---|
573 | elif test ${gpair} = 'pr@rsds'; then |
---|
574 | # shdmax=`echo ${shdmax} | awk '{print $1 / 20.}'` |
---|
575 | cntmax=`echo ${cntmax} | awk '{print $1 / 3.}'` |
---|
576 | elif test ${gpair} = 'clt@cll' || test ${gpair} = 'clh@clm'; then |
---|
577 | cntcolor='red' |
---|
578 | cntfmt='%.1g' |
---|
579 | elif test ${gpair} = 'clh@clm'; then |
---|
580 | cntmax=`echo ${cntmax} | awk '{print $1}'` |
---|
581 | elif test ${gpair} = 'prw@huss'; then |
---|
582 | shdmax=`echo ${shdmax} | awk '{print $1*4}'` |
---|
583 | elif test ${gpair} = 'prls@prc'; then |
---|
584 | shdmax=`echo ${shdmax} | awk '{print $1/1.}'` |
---|
585 | cntmax=`echo ${cntmax} | awk '{print $1 * 0.5}'` |
---|
586 | elif test ${gpair} = 'hfls@hfss'; then |
---|
587 | cntmin='-50.' |
---|
588 | cntmax='50.' |
---|
589 | fi |
---|
590 | |
---|
591 | if test ${vark} = 'mean'; then |
---|
592 | graphvals=${shdstdn}','${cntstdn}':z|-1,y|-1:z|-1,y|-1:lat:pressure:' |
---|
593 | graphvals=${graphvals}${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${shdmin}',' |
---|
594 | graphvals=${graphvals}${shdmax}':'${cntmin}','${cntmax}',9:LMDZ+WRF|'${exp} |
---|
595 | graphvals=${graphvals}'|meridional|monthly|average|of|'${shdstdn}'|&|' |
---|
596 | graphvals=${graphvals}${cntstdn}':pdf:flip@y:None' |
---|
597 | else |
---|
598 | graphvals=${shdstdn}','${cntstdn}':y|-1,time|-1:y|-1,time|-1:time:XLAT:' |
---|
599 | graphvals=${graphvals}${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${shdmin}',' |
---|
600 | graphvals=${graphvals}${shdmax}':'${cntmin}','${cntmax}',9:WRF+LMDZ|'${exp} |
---|
601 | graphvals=${graphvals}'|mean|meridional|evolution|of|'${shdstdn}'|&|' |
---|
602 | graphvals=${graphvals}${cntstdn}':pdf:None:time|hours!since!1949-12-01|' |
---|
603 | graphvals=${graphvals}'exct,5,d|%d|date!([DD]):None' |
---|
604 | fi |
---|
605 | |
---|
606 | echo ${files} |
---|
607 | echo ${graphvals} |
---|
608 | echo ${shdstdn}'mean,'${cntstdn}'mean' |
---|
609 | |
---|
610 | if test ${vark} = 'sfc' || test ${vark} = 'diag' && |
---|
611 | ! $(isin_list ${coup2D} ${gpair}); then |
---|
612 | python ${HOMEpy}/drawing.py -f ${files} -o draw_2D_shad_cont_time -S ${graphvals} -v \ |
---|
613 | ${shdstdn}'mean,'${cntstdn}'mean' |
---|
614 | pyexc=$? |
---|
615 | else |
---|
616 | python ${HOMEpy}/drawing.py -f ${files} -o draw_2D_shad_cont -S ${graphvals} -v \ |
---|
617 | ${shdstdn}'mean,'${cntstdn}'mean' |
---|
618 | pyexc=$? |
---|
619 | fi |
---|
620 | if test ${pyexc} -ne 0; then |
---|
621 | echo ${errormsg} |
---|
622 | echo " "${main}": drawing.py fails!" |
---|
623 | exit |
---|
624 | else |
---|
625 | mv 2Dfields_shadow-contour.pdf ${ofold}/${exp}/${shdvar}mean_${cntvar}mean.pdf |
---|
626 | evince ${ofold}/${exp}/${shdvar}mean_${cntvar}mean.pdf & |
---|
627 | fi |
---|
628 | |
---|
629 | if $(isin_list ${coup2D} ${gpair}); then |
---|
630 | graphvals=${shdstdn}','${cntstdn}':south_north|-1,west_east|-1:' |
---|
631 | graphvals=${graphvals}'south_north|-1,west_east|-1:longitude:latitude:' |
---|
632 | graphvals=${graphvals}${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${shdmin}',' |
---|
633 | graphvals=${graphvals}${shdmax}':'${cntmin}','${cntmax}',9:LMDZ+WRF|'${exp} |
---|
634 | graphvals=${graphvals}'|monthly|average|of|'${shdstdn}'|&|' |
---|
635 | graphvals=${graphvals}${cntstdn}':pdf:flip@y:None' |
---|
636 | echo ' '${shdstdn}'mean,'${cntstdn}'mean' |
---|
637 | |
---|
638 | python ${HOMEpy}/drawing.py -f ${files} -o draw_2D_shad_cont -S ${graphvals} -v \ |
---|
639 | ${shdstdn}'mean,'${cntstdn}'mean' |
---|
640 | pyexc=$? |
---|
641 | if test ${pyexc} -ne 0; then |
---|
642 | echo ${errormsg} |
---|
643 | echo " "${main}": drawing.py fails!" |
---|
644 | exit |
---|
645 | else |
---|
646 | mv 2Dfields_shadow-contour.pdf ${ofold}/${exp}/${shdvar}tmean_${cntvar}tmean.pdf |
---|
647 | evince ${ofold}/${exp}/${shdvar}tmean_${cntvar}tmean.pdf & |
---|
648 | fi |
---|
649 | fi |
---|
650 | # exit |
---|
651 | |
---|
652 | # end of couples |
---|
653 | done |
---|
654 | # end of kinds |
---|
655 | done |
---|
656 | |
---|
657 | done |
---|
658 | fi |
---|
659 | |
---|
660 | # 2D single plots |
---|
661 | ## |
---|
662 | if ${single2Dplot}; then |
---|
663 | echo "2D single plots" |
---|
664 | for exp in ${exps}; do |
---|
665 | echo " exp:"${exp} |
---|
666 | for tmean in ${ofold}/${exp}/*tmean.nc ;do |
---|
667 | fname=`basename ${tmean}` |
---|
668 | var=`ncdump -h ${tmean} | grep float | grep mean | tr '(' ' ' | awk '{print $2}'` |
---|
669 | if test ! ${var} = 'cltmean'; then |
---|
670 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | \ |
---|
671 | grep all_values | awk '{print $3}'` |
---|
672 | cbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
673 | min=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
674 | max=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
675 | |
---|
676 | if test ${var} = 'prlsmean'; then xtrms='0,0.00015'; |
---|
677 | elif test ${var} = 'prwmean'; then xtrms='0,40'; |
---|
678 | elif test ${var} = 'psmean'; then xtrms='99000,102500'; |
---|
679 | elif test ${var} = 'r2mean'; then xtrms='0,0.025'; |
---|
680 | elif test ${var} = 'tasmean'; then xtrms='275,310'; |
---|
681 | elif test ${var} = 'tmlamean'; then xtrms='260,310'; |
---|
682 | elif test ${var} = 'uasmean'; then xtrms='-20,20'; |
---|
683 | elif test ${var} = 'vasmean'; then xtrms='-20,20'; |
---|
684 | else xtrms=${min}','${max}; fi |
---|
685 | |
---|
686 | # vals=${var}':XLONG|-1,XLAT|-1:XLONG:XLAT:'${cbar}':'${xtrms}':monthly|mean:pdf:' |
---|
687 | # vals=${vals}'None:None:true' |
---|
688 | # dims='south_north@XLAT,west_east@XLONG' |
---|
689 | python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -S longitude,latitude \ |
---|
690 | -f ${tmean} -v XLONG,XLAT |
---|
691 | vals=${var}':longitude|-1,latitude|-1:longitude:latitude:'${cbar}':'${xtrms}':monthly|mean:pdf:' |
---|
692 | vals=${vals}'None:None:true' |
---|
693 | dims='south_north@latitude,west_east@longitude' |
---|
694 | python ${HOMEpy}/drawing.py -o draw_2D_shad -S ${vals} -f ${tmean} -v ${var} |
---|
695 | pyexec=$? |
---|
696 | if test ${pyexec} -ne 0; then |
---|
697 | echo ${errormsg} |
---|
698 | echo " "${main}": python fails!" |
---|
699 | exit |
---|
700 | else |
---|
701 | mv 2Dfields_shadow.pdf ${ofold}/${exp}/${var}tmean.pdf |
---|
702 | # evince ${ofold}/${exp}/${var}tmean.pdf & |
---|
703 | # exit |
---|
704 | fi |
---|
705 | fi |
---|
706 | done |
---|
707 | done |
---|
708 | fi |
---|
709 | |
---|
710 | # lon 2 vertical section |
---|
711 | ## |
---|
712 | echo "lon 2 vertical section ..." |
---|
713 | vars=`echo ${lon2DZsecvars} | tr ':' ' '` |
---|
714 | pts=`echo ${lon2DZsecpts} | tr ':' ' '` |
---|
715 | |
---|
716 | if ${lonZsec}; then |
---|
717 | for exp in ${exps}; do |
---|
718 | file=${ofold}/${exp}/vertical_interpolation_WRFp.nc |
---|
719 | # python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -S longitude,latitude \ |
---|
720 | # -f ${file} -v lon,lat |
---|
721 | ## ALREADY done! |
---|
722 | # python ${HOMEpy}/nc_var.py -o valmod -S lowthres@oper,0.,sumc,360. -f ${file} \ |
---|
723 | # -v lon |
---|
724 | if test ${exp} = 'AR40'; then labexp='wlmdza' |
---|
725 | else labexp='wlmdzb'; fi |
---|
726 | |
---|
727 | for pt in ${pts}; do |
---|
728 | echo " pt: "${pt} |
---|
729 | vals='x:15|y:'${pt}'|time:23' |
---|
730 | lonval=`python ${HOMEpy}/nc_var.py -o varout -f ${file} -S ${vals} -v lon | \ |
---|
731 | awk '{print $2}'` |
---|
732 | latval=`python ${HOMEpy}/nc_var.py -o varout -f ${file} -S ${vals} -v lat | \ |
---|
733 | awk '{print $2}'` |
---|
734 | tval=`python ${HOMEpy}/nc_var.py -o varout -f ${file} -S ${vals} -v time | \ |
---|
735 | awk '{print $2}'` |
---|
736 | for var in ${vars}; do |
---|
737 | echo " var: "${var} |
---|
738 | |
---|
739 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | \ |
---|
740 | grep all_values | awk '{print $3}'` |
---|
741 | cbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
742 | min=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
743 | max=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
744 | |
---|
745 | # WRFt,U,V,WRFrh,WRFght |
---|
746 | if test ${var} = 'WRFght'; then xtrms='0,40000'; |
---|
747 | elif test ${var} = 'WRFt'; then xtrms='200,300'; |
---|
748 | elif test ${var} = 'U'; then xtrms='-40,40'; |
---|
749 | elif test ${var} = 'V'; then xtrms='-20,20'; |
---|
750 | else xtrms=${min}','${max}; fi |
---|
751 | |
---|
752 | # Plotting |
---|
753 | vals=${var}':x|-1,y|'${pt}',z|-1,time|24:lon:pressure:'${cbar}':' |
---|
754 | vals=${vals}${xtrms}':'${labexp}'|vertical|longitudinal|section|('${latval} |
---|
755 | vals=${vals}'$^{\circ}$):pdf:flip@y:None:true' |
---|
756 | python ${HOMEpy}/drawing.py -o draw_2D_shad -S ${vals} -f ${file} -v ${var} |
---|
757 | pyexec=$? |
---|
758 | if test ${pyexec} -ne 0; then |
---|
759 | echo ${errormsg} |
---|
760 | echo " "${main}": python fails!" |
---|
761 | exit |
---|
762 | else |
---|
763 | mv 2Dfields_shadow.pdf ${ofold}/${exp}/${var}_lonZsec_${pt}pt.pdf |
---|
764 | evince ${ofold}/${exp}/${var}_lonZsec_${pt}pt.pdf & |
---|
765 | fi |
---|
766 | |
---|
767 | cntcolor='black' |
---|
768 | cntfmt='%g' |
---|
769 | |
---|
770 | if test ${var} = 'WRFght'; then cxtrms='0,40000'; |
---|
771 | elif test ${var} = 'WRFt'; then cxtrms='200,300'; |
---|
772 | elif test ${var} = 'U'; then cxtrms='-40,40'; |
---|
773 | elif test ${var} = 'V'; then cxtrms='-20,20'; |
---|
774 | else cxtrms=${min}','${max}; fi |
---|
775 | |
---|
776 | graphvals=${var}','${var}':x|-1,y|'${pt}',z|-1,time|24:' |
---|
777 | graphvals=${graphvals}'x|-1,y|'${pt}',z|-1,time|24:lon:pressure:' |
---|
778 | graphvals=${graphvals}${cbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${xtrms}':' |
---|
779 | graphvals=${graphvals}${cxtrms}',15:'${labexp} |
---|
780 | graphvals=${graphvals}'|vertical|zonal|section|('${latval}'$^{\circ}$):pdf:' |
---|
781 | graphvals=${graphvals}'flip@y:None' |
---|
782 | |
---|
783 | python ${HOMEpy}/drawing.py -o draw_2D_shad_cont -S ${graphvals} \ |
---|
784 | -f ${file},${file} -v ${var},${var} |
---|
785 | pyexec=$? |
---|
786 | if test ${pyexec} -ne 0; then |
---|
787 | echo ${errormsg} |
---|
788 | echo " "${main}": python fails!" |
---|
789 | exit |
---|
790 | else |
---|
791 | mv 2Dfields_shadow-contour.pdf ${ofold}/${exp}/${var}_lonZsec-cnt_${pt}pt.pdf |
---|
792 | evince ${ofold}/${exp}/${var}_lonZsec-cnt_${pt}pt.pdf & |
---|
793 | fi |
---|
794 | |
---|
795 | # exit |
---|
796 | done |
---|
797 | done |
---|
798 | done |
---|
799 | fi |
---|
800 | |
---|
801 | echo "Computing differences" |
---|
802 | exp1=`echo ${experiments} | tr ':' ' ' | awk '{print $1}'` |
---|
803 | exp2=`echo ${experiments} | tr ':' ' ' | awk '{print $2}'` |
---|
804 | |
---|
805 | diffks=`echo ${diffkinds} | tr ':' ' '` |
---|
806 | |
---|
807 | if test ${differences}; then |
---|
808 | for kind in ${diffks}; do |
---|
809 | echo ${kind} |
---|
810 | case ${kind} in |
---|
811 | 'diffZ') |
---|
812 | vars=`echo ${diffZvars} | tr ':' ' '` |
---|
813 | fileorigd='mean.nc' |
---|
814 | ;; |
---|
815 | 'diffH') |
---|
816 | vars=`echo ${diffHvars} | tr ':' ' '` |
---|
817 | fileorigd='tmean.nc' |
---|
818 | ;; |
---|
819 | esac |
---|
820 | |
---|
821 | echo " "${var} |
---|
822 | for var in ${vars}; do |
---|
823 | if test ! -f ${ofold}/${var}_diff.nc; then |
---|
824 | # cdo sub ${ofold}/${exp1}/${var}${fileorigd} ${ofold}/${exp2}/${var}${fileorigd} ${ofold}/${var}_diff.nc |
---|
825 | if test ${kind} = 'diffZ'; then |
---|
826 | values='pressure|lat@add|'${ofold}'/'${exp1}'/'${var}${fileorigd}'|'${var}'mean,' |
---|
827 | values=${values}'sub|'${ofold}'/'${exp2}'/'${var}${fileorigd}'|'${var}'mean' |
---|
828 | python ${HOMEpy}/nc_var.py -o compute_opersvarsfiles -S ${values} -v ${var} |
---|
829 | pyexec=$? |
---|
830 | if test ${pyexec} -ne 0; then |
---|
831 | echo ${errormsg} |
---|
832 | echo " "${main}": python fails!" |
---|
833 | exit |
---|
834 | fi |
---|
835 | mv opersvarsfiles_${var}.nc ${ofold}/${var}_diff.nc |
---|
836 | else |
---|
837 | values='longitude|latitude@add|'${ofold}'/'${exp1}'/'${var}${fileorigd}'|'${var}'mean,' |
---|
838 | values=${values}'sub|'${ofold}'/'${exp2}'/'${var}${fileorigd}'|'${var}'mean' |
---|
839 | python ${HOMEpy}/nc_var.py -o compute_opersvarsfiles -S ${values} -v ${var} |
---|
840 | pyexec=$? |
---|
841 | if test ${pyexec} -ne 0; then |
---|
842 | echo ${errormsg} |
---|
843 | echo " "${main}": python fails!" |
---|
844 | exit |
---|
845 | fi |
---|
846 | mv opersvarsfiles_${var}.nc ${ofold}/${var}_diff.nc |
---|
847 | fi |
---|
848 | fi |
---|
849 | done |
---|
850 | |
---|
851 | if test ${kind} = 'diffZ'; then |
---|
852 | coups=`echo ${graph_couples_mean} | tr ':' ' '` |
---|
853 | for coup in ${coups}; do |
---|
854 | shdvar=`echo ${coup} | tr '@' ' ' | awk '{print $1}'` |
---|
855 | cntvar=`echo ${coup} | tr '@' ' ' | awk '{print $2}'` |
---|
856 | |
---|
857 | echo " couple: "${shdvar}'-'${cntvar} |
---|
858 | |
---|
859 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${shdvar} | grep all_values | awk '{print $3}'` |
---|
860 | cntvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${cntvar} | grep all_values | awk '{print $3}'` |
---|
861 | files=${ofold}'/'${shdvar}'_diff.nc,'${ofold}'/'${cntvar}'_diff.nc' |
---|
862 | |
---|
863 | shdstdn=`echo ${shdvals} | tr ',' ' ' | awk '{print $1}'` |
---|
864 | shdcbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
865 | shdmin=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
866 | shdmax=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
867 | |
---|
868 | cntstdn=`echo ${cntvals} | tr ',' ' ' | awk '{print $1}'` |
---|
869 | cntmin=`echo ${cntvals} | tr ',' ' ' | awk '{print $3}'` |
---|
870 | cntmax=`echo ${cntvals} | tr ',' ' ' | awk '{print $4}'` |
---|
871 | |
---|
872 | shdcbar='seismic' |
---|
873 | if test ${coup} = 'va@ua'; then |
---|
874 | shdmin=-4. |
---|
875 | shdmax=4. |
---|
876 | cntmin=-10. |
---|
877 | cntmax=10. |
---|
878 | elif test ${coup} = 'hus@ta'; then |
---|
879 | shdmin=-0.2 |
---|
880 | shdmax=0.2 |
---|
881 | cntmin=-2. |
---|
882 | cntmax=2. |
---|
883 | fi |
---|
884 | |
---|
885 | cntcolor='black' |
---|
886 | cntfmt='%g' |
---|
887 | |
---|
888 | graphvals=${shdstdn}','${cntstdn}':x|-1,y|-1,x_2|-1:x|-1,y|-1,x_2|-1:lat:' |
---|
889 | graphvals=${graphvals}'pressure:'${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':' |
---|
890 | graphvals=${graphvals}${shdmin}','${shdmax}':'${cntmin}','${cntmax}',9:' |
---|
891 | graphvals=${graphvals}${exp1}'-'${exp2}'|meridional|monthly|average|differences|of|' |
---|
892 | graphvals=${graphvals}${shdstdn}'|&|'${cntstdn}':pdf:flip@y:None' |
---|
893 | |
---|
894 | python ${HOMEpy}/drawing.py -o draw_2D_shad_cont -S ${graphvals} \ |
---|
895 | -f ${files} -v ${shdvar},${cntvar} |
---|
896 | pyexec=$? |
---|
897 | if test ${pyexec} -ne 0; then |
---|
898 | echo ${errormsg} |
---|
899 | echo " "${main}": python fails!" |
---|
900 | exit |
---|
901 | else |
---|
902 | mv 2Dfields_shadow-contour.pdf ${ofold}/${shdvar}-${cntvar}_diff.pdf |
---|
903 | evince ${ofold}/${shdvar}-${cntvar}_diff.pdf & |
---|
904 | fi |
---|
905 | done |
---|
906 | # exit |
---|
907 | else |
---|
908 | for var in ${vars}; do |
---|
909 | echo " "${var} |
---|
910 | vals=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | grep all_values | awk '{print $3}'` |
---|
911 | file=${ofold}/${var}_diff.nc |
---|
912 | |
---|
913 | stdn=`echo ${vals} | tr ',' ' ' | awk '{print $1}'` |
---|
914 | cbar='seismic' |
---|
915 | |
---|
916 | if test ${var} = 'uas'; then xtrms='-10.,10.'; |
---|
917 | elif test ${var} = 'vas'; then xtrms='-5,5'; |
---|
918 | elif test ${var} = 'ps'; then xtrms='-500,500'; |
---|
919 | elif test ${var} = 'pr'; then xtrms='-0.001,0.001'; |
---|
920 | else xtrms=${min}','${max}; fi |
---|
921 | |
---|
922 | vals=${var}':x|-1,y|-1:longitude:latitude:'${cbar}':' |
---|
923 | vals=${vals}${xtrms}':'${exp1}'-'${exp2}'|meridional|monthly|average|differences:' |
---|
924 | vals=${vals}'pdf:None:None:true' |
---|
925 | python ${HOMEpy}/drawing.py -o draw_2D_shad -S ${vals} -f ${file} -v ${var} |
---|
926 | pyexec=$? |
---|
927 | if test ${pyexec} -ne 0; then |
---|
928 | echo ${errormsg} |
---|
929 | echo " "${main}": python fails!" |
---|
930 | exit |
---|
931 | else |
---|
932 | mv 2Dfields_shadow.pdf ${ofold}/${var}_diff.pdf |
---|
933 | evince ${ofold}/${var}_diff.pdf & |
---|
934 | fi |
---|
935 | # exit |
---|
936 | done |
---|
937 | fi |
---|
938 | done |
---|
939 | fi |
---|