[846] | 1 | #!/bin/bash |
---|
| 2 | # L. Fita, June 2016. Generic script to plot model outputs |
---|
| 3 | |
---|
| 4 | main='model_graphics.bash' |
---|
[835] | 5 | |
---|
[846] | 6 | function uploadvars() { |
---|
| 7 | # Function to upload variables to the system from an ASCII file as: |
---|
| 8 | # [varname] = [value] |
---|
| 9 | fileval=$1 |
---|
| 10 | errormsg='ERROR -- error -- ERROR -- error' |
---|
[835] | 11 | |
---|
[846] | 12 | if test ! -f ${fileval}; then |
---|
[835] | 13 | echo ${errormsg} |
---|
[846] | 14 | echo " "${fname}": file '"${fileval}"' does not exist!!" |
---|
| 15 | exit |
---|
[835] | 16 | fi |
---|
| 17 | |
---|
[846] | 18 | Nlin=`wc -l ${fileval} | awk '{print $1}'` |
---|
[835] | 19 | |
---|
[846] | 20 | ilin=1 |
---|
| 21 | while test ${ilin} -le ${Nlin}; do |
---|
| 22 | line=`head -n ${ilin} ${fileval} | tail -n 1` |
---|
| 23 | varname=`echo ${line} | tr '=' ' ' | awk '{print $1}'` |
---|
| 24 | value=`echo ${line} | tr '=' ' ' | awk '{print $2}'` |
---|
| 25 | Lvarname=`expr length ${varname}'0'` |
---|
[835] | 26 | |
---|
[846] | 27 | if test ${Lvarname} -gt 1 && test ! ${varname:0:1} = '#'; then |
---|
| 28 | export ${varname}=${value} |
---|
| 29 | fi |
---|
| 30 | ilin=`expr ${ilin} + 1` |
---|
| 31 | done |
---|
[835] | 32 | } |
---|
| 33 | |
---|
| 34 | function isin_list() { |
---|
| 35 | # Function to check whether a value is in a list |
---|
| 36 | list=$1 |
---|
| 37 | value=$2 |
---|
| 38 | |
---|
| 39 | is=`echo ${list} | tr ':' '\n' | awk '{print "@"$1"@"}' | grep '@'${value}'@' | wc -w` |
---|
| 40 | if test ${is} -eq 1 |
---|
| 41 | then |
---|
| 42 | true |
---|
| 43 | else |
---|
| 44 | false |
---|
| 45 | fi |
---|
| 46 | } |
---|
| 47 | |
---|
[868] | 48 | function ferrmsg() { |
---|
| 49 | # Function to exit and write an error message |
---|
| 50 | # comdexit: code number exit from the last execution |
---|
| 51 | # ref: script/reference from which error occurs |
---|
| 52 | # msg: message to write ('!' for spaces, '#' for end of line) |
---|
| 53 | comdexit=$1 |
---|
| 54 | ref=$2 |
---|
| 55 | msg=$3 |
---|
| 56 | |
---|
| 57 | if test ${comdexit} -ne 0; then |
---|
| 58 | echo "ERROR -- error -- ERROR -- error" |
---|
| 59 | echo " "${ref}": "$(echo ${msg} | tr '!' ' ' | tr '#' '\n')" !!" |
---|
| 60 | exit |
---|
| 61 | fi |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | function compute_variable() { |
---|
| 65 | # Function to compute a variable |
---|
| 66 | # idir: directory with the input files |
---|
| 67 | # usefiles: ',' list of files as [headerf]@[file1]|...|[fileN] |
---|
| 68 | # odir: directory to write the output files |
---|
| 69 | # cvar: [CFvarn]|[varkind]|[headerf]|[varmod]|[vardiag] |
---|
| 70 | # [CFvarn]: CF name of the variable |
---|
| 71 | # [vark]: kind of variable: |
---|
| 72 | # acc: temporal accumulated values |
---|
| 73 | # diff: differences between models |
---|
| 74 | # direct: no statistics |
---|
| 75 | # Lsec: latitudinal section (latitudinal value must be given, [var]@[lat]) |
---|
| 76 | # lsec: longitudinal section (longitudinal value must be given, [var]@[lat]) |
---|
| 77 | # lmean: longitudinal mean values |
---|
| 78 | # tmean: temporal mean values |
---|
| 79 | # zsum: vertical aggregated values |
---|
| 80 | # [headerf]: header of the files to use |
---|
| 81 | # [modvar]: variable to use from the file |
---|
| 82 | # [diagvar]: variable computed from the diagnostics (diagnostic.py) |
---|
| 83 | # scratch: whether is has to be done from the scratch or not |
---|
| 84 | fname='compute_variable' |
---|
| 85 | idir=$1 |
---|
| 86 | usefiles=$2 |
---|
| 87 | odir=$3 |
---|
| 88 | cvar=$4 |
---|
| 89 | scratch=$5 |
---|
| 90 | |
---|
| 91 | CFvarn=`echo ${cvar} | tr '|' ' ' | awk '{print $1}'` |
---|
| 92 | vark=`echo ${cvar} | tr '|' ' ' | awk '{print $2}'` |
---|
| 93 | headerf=`echo ${cvar} | tr '|' ' ' | awk '{print $3}'` |
---|
| 94 | modvar=`echo ${cvar} | tr '|' ' ' | awk '{print $4}'` |
---|
| 95 | diagvar=`echo ${cvar} | tr '|' ' ' | awk '{print $5}'` |
---|
| 96 | |
---|
| 97 | cfiles=`echo ${usefiles} | tr ',' '\n' | grep ${headerf} | tr '|' ' ' | \ |
---|
| 98 | awk '{print $2}' | tr '@' ' '` |
---|
| 99 | |
---|
| 100 | cd ${odir} |
---|
| 101 | |
---|
| 102 | # Computing separately and then joinging for all files |
---|
| 103 | Ntotfiles=`echo ${cfiles} | wc -w | awk '{print $1}'` |
---|
| 104 | ifile=1 |
---|
| 105 | for cf in ${cfiles}; do |
---|
| 106 | ifS=`printf "%0${Ntotfiles}d" ${ifile}` |
---|
| 107 | # Computing variable |
---|
| 108 | filen=${odir}/${CFvarn}_${headerf}_${ifile}-${Ntotfiles}.nc |
---|
| 109 | if ${scratch}; then rm ${filen}; fi |
---|
| 110 | |
---|
| 111 | if test ! -f ${filen}; then |
---|
| 112 | if test ! ${modvar} = 'None'; then |
---|
| 113 | # model variable |
---|
| 114 | values=${modvar}',0,-1,-1' |
---|
| 115 | vs=${modvar},${vdnx},${vdny},${vdnz},${vdnt} |
---|
| 116 | pyout=`${pyHOME}/nc_var.py -f ${cf} -o DataSetSection_multivars -v ${vs} \ |
---|
| 117 | -S ${values} | grep succesfull | awk '{print $6}' | tr '"' ' '` |
---|
| 118 | ferrmsg $? ${fname} "python!'DataSetSection_multivars'!failed" |
---|
| 119 | mv ${pyout} ${filen} |
---|
| 120 | pyout=`${pyHOME}/nc_var.py -f ${filen} -o chvarname -v ${vs} -S ${CFvarn}` |
---|
| 121 | ferrmsg $? ${fname} "python!'chvarname'!failed" |
---|
| 122 | |
---|
| 123 | # adding CF lon,lat,time in WRF files |
---|
| 124 | if test ${headerf:0:3} = 'wrf'; then |
---|
| 125 | ${pyHOME}/nc_var.py -o WRF_CFtime_creation -S 19491201000000,minutes \ |
---|
| 126 | -f ${filen} -v time |
---|
| 127 | ${pyHOME}/nc_var.py -o WRF_CFlonlat_creation -v ${vdnx},${vdny} \ |
---|
| 128 | -f ${filen} -S lon,lat |
---|
| 129 | fi |
---|
| 130 | else |
---|
| 131 | # diagnostic variable |
---|
| 132 | dims=${dnt}@${vdnt},${dnz}@${vdnz},${dny}@${vdny},${dnx}@${vdnx} |
---|
| 133 | diagn=`echo ${diagvar} | tr ':' '\n' | head -n 1` |
---|
| 134 | Ndiagvars=`echo ${diagvar} | tr ':' ' ' | wc -w | awk '{print $1}'` |
---|
| 135 | idiagv=2 |
---|
| 136 | diagc='' |
---|
| 137 | while test ${idiagv} -le ${Ndiagvars}; do |
---|
| 138 | diag1=`echo ${diagvar} | tr ':' '\n' | head -n ${idiagv} | tail -n 1` |
---|
| 139 | if test ${idiagv} -eq 2; then |
---|
| 140 | diagc=${diag1} |
---|
| 141 | else |
---|
| 142 | diagc=${diagc}'@'${diag1} |
---|
| 143 | fi |
---|
| 144 | idiagv=`expr ${idiagv} + 1` |
---|
| 145 | done |
---|
| 146 | |
---|
| 147 | echo "python ${pyHOME}/diagnostics.py -f ${cf} -d ${dims} -v ${diagn}'|'${diagc}" |
---|
| 148 | pyout=`python ${pyHOME}/diagnostics.py -f ${cf} -d ${dims} -v ${diagn}'|'${diagc}` |
---|
| 149 | ferrmsg $? ${fname} "python!'diagnostics'!failed" |
---|
| 150 | mv diagnostics.nc ${filen} |
---|
| 151 | |
---|
| 152 | # adding CF lon,lat,time in WRF files |
---|
| 153 | if test ${headerf:0:3} = 'wrf'; then |
---|
| 154 | ${pyHOME}/nc_var.py -o WRF_CFtime_creation -S 19491201000000,minutes \ |
---|
| 155 | -f ${filen} -v time |
---|
| 156 | ${pyHOME}/nc_var.py -o WRF_CFlonlat_creation -v ${vdnx},${vdny} \ |
---|
| 157 | -f ${filen} -S lon,lat |
---|
| 158 | fi |
---|
| 159 | fi |
---|
| 160 | fi |
---|
| 161 | |
---|
| 162 | ifile=`expr ${ifile} + 1` |
---|
| 163 | done |
---|
| 164 | |
---|
| 165 | # LLUIS |
---|
| 166 | # exit |
---|
| 167 | } |
---|
| 168 | |
---|
[835] | 169 | ####### ####### |
---|
| 170 | ## MAIN |
---|
| 171 | ####### |
---|
[868] | 172 | rootsh=`pwd` |
---|
[835] | 173 | |
---|
[846] | 174 | # Uploading environment |
---|
| 175 | uploadvars model_graphics.dat |
---|
[835] | 176 | |
---|
[868] | 177 | if test scratch = 'true'; then |
---|
| 178 | scratch=true |
---|
| 179 | echo ${warnmsg} |
---|
| 180 | echo " "${main}": starting from the SCRATCH !!" |
---|
| 181 | else |
---|
| 182 | scratch=false |
---|
| 183 | fi |
---|
[835] | 184 | |
---|
| 185 | timeval='tstep' |
---|
| 186 | zval='null' |
---|
| 187 | dimval='lon,lat,pressure,time' |
---|
| 188 | |
---|
| 189 | compute=0 |
---|
| 190 | computetlon=false |
---|
| 191 | plot=false |
---|
| 192 | single2Dplot=false |
---|
| 193 | lonZsec=false |
---|
| 194 | differences=true |
---|
| 195 | |
---|
| 196 | combosfile=${HOMEpy}/diagnostics.inf |
---|
| 197 | |
---|
| 198 | ####### ###### ##### #### ### ## # |
---|
| 199 | |
---|
[868] | 200 | mods=`echo ${models} | tr ':' ' '` |
---|
[835] | 201 | varks=`echo ${varkinds} | tr ':' ' '` |
---|
| 202 | |
---|
[868] | 203 | # Models loop |
---|
| 204 | ## |
---|
| 205 | for mod in ${mods}; do |
---|
| 206 | case ${mod} in |
---|
| 207 | 'WRF') |
---|
| 208 | exps=`echo ${WRFexps} | tr ':' ' '` |
---|
| 209 | fheaders=`echo ${WRFheaders} | tr ':' ' '` |
---|
| 210 | ;; |
---|
| 211 | 'LMDZ') |
---|
| 212 | exps=`echo ${LMDZexps} | tr ':' ' '` |
---|
| 213 | fheaders=`echo ${LMDZheaders} | tr ':' ' '` |
---|
| 214 | ;; |
---|
| 215 | 'WRF_LMDZ') |
---|
| 216 | exps=`echo ${WRF_LMDZexps} | tr ':' ' '` |
---|
| 217 | fheaders=`echo ${WRF_LMDZheaders} | tr ':' ' '` |
---|
| 218 | ;; |
---|
| 219 | '*') |
---|
| 220 | echo ${errmsg} |
---|
| 221 | echo " "${main}": model '"${mod}"' not ready!!" |
---|
| 222 | exit |
---|
| 223 | ;; |
---|
| 224 | esac |
---|
| 225 | |
---|
| 226 | modinf=`$pyHOME/nc_var.py -o model_characteristics -f None -S ${mod} | \ |
---|
| 227 | grep singleline | awk '{print $2}'` |
---|
| 228 | ferrmsg $? $main "python!'model_characteristics'!failed" |
---|
| 229 | dnx=`echo ${modinf} | tr ';' '\n' | grep dimxn | tr '=' ' ' | awk '{print $2}'` |
---|
| 230 | dny=`echo ${modinf} | tr ';' '\n' | grep dimyn | tr '=' ' ' | awk '{print $2}'` |
---|
| 231 | dnz=`echo ${modinf} | tr ';' '\n' | grep dimzn | tr '=' ' ' | awk '{print $2}'` |
---|
| 232 | dnt=`echo ${modinf} | tr ';' '\n' | grep dimtn | tr '=' ' ' | awk '{print $2}'` |
---|
| 233 | vdnx=`echo ${modinf} | tr ';' '\n' | grep vardxn | tr '=' ' ' | awk '{print $2}'` |
---|
| 234 | vdny=`echo ${modinf} | tr ';' '\n' | grep vardyn | tr '=' ' ' | awk '{print $2}'` |
---|
| 235 | vdnz=`echo ${modinf} | tr ';' '\n' | grep vardzn | tr '=' ' ' | awk '{print $2}'` |
---|
| 236 | vdnt=`echo ${modinf} | tr ';' '\n' | grep vardtn | tr '=' ' ' | awk '{print $2}'` |
---|
| 237 | echo ${mod} |
---|
| 238 | echo " dims: "${dnx}", "${dny}", "${dnz}", "${dnt} |
---|
| 239 | echo " var dims: "${vdnx}", "${vdny}", "${vdnz}", "${vdnt} |
---|
| 240 | |
---|
| 241 | # Experiments loop |
---|
| 242 | ## |
---|
| 243 | for exp in ${exps}; do |
---|
| 244 | echo " "${exp}"..." |
---|
| 245 | iwdir=${ifold}/${mod}/${exp} |
---|
| 246 | |
---|
| 247 | # Does input folder exist? |
---|
| 248 | if test ! -d ${iwdir}; then |
---|
| 249 | echo ${errmsg} |
---|
| 250 | echo " "${main}": folder '"${iwdir}"' does not exist !!" |
---|
| 251 | exit |
---|
| 252 | fi |
---|
| 253 | |
---|
| 254 | owdir=${ofold}/${mod}/${exp} |
---|
| 255 | mkdir -p ${owdir} |
---|
| 256 | |
---|
| 257 | # Need to pass to analyze all the data? |
---|
| 258 | if ${scratch}; then rm ${owdir}/varcompute.inf >& /dev/null; fi |
---|
| 259 | if test ! -f ${owdir}/varcompute.inf; then |
---|
| 260 | |
---|
| 261 | # Does input folder has header files? |
---|
| 262 | cd ${iwdir} |
---|
| 263 | files='' |
---|
| 264 | testfiles='' |
---|
| 265 | ih=1 |
---|
| 266 | for fh in ${fheaders}; do |
---|
| 267 | files1h=`ls -1 ${fh}* | tr '\n' '@'` |
---|
| 268 | Lfiles1h=`expr length ${files1h}'0'` |
---|
| 269 | if test ${Lfiles1h} -lt 2; then |
---|
| 270 | ferrmsg 1 $main "folder!:!"${iwdir}"!does!not!contain!files!"${fh}"*" |
---|
| 271 | fi |
---|
| 272 | testfiles1h=`ls -1 ${fh}* | head -n 1` |
---|
| 273 | if test ${ih} -eq 1; then |
---|
| 274 | files=${fh}'|'${files1h} |
---|
| 275 | testfiles=${fh}'|'${testfiles1h} |
---|
| 276 | else |
---|
| 277 | files=${files}','${fh}'|'${files1h} |
---|
| 278 | testfiles=${testfiles}'@'${fh}'|'${testfiles1h} |
---|
| 279 | fi |
---|
| 280 | ih=`expr ${ih} + 1` |
---|
| 281 | done |
---|
| 282 | testfs=`echo ${testfiles} | tr '@' ' '` |
---|
| 283 | cd ${rootsh} |
---|
| 284 | |
---|
| 285 | # Kind variables loop |
---|
| 286 | ## |
---|
| 287 | ik=1 |
---|
| 288 | itotv=1 |
---|
| 289 | for vark in ${varks}; do |
---|
| 290 | echo " "${vark}" ..." |
---|
| 291 | case ${vark} in |
---|
| 292 | 'varacc') |
---|
| 293 | varvks=${varacc} |
---|
| 294 | ;; |
---|
| 295 | 'vardiff') |
---|
| 296 | varvks=${vardiff} |
---|
| 297 | ;; |
---|
| 298 | 'direct') |
---|
| 299 | varvks=${vardirect} |
---|
| 300 | ;; |
---|
| 301 | 'varLsec') |
---|
| 302 | varvks=${varLsec} |
---|
| 303 | ;; |
---|
| 304 | 'varlsec') |
---|
| 305 | varvks=${varlsec} |
---|
| 306 | ;; |
---|
| 307 | 'varlmean') |
---|
| 308 | varvks=${varlmean} |
---|
| 309 | ;; |
---|
| 310 | 'vartmean') |
---|
| 311 | varvks=${vartmean} |
---|
| 312 | ;; |
---|
| 313 | 'varzsum') |
---|
| 314 | varvks=${varzsum} |
---|
| 315 | ;; |
---|
| 316 | '*') |
---|
| 317 | echo ${errmsg} |
---|
| 318 | echo " "${main}": variable kind '"${vark}"' not ready!!" |
---|
| 319 | exit |
---|
| 320 | ;; |
---|
| 321 | esac |
---|
| 322 | |
---|
| 323 | # Do we have variables for this kind? |
---|
| 324 | Lvarvks=`expr length ${varvks}'0'` |
---|
| 325 | if test ${Lvarvks} -lt 2; then |
---|
| 326 | ferrmsg 1 ${main} "variable!kind!"${vark}"!without!variables" |
---|
| 327 | fi |
---|
| 328 | if test ${ik} -eq 1; then |
---|
| 329 | allvars=${varvks} |
---|
| 330 | else |
---|
| 331 | allvars=${allvars}':'${varvks} |
---|
| 332 | fi |
---|
| 333 | ik=`expr ${ik} + 1` |
---|
| 334 | vars=`echo ${varvks} | tr ':' ' '` |
---|
| 335 | |
---|
| 336 | # Variables loop |
---|
| 337 | ## |
---|
| 338 | iv=1 |
---|
| 339 | for var in ${vars}; do |
---|
| 340 | echo " "${var} |
---|
| 341 | # How to copmute it? |
---|
| 342 | cancompute=true |
---|
| 343 | for ftest in ${testfs}; do |
---|
| 344 | headerf=`echo ${ftest} | tr '|' ' ' | awk '{print $1}'` |
---|
| 345 | filen=`echo ${ftest} | tr '|' ' ' | awk '{print $2}'` |
---|
| 346 | compute=`${pyHOME}/nc_var.py -o computevar_model -f ${iwdir}/${filen} \ |
---|
| 347 | -S ${var}` |
---|
| 348 | ferrmsg $? ${main} "python!'computevar_model'!failed!#"$(echo ${compute} | \ |
---|
| 349 | tr ' ' '!') |
---|
| 350 | varmod=`echo ${compute} | tr ' ' '#' | tr '|' ' ' | awk '{print $2}' | \ |
---|
| 351 | tr '@' ' ' | awk '{print $2}' | tr '=' ' ' | awk '{print $2}'` |
---|
| 352 | vardiag=`echo ${compute} | tr ' ' '#' | tr '|' ' ' | awk '{print $2}' | \ |
---|
| 353 | tr '@' ' ' | awk '{print $3}' | tr '=' ' ' | awk '{print $2}'` |
---|
| 354 | echo " "${var}" mod:"${varmod}" diag: "${vardiag} |
---|
| 355 | if test ${varmod} = 'None' && test ${vardiag} = 'None'; then |
---|
| 356 | cancompute=false |
---|
| 357 | else |
---|
| 358 | cancompute=true |
---|
| 359 | # Should be considered that variable can also be computed by both ways? |
---|
| 360 | break |
---|
| 361 | fi |
---|
| 362 | done |
---|
| 363 | if ! ${cancompute}; then |
---|
| 364 | msg="there!is!no!way!to!compute!'"${var}"'!for!model!"${mod} |
---|
| 365 | # Too extrict! |
---|
| 366 | # ferrmsg 1 ${main} ${msg} |
---|
| 367 | echo ${warnmsg} |
---|
| 368 | echo $(echo $msg | tr '!' ' ') |
---|
| 369 | fi |
---|
| 370 | |
---|
| 371 | # A ';' list 'varcompute' it is created for each variable giving: |
---|
| 372 | # [var]|[vark]|[headerf][varmod]|[vardiag] |
---|
| 373 | # This list will be used to compute a new file for each variable |
---|
| 374 | varcomp=${var}'|'${vark}'|'${headerf}'|'${varmod}'|'${vardiag} |
---|
| 375 | if test ${itotv} -eq 1; then |
---|
| 376 | varcompute=${varcomp} |
---|
| 377 | else |
---|
| 378 | varcompute=${varcompute}';'${varcomp} |
---|
| 379 | fi |
---|
| 380 | |
---|
| 381 | iv=`expr ${iv} + 1` |
---|
| 382 | itotv=`expr ${itotv} + 1` |
---|
| 383 | |
---|
| 384 | # end loop of variables |
---|
| 385 | done |
---|
| 386 | # end of kind of variables |
---|
| 387 | done |
---|
| 388 | |
---|
| 389 | # Outwritting the varcompute to avoid next time (if it is not scratch!) |
---|
| 390 | cat << EOF > ${owdir}/varcompute.inf |
---|
| 391 | files: ${files} |
---|
| 392 | varcompute: ${varcompute} |
---|
| 393 | itotv: ${itotv} |
---|
| 394 | EOF |
---|
| 395 | else |
---|
| 396 | echo $warnmsg |
---|
| 397 | echo " "${main}": getting already data information from the experiment!" |
---|
| 398 | files=`cat ${owdir}/varcompute.inf | grep files | awk '{print $2}'` |
---|
| 399 | varcompute=`cat ${owdir}/varcompute.inf | grep varcompute | awk '{print $2}'` |
---|
| 400 | itotv=`cat ${owdir}/varcompute.inf | grep itotv | awk '{print $2}'` |
---|
| 401 | # End of avoiding to repeat all the experiment search |
---|
| 402 | fi |
---|
| 403 | |
---|
| 404 | echo " For experiment '"${exp}"' is required to compute: "${itotv}" variables" |
---|
| 405 | # Computing files for each variable |
---|
| 406 | ## |
---|
| 407 | echo " Computing all variables ..." |
---|
| 408 | cd $owdir |
---|
| 409 | ic=1 |
---|
| 410 | cvars=`echo ${varcompute} | tr ';' ' '` |
---|
| 411 | for cvar in ${cvars}; do |
---|
| 412 | CFv=`echo ${cvar} | tr '|' ' ' | awk '{print $1}'` |
---|
| 413 | modv=`echo ${cvar} | tr '|' ' ' | awk '{print $4}'` |
---|
| 414 | diagv=`echo ${cvar} | tr '|' ' ' | awk '{print $5}'` |
---|
| 415 | echo " "${CFv}"; "${modv}" "${diagv} |
---|
| 416 | |
---|
| 417 | if test ! ${modv} = 'None' || test ! ${diagv} = 'None'; then |
---|
| 418 | compute_variable ${iwdir} ${files} ${owdir} ${cvar} ${scratch} |
---|
| 419 | ic=`expr ${ic} + 1` |
---|
| 420 | else |
---|
| 421 | echo " not computing '"${CFv}"' for model '"${mod}"' !!" |
---|
| 422 | fi |
---|
| 423 | |
---|
| 424 | # exit |
---|
| 425 | # end of computing vars |
---|
| 426 | done |
---|
| 427 | echo " "${main}": has been "${ic}" variables computed" |
---|
| 428 | cd ${rootsh} |
---|
| 429 | exit |
---|
| 430 | # end of experiments |
---|
| 431 | done |
---|
| 432 | # end of models |
---|
| 433 | done |
---|
| 434 | |
---|
| 435 | exit |
---|
| 436 | |
---|
[835] | 437 | istep=0 |
---|
| 438 | |
---|
| 439 | if test ${compute} -eq 1; then |
---|
| 440 | for exp in ${exps}; do |
---|
| 441 | echo "exp: "${exp} |
---|
| 442 | if test ${exp} == 'AR40'; then |
---|
| 443 | var2Dtmeans=${var2Dtmeans_AR40} |
---|
| 444 | else |
---|
| 445 | var2Dtmeans=${var2Dtmeans_NPv31} |
---|
| 446 | fi |
---|
| 447 | for vark in ${varks}; do |
---|
| 448 | echo " vark: "${vark} |
---|
| 449 | |
---|
| 450 | if test ${vark} = 'mean'; then |
---|
| 451 | fileorig=${ifoldmean}/${exp}/${filenmean} |
---|
| 452 | if test ! -f ${fileorig}; then |
---|
| 453 | fileworig=${filensfc} |
---|
| 454 | dvals='T:Time,Z:bottom_top,Y:south_north,X:west_east' |
---|
| 455 | dimnames='T:Time,Z:bottom_top,Y:south_north,X:west_east' |
---|
| 456 | python ${HOMEpy}/vertical_interpolation.py \ |
---|
| 457 | -f ${ofold}/${exp}/${filensfc} -o WRFp -i ${plevels} -k 'lin' \ |
---|
| 458 | -v WRFt,U,V,WRFrh,WRFght -d ${dimnames} -D T:Times,Z:ZNU,Y:XLAT,X:XLONG |
---|
| 459 | if test $? -ne 0; then |
---|
| 460 | echo ${errormsg} |
---|
| 461 | echo " python failed!" |
---|
| 462 | echo " python ${HOMEpy}/vertical_interpolation.py" \ |
---|
| 463 | "-f ${ofold}/${exp}/${filensfc} -o WRFp -i ${plevels} -k 'lin'" \ |
---|
| 464 | "-v WRFt,U,V,WRFrh,WRFght -d ${dimnames} -D T:Times,Z:ZNU,Y:XLAT,X:XLONG" |
---|
| 465 | rm ${ofold}/${exp}/vertical_interpolation_WRFp.nc >& /dev/null |
---|
| 466 | exit |
---|
| 467 | fi |
---|
| 468 | mv vertical_interpolation_WRFp.nc ${ofold}/${exp} |
---|
| 469 | fi |
---|
| 470 | vars=`echo ${mean_variables} | tr ':' ' '` |
---|
| 471 | ofile='mean_variables' |
---|
| 472 | elif test ${vark} = 'sfc'; then |
---|
| 473 | fileorig=${ifoldsfc}/${exp}/${filensfc} |
---|
| 474 | if test ! -f ${fileorig}; then |
---|
| 475 | fileworig=${filensfc} |
---|
| 476 | cp ${ifoldsfc}/${exp}/${fileworig} ${ifoldsfc}/${exp}/${filensfc} |
---|
| 477 | python ${HOMEpy}/nc_var.py -o WRF_CFxtime_creation -f ${ifoldsfc}/${exp}/${filensfc} \ |
---|
| 478 | -S 19491201000000,hours -v time |
---|
| 479 | python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -f ${ifoldsfc}/${exp}/${filensfc}\ |
---|
| 480 | -S longitude,latitude -v XLONG,XLAT |
---|
| 481 | fi |
---|
| 482 | if test ${exp} = 'AR40'; then |
---|
| 483 | vars=`echo ${sfc_variables_AR40} | tr ':' ' '` |
---|
| 484 | else |
---|
| 485 | vars=`echo ${sfc_variables_NPv31} | tr ':' ' '` |
---|
| 486 | fi |
---|
| 487 | ofile='sfc_variables' |
---|
| 488 | elif test ${vark} = 'diag'; then |
---|
| 489 | fileorig=${ifolddiag}/${exp}/${filendiag} |
---|
| 490 | vars=`echo ${diag_variables} | tr ':' ' '` |
---|
| 491 | if test ! -f ${fileorig}; then |
---|
| 492 | values='Time@XTIME,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 493 | ivar=0 |
---|
| 494 | varcombos='' |
---|
| 495 | for var in ${vars}; do |
---|
| 496 | echo " var:"${var} |
---|
| 497 | varn=`echo ${var} | tr '_' ' ' | awk '{print $2}'` |
---|
| 498 | combo=`python ${HOMEpy}/diagnostics.py -f ${combosfile} -d variable_combo -v ${varn}\ |
---|
| 499 | | grep COMBO | awk '{print $2}'` |
---|
| 500 | if test ${combo} = 'ERROR'; then |
---|
| 501 | echo ${errormsg} |
---|
| 502 | echo " No variable '"${varn}"' in '"${combosfile}"' !!" |
---|
| 503 | exit |
---|
| 504 | fi |
---|
| 505 | if test ${ivar} -eq 0; then |
---|
| 506 | varcombos=${varn}'|'${combo} |
---|
| 507 | else |
---|
| 508 | varcombos=${varcombos}','${varn}'|'${combo} |
---|
| 509 | fi |
---|
| 510 | ivar=`expr ${ivar} + 1` |
---|
| 511 | done |
---|
| 512 | python ${HOMEpy}/diagnostics.py -d ${values} -f ${ifoldsfc}/${exp}/${filensfc} -v \ |
---|
| 513 | ${varcombos} |
---|
| 514 | if test $? -ne 0; then |
---|
| 515 | echo ${errormsg} |
---|
| 516 | echo " python failed!!" |
---|
| 517 | echo python ${HOMEpy}/diagnostics.py -d ${values} -f ${ifoldsfc}/${exp}/${filensfc}\ |
---|
| 518 | -v ${varcombos} |
---|
| 519 | exit |
---|
| 520 | fi |
---|
| 521 | python ${HOMEpy}/nc_var.py -o WRF_CFxtime_creation -f diagnostics.nc \ |
---|
| 522 | -S 19491201000000,hours -v time |
---|
| 523 | python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -f diagnostics.nc \ |
---|
| 524 | -S longitude,latitude -v XLONG,XLAT |
---|
| 525 | mv diagnostics.nc ${ifolddiag}/${exp} |
---|
| 526 | fi |
---|
| 527 | ofile='diag_variables' |
---|
| 528 | elif test ${vark} = 'z'; then |
---|
| 529 | fileorig=${ifoldmean}/${exp}/${filenmean} |
---|
| 530 | vars=`echo ${z_variables} | tr ':' ' '` |
---|
| 531 | ofile='z_variables' |
---|
| 532 | fi |
---|
| 533 | |
---|
| 534 | # Averaging |
---|
| 535 | ## |
---|
| 536 | echo " averaging..." |
---|
| 537 | ivar=0 |
---|
| 538 | for varn in ${vars}; do |
---|
| 539 | file=${fileorig} |
---|
| 540 | echo " var: "${varn} |
---|
| 541 | var=`echo ${varn} | tr '|' ' ' | awk '{print $2}'` |
---|
| 542 | varval=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | grep all_values | awk '{print $3}'` |
---|
| 543 | varname=`echo ${varval} | tr ',' ' ' | awk '{print $1}'` |
---|
| 544 | |
---|
| 545 | echo " std name: "${varname} |
---|
| 546 | varhead=`echo ${varname} | tr '_' ' ' | awk '{print $1}'` |
---|
| 547 | vartail=`echo ${varname} | tr '_' ' ' | awk '{print $2}'` |
---|
| 548 | |
---|
| 549 | if test ${vark} = 'mean'; then |
---|
| 550 | vals='time:-1|z:-1|y:-1|x:-1,time:x,mean,pressure:lat' |
---|
| 551 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var} |
---|
| 552 | pyexec=$? |
---|
| 553 | if test ${pyexec} -ne 0; then |
---|
| 554 | echo ${errormsg} |
---|
| 555 | echo " "${main}": python fai1ls!" |
---|
| 556 | echo "python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var}" |
---|
| 557 | exit |
---|
| 558 | else |
---|
| 559 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 560 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${varname}${oper}.nc |
---|
| 561 | fi |
---|
| 562 | elif test ${vark} = 'z'; then |
---|
| 563 | vals='time:-1|z:-1|y:-1|x:-1,time:x,mean,pressure:lat' |
---|
| 564 | echo "NOT FINISHED!!!!" |
---|
| 565 | exit |
---|
| 566 | else |
---|
| 567 | vals='Time:-1|south_north:-1|west_east:-1,west_east,mean,time:XLAT' |
---|
| 568 | if test ${var} = 'ACRAINTOT'; then |
---|
| 569 | files='add|'${file}'|RAINC,add|'${file}'|RAINNC' |
---|
| 570 | python ${HOMEpy}/nc_var.py -S 'time|XLAT|XLONG@'${files} -o compute_opersvarsfiles \ |
---|
| 571 | -v ${var} |
---|
| 572 | mv opersvarsfiles_${var}.nc ${ofold}/${exp} |
---|
| 573 | file=${ofold}/${exp}/opersvarsfiles_${var}.nc |
---|
| 574 | elif test ${var} = 'RAINTOT'; then |
---|
| 575 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 576 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'RAINTOT|RAINC@RAINNC@time' -f ${file} |
---|
| 577 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 578 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 579 | var='pr' |
---|
| 580 | elif test ${var} = 'cllmh'; then |
---|
| 581 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 582 | clouds='cll:clm:clh' |
---|
| 583 | cls=`echo ${clouds} | tr ':' ' '` |
---|
| 584 | for cl in ${cls}; do |
---|
| 585 | file=${ofold}/${exp}/diagnostics.nc |
---|
| 586 | var=${cl} |
---|
| 587 | echo " var: "${var} |
---|
| 588 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cl} |
---|
| 589 | pyexec=$? |
---|
| 590 | if test ${pyexec} -ne 0; then |
---|
| 591 | echo ${errormsg} |
---|
| 592 | echo " "${main}": python fails!" |
---|
| 593 | echo python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cl} |
---|
| 594 | exit |
---|
| 595 | fi |
---|
| 596 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${cl}${oper}.nc |
---|
| 597 | vals='Time:-1|south_north:-1|west_east:-1,Time,mean,XLONG:XLAT' |
---|
| 598 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 599 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cl} |
---|
| 600 | pyexec=$? |
---|
| 601 | if test ${pyexec} -ne 0; then |
---|
| 602 | echo ${errormsg} |
---|
| 603 | echo " "${main}": python fails!" |
---|
| 604 | exit |
---|
| 605 | else |
---|
| 606 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 607 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${cl}t${oper}.nc |
---|
| 608 | fi |
---|
| 609 | done |
---|
| 610 | # break |
---|
| 611 | elif test ${var} = 'WRFbils' && test ! -f ${ofold}/${exp}/diagnostics_${varname}.nc; then |
---|
| 612 | dims='Time@time,south_north@XLAT,west_east@XLONG' |
---|
| 613 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'WRFbils|HFX@LH' -f ${file} |
---|
| 614 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 615 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 616 | var='bils' |
---|
| 617 | elif test ${var} = 'WRFprw' && test ! -f ${ofold}/${exp}/diagnostics_${varname}.nc; then |
---|
| 618 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 619 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'WRFprw|WRFdens@QVAPOR' -f ${file} |
---|
| 620 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 621 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 622 | var='prw' |
---|
| 623 | elif test ${var} = 'WRFrhs' && test ! -f ${ofold}/${exp}/diagnostics_${varname}.nc; then |
---|
| 624 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 625 | python ${HOMEpy}/diagnostics.py -d ${dims} -v 'WRFrhs|PSFC@T2@Q2' -f ${file} |
---|
| 626 | mv diagnostics.nc ${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 627 | file=${ofold}/${exp}/diagnostics_${varname}.nc |
---|
| 628 | var='huss' |
---|
| 629 | elif test ${var} = 'WRFprc'; then |
---|
| 630 | vals='Time:-1|south_north:-1|west_east:-1,west_east,mean,time:XLAT' |
---|
| 631 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 632 | var='prc' |
---|
| 633 | elif test ${var} = 'WRFprls'; then |
---|
| 634 | vals='Time:-1|south_north:-1|west_east:-1,west_east,mean,time:XLAT' |
---|
| 635 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 636 | var='prls' |
---|
| 637 | fi |
---|
| 638 | if test ! -f ${ofold}/${exp}/${varname}${oper}.nc; then |
---|
| 639 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var} |
---|
| 640 | pyexec=$? |
---|
| 641 | if test ${pyexec} -ne 0; then |
---|
| 642 | echo ${errormsg} |
---|
| 643 | echo " "${main}": python fails!" |
---|
| 644 | exit |
---|
| 645 | else |
---|
| 646 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${varname}${oper}.nc |
---|
| 647 | fi |
---|
| 648 | fi |
---|
| 649 | fi |
---|
| 650 | echo "HereLluis"${var} |
---|
| 651 | # Time means |
---|
| 652 | if $(isin_list ${var2Dtmeans} ${var}); then |
---|
| 653 | echo "Computing time means!!" |
---|
| 654 | if test ${var} = 'cllmh'; then |
---|
| 655 | clouds='cll:clm:clh' |
---|
| 656 | clds=`echo ${clouds} | tr ':' ' '` |
---|
| 657 | for cld in ${clds}; do |
---|
| 658 | vals='Time:-1|south_north:-1|west_east:-1,Time,mean,XLONG:XLAT' |
---|
| 659 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 660 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${cld} |
---|
| 661 | pyexec=$? |
---|
| 662 | if test ${pyexec} -ne 0; then |
---|
| 663 | echo ${errormsg} |
---|
| 664 | echo " "${main}": python fails!" |
---|
| 665 | exit |
---|
| 666 | else |
---|
| 667 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 668 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${cld}t${oper}.nc |
---|
| 669 | fi |
---|
| 670 | done |
---|
| 671 | else |
---|
| 672 | vals='Time:-1|south_north:-1|west_east:-1,Time,mean,XLONG:XLAT' |
---|
| 673 | dims='Time@time,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' |
---|
| 674 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${file} -v ${var} |
---|
| 675 | pyexec=$? |
---|
| 676 | if test ${pyexec} -ne 0; then |
---|
| 677 | echo ${errormsg} |
---|
| 678 | echo " "${main}": python fails!" |
---|
| 679 | exit |
---|
| 680 | else |
---|
| 681 | oper=`echo ${vals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 682 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${varname}t${oper}.nc |
---|
| 683 | fi |
---|
| 684 | fi |
---|
| 685 | fi |
---|
| 686 | if test ${var} = 'cllmh'; then exit; fi |
---|
| 687 | ivar=`expr ${ivar} + 1` |
---|
| 688 | # exit |
---|
| 689 | # end of vars |
---|
| 690 | done |
---|
| 691 | |
---|
| 692 | # end of kind vars |
---|
| 693 | done |
---|
| 694 | |
---|
| 695 | done |
---|
| 696 | # end of compute |
---|
| 697 | fi |
---|
| 698 | # Longitudinal means of tmeans |
---|
| 699 | ## |
---|
| 700 | if ${computetlon}; then |
---|
| 701 | echo "Computing Longitudinal means of temporal means..." |
---|
| 702 | for exp in ${exps}; do |
---|
| 703 | echo " exp:"${exp} |
---|
| 704 | for tmean in ${ofold}/${exp}/*tmean.nc; do |
---|
| 705 | fname=`basename ${tmean}` |
---|
| 706 | var=`ncdump -h ${tmean} | grep float | grep mean | tr '(' ' ' | awk '{print $2}'` |
---|
| 707 | vals='south_north:-1|west_east:-1,west_east,mean,XLAT' |
---|
| 708 | dims='bottom_top@bottom_top,south_north@south_north,west_east@west_east' |
---|
| 709 | if test ! -f ${ofold}/${exp}/${var}t-lonmean.nc; then |
---|
| 710 | python ${HOMEpy}/nc_var.py -o file_oper_alongdims -S ${vals} -f ${tmean} -v ${var} |
---|
| 711 | pyexec=$? |
---|
| 712 | if test ${pyexec} -ne 0; then |
---|
| 713 | echo ${errormsg} |
---|
| 714 | echo " "${main}": python fails!" |
---|
| 715 | exit |
---|
| 716 | else |
---|
| 717 | mv file_oper_alongdims_mean.nc ${ofold}/${exp}/${var}t-lonmean.nc |
---|
| 718 | fi |
---|
| 719 | # exit |
---|
| 720 | fi |
---|
| 721 | done |
---|
| 722 | |
---|
| 723 | done |
---|
| 724 | fi |
---|
| 725 | |
---|
| 726 | if ${plot}; then |
---|
| 727 | # Plots |
---|
| 728 | ## |
---|
| 729 | |
---|
| 730 | for exp in ${exps}; do |
---|
| 731 | echo "exp: "${exp} |
---|
| 732 | for vark in ${varks}; do |
---|
| 733 | echo " vark: "${vark} |
---|
| 734 | if test ${vark} = 'mean'; then |
---|
| 735 | gcoups=`echo ${graph_couples_mean} | tr ':' ' '` |
---|
| 736 | elif test ${vark} = 'sfc'; then |
---|
| 737 | if test ${exp} = 'AR40'; then |
---|
| 738 | gcoups=`echo ${graph_couples_sfc_AR40} | tr ':' ' '` |
---|
| 739 | else |
---|
| 740 | gcoups=`echo ${graph_couples_sfc_NPv31} | tr ':' ' '` |
---|
| 741 | fi |
---|
| 742 | elif test ${vark} = 'diag'; then |
---|
| 743 | gcoups=`echo ${graph_couples_diag} | tr ':' ' '` |
---|
| 744 | fi |
---|
| 745 | |
---|
| 746 | for gpair in ${gcoups}; do |
---|
| 747 | shdvar=`echo ${gpair} | tr '@' ' ' | awk '{print $1}'` |
---|
| 748 | cntvar=`echo ${gpair} | tr '@' ' ' | awk '{print $2}'` |
---|
| 749 | echo " couple: "${shdvar}'-'${cntvar} |
---|
| 750 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${shdvar} | grep all_values | awk '{print $3}'` |
---|
| 751 | cntvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${cntvar} | grep all_values | awk '{print $3}'` |
---|
| 752 | files=${ofold}'/'${exp}'/'${shdvar}'mean.nc,'${ofold}'/'${exp}'/'${cntvar}'mean.nc' |
---|
| 753 | |
---|
| 754 | Lshdvals=`expr length ${shdvals}0` |
---|
| 755 | if test ${Lshdvals} -lt 2; then |
---|
| 756 | echo ${errormsg} |
---|
| 757 | echo " Error in drawing_tools.py 'variables_values'!!" |
---|
| 758 | echo " variable '"${shdvar}"' NOT found!" |
---|
| 759 | exit |
---|
| 760 | fi |
---|
| 761 | |
---|
| 762 | Lcntvals=`expr length ${cntvals}0` |
---|
| 763 | if test ${Lcntvals} -lt 2; then |
---|
| 764 | echo ${errormsg} |
---|
| 765 | echo " Error in drawing_tools.py 'variables_values'!!" |
---|
| 766 | echo " variable '"${cntvar}"' NOT found!" |
---|
| 767 | exit |
---|
| 768 | fi |
---|
| 769 | |
---|
| 770 | shdstdn=`echo ${shdvals} | tr ',' ' ' | awk '{print $1}'` |
---|
| 771 | shdcbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
| 772 | shdmin=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 773 | shdmax=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
| 774 | |
---|
| 775 | cntstdn=`echo ${cntvals} | tr ',' ' ' | awk '{print $1}'` |
---|
| 776 | cntmin=`echo ${cntvals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 777 | cntmax=`echo ${cntvals} | tr ',' ' ' | awk '{print $4}'` |
---|
| 778 | |
---|
| 779 | if test ${shdstdn} = 'ERROR' || test ${cntstdn} = 'ERROR'; then |
---|
| 780 | echo ${errmsg} |
---|
| 781 | echo " "${main}": wrong variable names!!!" |
---|
| 782 | echo " shdvals: "${shdvals} |
---|
| 783 | echo " cntvals: "${cntvals} |
---|
| 784 | echo " shdvar: "${shdvar}" cntvar: "${cntvar} |
---|
| 785 | exit |
---|
| 786 | fi |
---|
| 787 | |
---|
| 788 | cntcolor='black' |
---|
| 789 | cntfmt='%g' |
---|
| 790 | |
---|
| 791 | if test ${gpair} = 'va@ua'; then |
---|
| 792 | shdmin=`echo ${shdmin} | awk '{print $1/4.}'` |
---|
| 793 | shdmax=`echo ${shdmax} | awk '{print $1/4.}'` |
---|
| 794 | cntmin=`echo ${cntmin} | awk '{print $1/3.}'` |
---|
| 795 | cntmax=`echo ${cntmax} | awk '{print $1 + 20.}'` |
---|
| 796 | elif test ${gpair} = 'tas@ps'; then |
---|
| 797 | shdmin=`echo ${shdmin} | awk '{print $1 + 50.}'` |
---|
| 798 | shdmax=`echo ${shdmax} | awk '{print $1 - 15.}'` |
---|
| 799 | cntmin=`echo ${cntmin} | awk '{print $1 + 15000.}'` |
---|
| 800 | cntmax=`echo ${cntmax} | awk '{print $1 - 2000.}'` |
---|
| 801 | elif test ${gpair} = 'uas@vas'; then |
---|
| 802 | cntmin=`echo ${cntmin} | awk '{print $1 * 0.1}'` |
---|
| 803 | cntmax=`echo ${cntmax} | awk '{print $1 * 0.1}'` |
---|
| 804 | elif test ${gpair} = 'pr@rsds'; then |
---|
| 805 | # shdmax=`echo ${shdmax} | awk '{print $1 / 20.}'` |
---|
| 806 | cntmax=`echo ${cntmax} | awk '{print $1 / 3.}'` |
---|
| 807 | elif test ${gpair} = 'clt@cll' || test ${gpair} = 'clh@clm'; then |
---|
| 808 | cntcolor='red' |
---|
| 809 | cntfmt='%.1g' |
---|
| 810 | elif test ${gpair} = 'clh@clm'; then |
---|
| 811 | cntmax=`echo ${cntmax} | awk '{print $1}'` |
---|
| 812 | elif test ${gpair} = 'prw@huss'; then |
---|
| 813 | shdmax=`echo ${shdmax} | awk '{print $1*4}'` |
---|
| 814 | elif test ${gpair} = 'prls@prc'; then |
---|
| 815 | shdmax=`echo ${shdmax} | awk '{print $1/1.}'` |
---|
| 816 | cntmax=`echo ${cntmax} | awk '{print $1 * 0.5}'` |
---|
| 817 | elif test ${gpair} = 'hfls@hfss'; then |
---|
| 818 | cntmin='-50.' |
---|
| 819 | cntmax='50.' |
---|
| 820 | fi |
---|
| 821 | |
---|
| 822 | if test ${vark} = 'mean'; then |
---|
| 823 | graphvals=${shdstdn}','${cntstdn}':z|-1,y|-1:z|-1,y|-1:lat:pressure:' |
---|
| 824 | graphvals=${graphvals}${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${shdmin}',' |
---|
| 825 | graphvals=${graphvals}${shdmax}':'${cntmin}','${cntmax}',9:LMDZ+WRF|'${exp} |
---|
| 826 | graphvals=${graphvals}'|meridional|monthly|average|of|'${shdstdn}'|&|' |
---|
| 827 | graphvals=${graphvals}${cntstdn}':pdf:flip@y:None' |
---|
| 828 | else |
---|
| 829 | graphvals=${shdstdn}','${cntstdn}':y|-1,time|-1:y|-1,time|-1:time:XLAT:' |
---|
| 830 | graphvals=${graphvals}${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${shdmin}',' |
---|
| 831 | graphvals=${graphvals}${shdmax}':'${cntmin}','${cntmax}',9:WRF+LMDZ|'${exp} |
---|
| 832 | graphvals=${graphvals}'|mean|meridional|evolution|of|'${shdstdn}'|&|' |
---|
| 833 | graphvals=${graphvals}${cntstdn}':pdf:None:time|hours!since!1949-12-01|' |
---|
| 834 | graphvals=${graphvals}'exct,5,d|%d|date!([DD]):None' |
---|
| 835 | fi |
---|
| 836 | |
---|
| 837 | echo ${files} |
---|
| 838 | echo ${graphvals} |
---|
| 839 | echo ${shdstdn}'mean,'${cntstdn}'mean' |
---|
| 840 | |
---|
| 841 | if test ${vark} = 'sfc' || test ${vark} = 'diag' && |
---|
| 842 | ! $(isin_list ${coup2D} ${gpair}); then |
---|
| 843 | python ${HOMEpy}/drawing.py -f ${files} -o draw_2D_shad_cont_time -S ${graphvals} -v \ |
---|
| 844 | ${shdstdn}'mean,'${cntstdn}'mean' |
---|
| 845 | pyexc=$? |
---|
| 846 | else |
---|
| 847 | python ${HOMEpy}/drawing.py -f ${files} -o draw_2D_shad_cont -S ${graphvals} -v \ |
---|
| 848 | ${shdstdn}'mean,'${cntstdn}'mean' |
---|
| 849 | pyexc=$? |
---|
| 850 | fi |
---|
| 851 | if test ${pyexc} -ne 0; then |
---|
| 852 | echo ${errormsg} |
---|
| 853 | echo " "${main}": drawing.py fails!" |
---|
| 854 | exit |
---|
| 855 | else |
---|
| 856 | mv 2Dfields_shadow-contour.pdf ${ofold}/${exp}/${shdvar}mean_${cntvar}mean.pdf |
---|
| 857 | evince ${ofold}/${exp}/${shdvar}mean_${cntvar}mean.pdf & |
---|
| 858 | fi |
---|
| 859 | |
---|
| 860 | if $(isin_list ${coup2D} ${gpair}); then |
---|
| 861 | graphvals=${shdstdn}','${cntstdn}':south_north|-1,west_east|-1:' |
---|
| 862 | graphvals=${graphvals}'south_north|-1,west_east|-1:longitude:latitude:' |
---|
| 863 | graphvals=${graphvals}${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${shdmin}',' |
---|
| 864 | graphvals=${graphvals}${shdmax}':'${cntmin}','${cntmax}',9:LMDZ+WRF|'${exp} |
---|
| 865 | graphvals=${graphvals}'|monthly|average|of|'${shdstdn}'|&|' |
---|
| 866 | graphvals=${graphvals}${cntstdn}':pdf:flip@y:None' |
---|
| 867 | echo ' '${shdstdn}'mean,'${cntstdn}'mean' |
---|
| 868 | |
---|
| 869 | python ${HOMEpy}/drawing.py -f ${files} -o draw_2D_shad_cont -S ${graphvals} -v \ |
---|
| 870 | ${shdstdn}'mean,'${cntstdn}'mean' |
---|
| 871 | pyexc=$? |
---|
| 872 | if test ${pyexc} -ne 0; then |
---|
| 873 | echo ${errormsg} |
---|
| 874 | echo " "${main}": drawing.py fails!" |
---|
| 875 | exit |
---|
| 876 | else |
---|
| 877 | mv 2Dfields_shadow-contour.pdf ${ofold}/${exp}/${shdvar}tmean_${cntvar}tmean.pdf |
---|
| 878 | evince ${ofold}/${exp}/${shdvar}tmean_${cntvar}tmean.pdf & |
---|
| 879 | fi |
---|
| 880 | fi |
---|
| 881 | # exit |
---|
| 882 | |
---|
| 883 | # end of couples |
---|
| 884 | done |
---|
| 885 | # end of kinds |
---|
| 886 | done |
---|
| 887 | |
---|
| 888 | done |
---|
| 889 | fi |
---|
| 890 | |
---|
| 891 | # 2D single plots |
---|
| 892 | ## |
---|
| 893 | if ${single2Dplot}; then |
---|
| 894 | echo "2D single plots" |
---|
| 895 | for exp in ${exps}; do |
---|
| 896 | echo " exp:"${exp} |
---|
| 897 | for tmean in ${ofold}/${exp}/*tmean.nc ;do |
---|
| 898 | fname=`basename ${tmean}` |
---|
| 899 | var=`ncdump -h ${tmean} | grep float | grep mean | tr '(' ' ' | awk '{print $2}'` |
---|
| 900 | if test ! ${var} = 'cltmean'; then |
---|
| 901 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | \ |
---|
| 902 | grep all_values | awk '{print $3}'` |
---|
| 903 | cbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
| 904 | min=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 905 | max=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
| 906 | |
---|
| 907 | if test ${var} = 'prlsmean'; then xtrms='0,0.00015'; |
---|
| 908 | elif test ${var} = 'prwmean'; then xtrms='0,40'; |
---|
| 909 | elif test ${var} = 'psmean'; then xtrms='99000,102500'; |
---|
| 910 | elif test ${var} = 'r2mean'; then xtrms='0,0.025'; |
---|
| 911 | elif test ${var} = 'tasmean'; then xtrms='275,310'; |
---|
| 912 | elif test ${var} = 'tmlamean'; then xtrms='260,310'; |
---|
| 913 | elif test ${var} = 'uasmean'; then xtrms='-20,20'; |
---|
| 914 | elif test ${var} = 'vasmean'; then xtrms='-20,20'; |
---|
| 915 | else xtrms=${min}','${max}; fi |
---|
| 916 | |
---|
| 917 | # vals=${var}':XLONG|-1,XLAT|-1:XLONG:XLAT:'${cbar}':'${xtrms}':monthly|mean:pdf:' |
---|
| 918 | # vals=${vals}'None:None:true' |
---|
| 919 | # dims='south_north@XLAT,west_east@XLONG' |
---|
| 920 | python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -S longitude,latitude \ |
---|
| 921 | -f ${tmean} -v XLONG,XLAT |
---|
| 922 | vals=${var}':longitude|-1,latitude|-1:longitude:latitude:'${cbar}':'${xtrms}':monthly|mean:pdf:' |
---|
| 923 | vals=${vals}'None:None:true' |
---|
| 924 | dims='south_north@latitude,west_east@longitude' |
---|
| 925 | python ${HOMEpy}/drawing.py -o draw_2D_shad -S ${vals} -f ${tmean} -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}/${exp}/${var}tmean.pdf |
---|
| 933 | # evince ${ofold}/${exp}/${var}tmean.pdf & |
---|
| 934 | # exit |
---|
| 935 | fi |
---|
| 936 | fi |
---|
| 937 | done |
---|
| 938 | done |
---|
| 939 | fi |
---|
| 940 | |
---|
| 941 | # lon 2 vertical section |
---|
| 942 | ## |
---|
| 943 | echo "lon 2 vertical section ..." |
---|
| 944 | vars=`echo ${lon2DZsecvars} | tr ':' ' '` |
---|
| 945 | pts=`echo ${lon2DZsecpts} | tr ':' ' '` |
---|
| 946 | |
---|
| 947 | if ${lonZsec}; then |
---|
| 948 | for exp in ${exps}; do |
---|
| 949 | file=${ofold}/${exp}/vertical_interpolation_WRFp.nc |
---|
| 950 | # python ${HOMEpy}/nc_var.py -o WRF_CFlonlat_creation -S longitude,latitude \ |
---|
| 951 | # -f ${file} -v lon,lat |
---|
| 952 | ## ALREADY done! |
---|
| 953 | # python ${HOMEpy}/nc_var.py -o valmod -S lowthres@oper,0.,sumc,360. -f ${file} \ |
---|
| 954 | # -v lon |
---|
| 955 | if test ${exp} = 'AR40'; then labexp='wlmdza' |
---|
| 956 | else labexp='wlmdzb'; fi |
---|
| 957 | |
---|
| 958 | for pt in ${pts}; do |
---|
| 959 | echo " pt: "${pt} |
---|
| 960 | vals='x:15|y:'${pt}'|time:23' |
---|
| 961 | lonval=`python ${HOMEpy}/nc_var.py -o varout -f ${file} -S ${vals} -v lon | \ |
---|
| 962 | awk '{print $2}'` |
---|
| 963 | latval=`python ${HOMEpy}/nc_var.py -o varout -f ${file} -S ${vals} -v lat | \ |
---|
| 964 | awk '{print $2}'` |
---|
| 965 | tval=`python ${HOMEpy}/nc_var.py -o varout -f ${file} -S ${vals} -v time | \ |
---|
| 966 | awk '{print $2}'` |
---|
| 967 | for var in ${vars}; do |
---|
| 968 | echo " var: "${var} |
---|
| 969 | |
---|
| 970 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | \ |
---|
| 971 | grep all_values | awk '{print $3}'` |
---|
| 972 | cbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
| 973 | min=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 974 | max=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
| 975 | |
---|
| 976 | # WRFt,U,V,WRFrh,WRFght |
---|
| 977 | if test ${var} = 'WRFght'; then xtrms='0,40000'; |
---|
| 978 | elif test ${var} = 'WRFt'; then xtrms='200,300'; |
---|
| 979 | elif test ${var} = 'U'; then xtrms='-40,40'; |
---|
| 980 | elif test ${var} = 'V'; then xtrms='-20,20'; |
---|
| 981 | else xtrms=${min}','${max}; fi |
---|
| 982 | |
---|
| 983 | # Plotting |
---|
| 984 | vals=${var}':x|-1,y|'${pt}',z|-1,time|24:lon:pressure:'${cbar}':' |
---|
| 985 | vals=${vals}${xtrms}':'${labexp}'|vertical|longitudinal|section|('${latval} |
---|
| 986 | vals=${vals}'$^{\circ}$):pdf:flip@y:None:true' |
---|
| 987 | python ${HOMEpy}/drawing.py -o draw_2D_shad -S ${vals} -f ${file} -v ${var} |
---|
| 988 | pyexec=$? |
---|
| 989 | if test ${pyexec} -ne 0; then |
---|
| 990 | echo ${errormsg} |
---|
| 991 | echo " "${main}": python fails!" |
---|
| 992 | exit |
---|
| 993 | else |
---|
| 994 | mv 2Dfields_shadow.pdf ${ofold}/${exp}/${var}_lonZsec_${pt}pt.pdf |
---|
| 995 | evince ${ofold}/${exp}/${var}_lonZsec_${pt}pt.pdf & |
---|
| 996 | fi |
---|
| 997 | |
---|
| 998 | cntcolor='black' |
---|
| 999 | cntfmt='%g' |
---|
| 1000 | |
---|
| 1001 | if test ${var} = 'WRFght'; then cxtrms='0,40000'; |
---|
| 1002 | elif test ${var} = 'WRFt'; then cxtrms='200,300'; |
---|
| 1003 | elif test ${var} = 'U'; then cxtrms='-40,40'; |
---|
| 1004 | elif test ${var} = 'V'; then cxtrms='-20,20'; |
---|
| 1005 | else cxtrms=${min}','${max}; fi |
---|
| 1006 | |
---|
| 1007 | graphvals=${var}','${var}':x|-1,y|'${pt}',z|-1,time|24:' |
---|
| 1008 | graphvals=${graphvals}'x|-1,y|'${pt}',z|-1,time|24:lon:pressure:' |
---|
| 1009 | graphvals=${graphvals}${cbar}':fixsigc,'${cntcolor}':'${cntfmt}':'${xtrms}':' |
---|
| 1010 | graphvals=${graphvals}${cxtrms}',15:'${labexp} |
---|
| 1011 | graphvals=${graphvals}'|vertical|zonal|section|('${latval}'$^{\circ}$):pdf:' |
---|
| 1012 | graphvals=${graphvals}'flip@y:None' |
---|
| 1013 | |
---|
| 1014 | python ${HOMEpy}/drawing.py -o draw_2D_shad_cont -S ${graphvals} \ |
---|
| 1015 | -f ${file},${file} -v ${var},${var} |
---|
| 1016 | pyexec=$? |
---|
| 1017 | if test ${pyexec} -ne 0; then |
---|
| 1018 | echo ${errormsg} |
---|
| 1019 | echo " "${main}": python fails!" |
---|
| 1020 | exit |
---|
| 1021 | else |
---|
| 1022 | mv 2Dfields_shadow-contour.pdf ${ofold}/${exp}/${var}_lonZsec-cnt_${pt}pt.pdf |
---|
| 1023 | evince ${ofold}/${exp}/${var}_lonZsec-cnt_${pt}pt.pdf & |
---|
| 1024 | fi |
---|
| 1025 | |
---|
| 1026 | # exit |
---|
| 1027 | done |
---|
| 1028 | done |
---|
| 1029 | done |
---|
| 1030 | fi |
---|
| 1031 | |
---|
| 1032 | echo "Computing differences" |
---|
| 1033 | exp1=`echo ${experiments} | tr ':' ' ' | awk '{print $1}'` |
---|
| 1034 | exp2=`echo ${experiments} | tr ':' ' ' | awk '{print $2}'` |
---|
| 1035 | |
---|
| 1036 | diffks=`echo ${diffkinds} | tr ':' ' '` |
---|
| 1037 | |
---|
| 1038 | if test ${differences}; then |
---|
| 1039 | for kind in ${diffks}; do |
---|
| 1040 | echo ${kind} |
---|
| 1041 | case ${kind} in |
---|
| 1042 | 'diffZ') |
---|
| 1043 | vars=`echo ${diffZvars} | tr ':' ' '` |
---|
| 1044 | fileorigd='mean.nc' |
---|
| 1045 | ;; |
---|
| 1046 | 'diffH') |
---|
| 1047 | vars=`echo ${diffHvars} | tr ':' ' '` |
---|
| 1048 | fileorigd='tmean.nc' |
---|
| 1049 | ;; |
---|
| 1050 | esac |
---|
| 1051 | |
---|
| 1052 | echo " "${var} |
---|
| 1053 | for var in ${vars}; do |
---|
| 1054 | if test ! -f ${ofold}/${var}_diff.nc; then |
---|
| 1055 | # cdo sub ${ofold}/${exp1}/${var}${fileorigd} ${ofold}/${exp2}/${var}${fileorigd} ${ofold}/${var}_diff.nc |
---|
| 1056 | if test ${kind} = 'diffZ'; then |
---|
| 1057 | values='pressure|lat@add|'${ofold}'/'${exp1}'/'${var}${fileorigd}'|'${var}'mean,' |
---|
| 1058 | values=${values}'sub|'${ofold}'/'${exp2}'/'${var}${fileorigd}'|'${var}'mean' |
---|
| 1059 | python ${HOMEpy}/nc_var.py -o compute_opersvarsfiles -S ${values} -v ${var} |
---|
| 1060 | pyexec=$? |
---|
| 1061 | if test ${pyexec} -ne 0; then |
---|
| 1062 | echo ${errormsg} |
---|
| 1063 | echo " "${main}": python fails!" |
---|
| 1064 | exit |
---|
| 1065 | fi |
---|
| 1066 | mv opersvarsfiles_${var}.nc ${ofold}/${var}_diff.nc |
---|
| 1067 | else |
---|
| 1068 | values='longitude|latitude@add|'${ofold}'/'${exp1}'/'${var}${fileorigd}'|'${var}'mean,' |
---|
| 1069 | values=${values}'sub|'${ofold}'/'${exp2}'/'${var}${fileorigd}'|'${var}'mean' |
---|
| 1070 | python ${HOMEpy}/nc_var.py -o compute_opersvarsfiles -S ${values} -v ${var} |
---|
| 1071 | pyexec=$? |
---|
| 1072 | if test ${pyexec} -ne 0; then |
---|
| 1073 | echo ${errormsg} |
---|
| 1074 | echo " "${main}": python fails!" |
---|
| 1075 | exit |
---|
| 1076 | fi |
---|
| 1077 | mv opersvarsfiles_${var}.nc ${ofold}/${var}_diff.nc |
---|
| 1078 | fi |
---|
| 1079 | fi |
---|
| 1080 | done |
---|
| 1081 | |
---|
| 1082 | if test ${kind} = 'diffZ'; then |
---|
| 1083 | coups=`echo ${graph_couples_mean} | tr ':' ' '` |
---|
| 1084 | for coup in ${coups}; do |
---|
| 1085 | shdvar=`echo ${coup} | tr '@' ' ' | awk '{print $1}'` |
---|
| 1086 | cntvar=`echo ${coup} | tr '@' ' ' | awk '{print $2}'` |
---|
| 1087 | |
---|
| 1088 | echo " couple: "${shdvar}'-'${cntvar} |
---|
| 1089 | |
---|
| 1090 | shdvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${shdvar} | grep all_values | awk '{print $3}'` |
---|
| 1091 | cntvals=`python ${HOMEpy}/drawing.py -o variable_values -S ${cntvar} | grep all_values | awk '{print $3}'` |
---|
| 1092 | files=${ofold}'/'${shdvar}'_diff.nc,'${ofold}'/'${cntvar}'_diff.nc' |
---|
| 1093 | |
---|
| 1094 | shdstdn=`echo ${shdvals} | tr ',' ' ' | awk '{print $1}'` |
---|
| 1095 | shdcbar=`echo ${shdvals} | tr ',' ' ' | awk '{print $7}'` |
---|
| 1096 | shdmin=`echo ${shdvals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 1097 | shdmax=`echo ${shdvals} | tr ',' ' ' | awk '{print $4}'` |
---|
| 1098 | |
---|
| 1099 | cntstdn=`echo ${cntvals} | tr ',' ' ' | awk '{print $1}'` |
---|
| 1100 | cntmin=`echo ${cntvals} | tr ',' ' ' | awk '{print $3}'` |
---|
| 1101 | cntmax=`echo ${cntvals} | tr ',' ' ' | awk '{print $4}'` |
---|
| 1102 | |
---|
| 1103 | shdcbar='seismic' |
---|
| 1104 | if test ${coup} = 'va@ua'; then |
---|
| 1105 | shdmin=-4. |
---|
| 1106 | shdmax=4. |
---|
| 1107 | cntmin=-10. |
---|
| 1108 | cntmax=10. |
---|
| 1109 | elif test ${coup} = 'hus@ta'; then |
---|
| 1110 | shdmin=-0.2 |
---|
| 1111 | shdmax=0.2 |
---|
| 1112 | cntmin=-2. |
---|
| 1113 | cntmax=2. |
---|
| 1114 | fi |
---|
| 1115 | |
---|
| 1116 | cntcolor='black' |
---|
| 1117 | cntfmt='%g' |
---|
| 1118 | |
---|
| 1119 | graphvals=${shdstdn}','${cntstdn}':x|-1,y|-1,x_2|-1:x|-1,y|-1,x_2|-1:lat:' |
---|
| 1120 | graphvals=${graphvals}'pressure:'${shdcbar}':fixsigc,'${cntcolor}':'${cntfmt}':' |
---|
| 1121 | graphvals=${graphvals}${shdmin}','${shdmax}':'${cntmin}','${cntmax}',9:' |
---|
| 1122 | graphvals=${graphvals}${exp1}'-'${exp2}'|meridional|monthly|average|differences|of|' |
---|
| 1123 | graphvals=${graphvals}${shdstdn}'|&|'${cntstdn}':pdf:flip@y:None' |
---|
| 1124 | |
---|
| 1125 | python ${HOMEpy}/drawing.py -o draw_2D_shad_cont -S ${graphvals} \ |
---|
| 1126 | -f ${files} -v ${shdvar},${cntvar} |
---|
| 1127 | pyexec=$? |
---|
| 1128 | if test ${pyexec} -ne 0; then |
---|
| 1129 | echo ${errormsg} |
---|
| 1130 | echo " "${main}": python fails!" |
---|
| 1131 | exit |
---|
| 1132 | else |
---|
| 1133 | mv 2Dfields_shadow-contour.pdf ${ofold}/${shdvar}-${cntvar}_diff.pdf |
---|
| 1134 | evince ${ofold}/${shdvar}-${cntvar}_diff.pdf & |
---|
| 1135 | fi |
---|
| 1136 | done |
---|
| 1137 | # exit |
---|
| 1138 | else |
---|
| 1139 | for var in ${vars}; do |
---|
| 1140 | echo " "${var} |
---|
| 1141 | vals=`python ${HOMEpy}/drawing.py -o variable_values -S ${var} | grep all_values | awk '{print $3}'` |
---|
| 1142 | file=${ofold}/${var}_diff.nc |
---|
| 1143 | |
---|
| 1144 | stdn=`echo ${vals} | tr ',' ' ' | awk '{print $1}'` |
---|
| 1145 | cbar='seismic' |
---|
| 1146 | |
---|
| 1147 | if test ${var} = 'uas'; then xtrms='-10.,10.'; |
---|
| 1148 | elif test ${var} = 'vas'; then xtrms='-5,5'; |
---|
| 1149 | elif test ${var} = 'ps'; then xtrms='-500,500'; |
---|
| 1150 | elif test ${var} = 'pr'; then xtrms='-0.001,0.001'; |
---|
| 1151 | else xtrms=${min}','${max}; fi |
---|
| 1152 | |
---|
| 1153 | vals=${var}':x|-1,y|-1:longitude:latitude:'${cbar}':' |
---|
| 1154 | vals=${vals}${xtrms}':'${exp1}'-'${exp2}'|meridional|monthly|average|differences:' |
---|
| 1155 | vals=${vals}'pdf:None:None:true' |
---|
| 1156 | python ${HOMEpy}/drawing.py -o draw_2D_shad -S ${vals} -f ${file} -v ${var} |
---|
| 1157 | pyexec=$? |
---|
| 1158 | if test ${pyexec} -ne 0; then |
---|
| 1159 | echo ${errormsg} |
---|
| 1160 | echo " "${main}": python fails!" |
---|
| 1161 | exit |
---|
| 1162 | else |
---|
| 1163 | mv 2Dfields_shadow.pdf ${ofold}/${var}_diff.pdf |
---|
| 1164 | evince ${ofold}/${var}_diff.pdf & |
---|
| 1165 | fi |
---|
| 1166 | # exit |
---|
| 1167 | done |
---|
| 1168 | fi |
---|
| 1169 | done |
---|
| 1170 | fi |
---|