Changeset 974 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 29, 2016, 6:33:14 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.bash
r973 r974 462 462 done 463 463 464 echo ${fname}" varcompute= "${varcompute}_${itotv} 464 echo ${fname}" varcompute= "${varcompute}_${itotv}_${combo} 465 465 } 466 466 … … 1045 1045 } 1046 1046 1047 function compute_combos(){ 1048 # Function to compute the given list of combos 1049 # Iwdir= input folder 1050 # Owdir= output folder 1051 # Files= files to use 1052 # Testfiles= files for testing the wat of compute a given variable 1053 # Moddims= dimensions of the input files 1054 # Modvdims= variable dimensions of the input files 1055 # VarCombo= ':' separated list of combos to compute 1056 # Filescratch= do we need to start files from the scratch? 1057 fname='compute_combos' 1058 1059 set -x 1060 1061 Iwdir=$1 1062 Owdir=$2 1063 Files=$3 1064 Testfiles=$4 1065 Moddims=$5 1066 Modvdims=$6 1067 VarCombo=$7 1068 Filescratch=$8 1069 1070 varcos=`echo ${VarCombo} | tr ':' ' '` 1071 for vco in ${varcos}; do 1072 echo " "${vco} 1073 CFvarn=`echo ${vco} | tr ';' ' ' | awk '{print $1}'` 1074 cvar=`variable_compute ${Iwdir} ${CFvarn} ${Testfiles} | grep varcomp | \ 1075 awk '{print $2}'` 1076 CFv=`echo ${cvar} | tr '|' ' ' | awk '{print $1}'` 1077 vark=`echo ${cvar} | tr '|' ' ' | awk '{print $2}'` 1078 fileh=`echo ${cvar} | tr '|' ' ' | awk '{print $3}'` 1079 modv=`echo ${cvar} | tr '|' ' ' | awk '{print $4}'` 1080 diagv=`echo ${cvar} | tr '|' ' ' | awk '{print $5}'` 1081 1082 # if $(index_string ${vark} 'pinterp') -ne -1; then 1083 # fhead=${fileh}'p' 1084 # else 1085 # fhead=${fileh} 1086 # fi 1087 combs=`echo ${vco} | tr ';' ' ' | awk '{print $2}' | tr '@' ' '` 1088 ifile=${CFv}_${fhead} 1089 for comb in ${combs}; do 1090 combcvar=${CFv}'|'${comb}'|'${fhead}'|'${modv}'|'${diagv} 1091 compute_statistics ${Iwdir} ${ifile}.nc ${Owdir} ${combcvar} ${Moddims} \ 1092 ${Modvdims} ${Filescratch} ${ifile}.nc 1093 ifile=${ifile}_${comb} 1094 1095 # Adding 'surnames' to the variable's name 1096 if test ${comb} = 'turb'; then 1097 CFv=${CFv}'turb' 1098 fi 1099 if $(isInlist ${varmeanname} ${comb}); then 1100 CFv=${CFv}'mean' 1101 fi 1102 1103 isc=`expr ${isc} + 1` 1104 # End of combo 1105 done 1106 # End of combo variables 1107 done 1108 1109 return 1110 } 1111 1047 1112 function draw_plot(){ 1048 1113 # Function to carry out the drawing of the plots … … 1539 1604 cd ${rootsh} 1540 1605 1541 varcomp ute=`compvars_listconstruct ${varkinds} $(echo ${testfiles} | tr '@' ':')\1606 varcompt=`compvars_listconstruct ${varkinds} $(echo ${testfiles} | tr '@' ':') \ 1542 1607 | grep varcompute | awk '{print $3}'` 1608 1609 varcompute=`echo ${varcompt} | tr '_' ' ' | awk '{print $1}'` 1610 itotv=`echo ${varcompt} | tr '_' ' ' | awk '{print $2}'` 1611 combo=`echo ${varcompt} | tr '_' ' ' | awk '{print $3}'` 1543 1612 1544 1613 # Outwritting the varcompute to avoid next time (if it is not filescratch!) 1545 1614 cat << EOF > ${owdir}/varcompute.inf 1546 1615 files: ${files} 1547 varcompute: $ (echo ${varcompute} | tr '_' ' ' | awk '{print $1}')1548 itotv: $ (echo ${varcompute} | tr '_' ' ' | awk '{print $2}')1616 varcompute: ${varcompute} 1617 itotv: $itotv} 1549 1618 testfs: ${testfiles} 1619 combo: ${combo} 1550 1620 EOF 1551 1621 else … … 1556 1626 itotv=`cat ${owdir}/varcompute.inf | grep itotv | awk '{print $2}'` 1557 1627 testfiles=`cat ${owdir}/varcompute.inf | grep testfs | awk '{print $2}'` 1628 combo=`cat ${owdir}/varcompute.inf | grep combo | awk '{print $2}'` 1558 1629 # End of avoiding to repeat all the experiment search 1559 1630 fi … … 1564 1635 echo " Computing all variables ..." 1565 1636 1566 compute_vars ${iwdir} ${owdir} ${files} ${moddims} ${modvdims} ${varcompute} ${filescratch}1567 1568 exit 1637 compute_vars ${iwdir} ${owdir} ${files} ${moddims} ${modvdims} ${varcompute} \ 1638 ${filescratch} 1639 1569 1640 # Computing combos 1570 1641 if ${combo}; then 1571 1642 echo " Computing combos: "${varcombo} 1572 varcos=`echo ${varcombo} | tr ':' ' '` 1573 for vco in ${varcos}; do 1574 echo " "${vco} 1575 CFvarn=`echo ${vco} | tr ';' ' ' | awk '{print $1}'` 1576 cvar=`variable_compute ${iwdir} ${CFvarn} ${testfiles} | grep varcomp | \ 1577 awk '{print $2}'` 1578 CFv=`echo ${cvar} | tr '|' ' ' | awk '{print $1}'` 1579 vark=`echo ${cvar} | tr '|' ' ' | awk '{print $2}'` 1580 fileh=`echo ${cvar} | tr '|' ' ' | awk '{print $3}'` 1581 modv=`echo ${cvar} | tr '|' ' ' | awk '{print $4}'` 1582 diagv=`echo ${cvar} | tr '|' ' ' | awk '{print $5}'` 1583 1584 # if $(index_string ${vark} 'pinterp') -ne -1; then 1585 # fhead=${fileh}'p' 1586 # else 1587 # fhead=${fileh} 1588 # fi 1589 combs=`echo ${vco} | tr ';' ' ' | awk '{print $2}' | tr '@' ' '` 1590 ifile=${CFv}_${fhead} 1591 for comb in ${combs}; do 1592 combcvar=${CFv}'|'${comb}'|'${fhead}'|'${modv}'|'${diagv} 1593 compute_statistics ${iwdir} ${ifile}.nc ${owdir} ${combcvar} ${moddims} \ 1594 ${modvdims} ${filescratch} ${ifile}.nc 1595 ifile=${ifile}_${comb} 1596 1597 # Adding 'surnames' to the variable's name 1598 if test ${comb} = 'turb'; then 1599 CFv=${CFv}'turb' 1600 fi 1601 if $(isInlist ${varmeanname} ${comb}); then 1602 CFv=${CFv}'mean' 1603 fi 1604 1605 isc=`expr ${isc} + 1` 1606 # End of combo 1607 done 1608 # End of combo variables 1609 done 1643 compute_combos ${iwdir} ${owdir} ${files} ${testfiles} ${moddims} ${modvdims} \ 1644 ${varcombo} ${filescratch} 1610 1645 fi 1646 1647 exit 1611 1648 1612 1649 echo " "${main}": "${ic}" variables has been computed"
Note: See TracChangeset
for help on using the changeset viewer.