Index: trunk/tools/model_graphics.bash
===================================================================
--- trunk/tools/model_graphics.bash	(revision 973)
+++ trunk/tools/model_graphics.bash	(revision 974)
@@ -462,5 +462,5 @@
   done
 
-  echo ${fname}" varcompute= "${varcompute}_${itotv}
+  echo ${fname}" varcompute= "${varcompute}_${itotv}_${combo}
 }
 
@@ -1045,4 +1045,69 @@
 }
 
+function compute_combos(){
+# Function to compute the given list of combos
+#   Iwdir= input folder
+#   Owdir= output folder
+#   Files= files to use
+#   Testfiles= files for testing the wat of compute a given variable
+#   Moddims= dimensions of the input files
+#   Modvdims= variable dimensions of the input files
+#   VarCombo= ':' separated list of combos to compute
+#   Filescratch= do we need to start files from the scratch?
+  fname='compute_combos'
+
+  set -x
+
+  Iwdir=$1
+  Owdir=$2
+  Files=$3
+  Testfiles=$4
+  Moddims=$5
+  Modvdims=$6
+  VarCombo=$7
+  Filescratch=$8
+
+  varcos=`echo ${VarCombo} | tr ':' ' '`
+  for vco in ${varcos}; do
+    echo "        "${vco}
+    CFvarn=`echo ${vco} | tr ';' ' ' | awk '{print $1}'`
+    cvar=`variable_compute ${Iwdir} ${CFvarn} ${Testfiles} | grep varcomp |          \
+      awk '{print $2}'`
+    CFv=`echo ${cvar} | tr '|' ' ' | awk '{print $1}'`
+    vark=`echo ${cvar} | tr '|' ' ' | awk '{print $2}'`
+    fileh=`echo ${cvar} | tr '|' ' ' | awk '{print $3}'`
+    modv=`echo ${cvar} | tr '|' ' ' | awk '{print $4}'`
+    diagv=`echo ${cvar} | tr '|' ' ' | awk '{print $5}'`
+
+#        if $(index_string ${vark} 'pinterp') -ne -1; then
+#          fhead=${fileh}'p'
+#        else
+#          fhead=${fileh}
+#        fi
+    combs=`echo ${vco} | tr ';' ' ' | awk '{print $2}' | tr '@' ' '`
+    ifile=${CFv}_${fhead}
+    for comb in ${combs}; do
+      combcvar=${CFv}'|'${comb}'|'${fhead}'|'${modv}'|'${diagv}
+      compute_statistics ${Iwdir} ${ifile}.nc ${Owdir} ${combcvar} ${Moddims}    \
+        ${Modvdims} ${Filescratch} ${ifile}.nc
+      ifile=${ifile}_${comb}
+
+      # Adding 'surnames' to the variable's name
+      if test ${comb} = 'turb'; then
+        CFv=${CFv}'turb'
+      fi
+      if $(isInlist ${varmeanname} ${comb}); then
+        CFv=${CFv}'mean'
+      fi
+
+      isc=`expr ${isc} + 1`
+    # End of combo 
+    done
+  # End of combo variables
+  done
+
+  return
+}
+
 function draw_plot(){
 # Function to carry out the drawing of the plots
@@ -1539,13 +1604,18 @@
       cd ${rootsh}
 
-      varcompute=`compvars_listconstruct ${varkinds} $(echo ${testfiles} | tr '@' ':')\
+      varcompt=`compvars_listconstruct ${varkinds} $(echo ${testfiles} | tr '@' ':') \
        | grep varcompute | awk '{print $3}'`
+
+      varcompute=`echo ${varcompt} | tr '_' ' ' | awk '{print $1}'`
+      itotv=`echo ${varcompt} | tr '_' ' ' | awk '{print $2}'`
+      combo=`echo ${varcompt} | tr '_' ' ' | awk '{print $3}'`
 
       # Outwritting the varcompute to avoid next time (if it is not filescratch!)
       cat << EOF > ${owdir}/varcompute.inf
 files: ${files}
-varcompute: $(echo ${varcompute} | tr '_' ' ' | awk '{print $1}')
-itotv: $(echo ${varcompute} | tr '_' ' ' | awk '{print $2}')
+varcompute: ${varcompute}
+itotv: $itotv}
 testfs: ${testfiles}
+combo: ${combo}
 EOF
     else
@@ -1556,4 +1626,5 @@
       itotv=`cat ${owdir}/varcompute.inf | grep itotv | awk '{print $2}'`
       testfiles=`cat ${owdir}/varcompute.inf | grep testfs | awk '{print $2}'`
+      combo=`cat ${owdir}/varcompute.inf | grep combo | awk '{print $2}'`
 # End of avoiding to repeat all the experiment search
     fi
@@ -1564,49 +1635,15 @@
     echo "      Computing all variables ..."
 
-    compute_vars ${iwdir} ${owdir} ${files} ${moddims} ${modvdims} ${varcompute} ${filescratch}
-
-    exit
+    compute_vars ${iwdir} ${owdir} ${files} ${moddims} ${modvdims} ${varcompute}     \
+      ${filescratch}
+
     # Computing combos
     if ${combo}; then
       echo "      Computing combos: "${varcombo}
-      varcos=`echo ${varcombo} | tr ':' ' '`
-      for vco in ${varcos}; do
-        echo "        "${vco}
-        CFvarn=`echo ${vco} | tr ';' ' ' | awk '{print $1}'`
-        cvar=`variable_compute ${iwdir} ${CFvarn} ${testfiles} | grep varcomp |      \
-          awk '{print $2}'`
-        CFv=`echo ${cvar} | tr '|' ' ' | awk '{print $1}'`
-        vark=`echo ${cvar} | tr '|' ' ' | awk '{print $2}'`
-        fileh=`echo ${cvar} | tr '|' ' ' | awk '{print $3}'`
-        modv=`echo ${cvar} | tr '|' ' ' | awk '{print $4}'`
-        diagv=`echo ${cvar} | tr '|' ' ' | awk '{print $5}'`
-
-#        if $(index_string ${vark} 'pinterp') -ne -1; then
-#          fhead=${fileh}'p'
-#        else
-#          fhead=${fileh}
-#        fi
-        combs=`echo ${vco} | tr ';' ' ' | awk '{print $2}' | tr '@' ' '`
-        ifile=${CFv}_${fhead}
-        for comb in ${combs}; do
-          combcvar=${CFv}'|'${comb}'|'${fhead}'|'${modv}'|'${diagv}
-          compute_statistics ${iwdir} ${ifile}.nc ${owdir} ${combcvar} ${moddims}    \
-            ${modvdims} ${filescratch} ${ifile}.nc
-          ifile=${ifile}_${comb}
-
-          # Adding 'surnames' to the variable's name
-          if test ${comb} = 'turb'; then
-            CFv=${CFv}'turb'
-          fi
-          if $(isInlist ${varmeanname} ${comb}); then
-            CFv=${CFv}'mean'
-          fi
-
-          isc=`expr ${isc} + 1`
-        # End of combo 
-        done
-      # End of combo variables
-      done
+      compute_combos ${iwdir} ${owdir} ${files} ${testfiles} ${moddims} ${modvdims}  \
+        ${varcombo} ${filescratch}
     fi
+
+    exit
 
     echo "  "${main}": "${ic}" variables has been computed"
