Changeset 972 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 29, 2016, 5:58:42 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.bash
r971 r972 345 345 346 346 echo "varcomp= "${varcomp} 347 } 348 349 function compvars_listconstruct() { 350 # Function to construct the list of variables to compute 351 # VarKinds= ':' separated list of kind variables to compute 352 # TestFiles= ':' list of files to test how to compute the variable 353 ## 354 fname='compvars_listconstruct' 355 356 VarKinds=$1 357 TestFiles=$2 358 359 varks=`echo ${VarKinds} | tr ':' ' '` 360 361 combo=false 362 ik=1 363 itotv=1 364 for vark in ${varks}; do 365 if test ! ${vark} = 'diff'; then 366 echo " "${vark}" ..." 367 case ${vark} in 368 'acc') 369 varvks=${varacc} 370 ;; 371 'combo') 372 combo=true 373 varvcombo=${varcombo} 374 varcos=`echo ${varvcombo} | tr ':' ' '` 375 varvks='' 376 ivco=1 377 for vco in ${varcos}; do 378 vn=`echo ${vco} | tr '@' ' ' | awk '{print $1}'` 379 if test ${ivco} -eq 1; then 380 varvks=${vco} 381 else 382 varvks=${varvks}':'${vco} 383 fi 384 ivco=`expr ${ivco} + 1` 385 done 386 ;; 387 'direct') 388 varvks=${vardirect} 389 ;; 390 'last') 391 varvks=${varlast} 392 ;; 393 'Lmean') 394 varvks=${varLmean} 395 ;; 396 'Lsec') 397 varvks=${varLsec} 398 ;; 399 'lmean') 400 varvks=${varlmean} 401 ;; 402 'lsec') 403 varvks=${varlsec} 404 ;; 405 'pinterp') 406 varvks=${varpinterp} 407 ;; 408 'tmean') 409 varvks=${vartmean} 410 ;; 411 'xmean') 412 varvks=${varxmean} 413 ;; 414 'ymean') 415 varvks=${varymean} 416 ;; 417 'zsum') 418 varvks=${varzsum} 419 ;; 420 '*') 421 echo ${errmsg} 422 echo " "${main}": variable kind '"${vark}"' not ready!!" 423 exit 424 ;; 425 esac 426 427 # Do we have variables for this kind? 428 Lvarvks=`expr length ${varvks}'0'` 429 if test ${Lvarvks} -lt 2; then 430 ferrmsg 1 ${main} "variable!kind!"${vark}"!without!variables" 431 fi 432 if test ${ik} -eq 1; then 433 allvars=${varvks} 434 else 435 allvars=${allvars}':'${varvks} 436 fi 437 ik=`expr ${ik} + 1` 438 vars=`echo ${varvks} | tr ':' ' '` 439 440 # Variables loop 441 ## 442 iv=1 443 for var in ${vars}; do 444 echo " "${var} 445 # How to compute it? 446 varcomp=`variable_compute ${iwdir} ${var} ${TestFiles} | grep varcomp | \ 447 awk '{print $2}'` 448 449 if test ${itotv} -eq 1; then 450 varcompute=${varcomp} 451 else 452 varcompute=${varcompute}';'${varcomp} 453 fi 454 455 iv=`expr ${iv} + 1` 456 itotv=`expr ${itotv} + 1` 457 458 # end loop of variables 459 done 460 fi 461 # end of kind of variables 462 done 463 464 echo ${fname}" varcompute= "${varcompute}_${itotv} 347 465 } 348 466 … … 1357 1475 cd ${rootsh} 1358 1476 1359 # Kind variables loop 1360 ## 1361 combo=false 1362 ik=1 1363 itotv=1 1364 for vark in ${varks}; do 1365 if test ! ${vark} = 'diff'; then 1366 echo " "${vark}" ..." 1367 case ${vark} in 1368 'acc') 1369 varvks=${varacc} 1370 ;; 1371 'combo') 1372 combo=true 1373 varvcombo=${varcombo} 1374 varcos=`echo ${varvcombo} | tr ':' ' '` 1375 varvks='' 1376 ivco=1 1377 for vco in ${varcos}; do 1378 vn=`echo ${vco} | tr '@' ' ' | awk '{print $1}'` 1379 if test ${ivco} -eq 1; then 1380 varvks=${vco} 1381 else 1382 varvks=${varvks}':'${vco} 1383 fi 1384 ivco=`expr ${ivco} + 1` 1385 done 1386 ;; 1387 'direct') 1388 varvks=${vardirect} 1389 ;; 1390 'last') 1391 varvks=${varlast} 1392 ;; 1393 'Lmean') 1394 varvks=${varLmean} 1395 ;; 1396 'Lsec') 1397 varvks=${varLsec} 1398 ;; 1399 'lmean') 1400 varvks=${varlmean} 1401 ;; 1402 'lsec') 1403 varvks=${varlsec} 1404 ;; 1405 'pinterp') 1406 varvks=${varpinterp} 1407 ;; 1408 'tmean') 1409 varvks=${vartmean} 1410 ;; 1411 'xmean') 1412 varvks=${varxmean} 1413 ;; 1414 'ymean') 1415 varvks=${varymean} 1416 ;; 1417 'zsum') 1418 varvks=${varzsum} 1419 ;; 1420 '*') 1421 echo ${errmsg} 1422 echo " "${main}": variable kind '"${vark}"' not ready!!" 1423 exit 1424 ;; 1425 esac 1426 1427 # Do we have variables for this kind? 1428 Lvarvks=`expr length ${varvks}'0'` 1429 if test ${Lvarvks} -lt 2; then 1430 ferrmsg 1 ${main} "variable!kind!"${vark}"!without!variables" 1431 fi 1432 if test ${ik} -eq 1; then 1433 allvars=${varvks} 1434 else 1435 allvars=${allvars}':'${varvks} 1436 fi 1437 ik=`expr ${ik} + 1` 1438 vars=`echo ${varvks} | tr ':' ' '` 1439 1440 # Variables loop 1441 ## 1442 iv=1 1443 for var in ${vars}; do 1444 echo " "${var} 1445 # How to compute it? 1446 varcomp=`variable_compute ${iwdir} ${var} ${testfiles} | grep varcomp | \ 1447 awk '{print $2}'` 1448 1449 if test ${itotv} -eq 1; then 1450 varcompute=${varcomp} 1451 else 1452 varcompute=${varcompute}';'${varcomp} 1453 fi 1454 1455 iv=`expr ${iv} + 1` 1456 itotv=`expr ${itotv} + 1` 1457 1458 # end loop of variables 1459 done 1460 fi 1461 # end of kind of variables 1462 done 1477 varcompute=`compvars_listconstruct ${varkinds} $(echo ${testfiles} | tr '@' ':')\ 1478 | grep varcompute | awk '{print $3}'` 1463 1479 1464 1480 # Outwritting the varcompute to avoid next time (if it is not filescratch!) 1465 1481 cat << EOF > ${owdir}/varcompute.inf 1466 1482 files: ${files} 1467 varcompute: $ {varcompute}1468 itotv: $ {itotv}1483 varcompute: $(echo ${varcompute} | tr '_' ' ' | awk '{print $1}') 1484 itotv: $(echo ${varcompute} | tr '_' ' ' | awk '{print $2}') 1469 1485 testfs: ${testfiles} 1470 1486 EOF 1487 1488 exit 1471 1489 else 1472 1490 echo $warnmsg
Note: See TracChangeset
for help on using the changeset viewer.