Index: /trunk/tools/model_graphics.py
===================================================================
--- /trunk/tools/model_graphics.py	(revision 1362)
+++ /trunk/tools/model_graphics.py	(revision 1363)
@@ -1142,4 +1142,36 @@
             wrongstats.append(CFvarn + '_' + opers)
             break
+
+        elif op[0:11] == 'dimvarvalue':
+            # Slicing along the index at the nearest given value of a dimension-variable
+            dimvarn = op.split('~')[1]
+            dimvalue = op.split('~')[2]
+            vals = dimvarn + ',' + dimvalue + ',' + dimvalue + ',0'
+            if dofile:
+                try:
+                    with gen.Capturing() as output:
+                        ncvar.DataSetSection_multivars(vals,prevfile,CFvarnp)
+                except:
+                    print errmsg
+                    print 'DataSetSection_multivars('+vals+',', prevfile, ',' +      \
+                      CFvarnp + ')'
+                    for s1out in output: print s1out
+                    quit(-1)
+
+                if db:
+                    for s1out in output: print s1out
+
+                sout = sub.call('mv DataSetSection_multivars.nc '+fileon, shell=True)
+
+                # Keeping the operations
+                pyins=pyH + "/nc_var.py -o DataSetSection_multivars -S '" + vals +   \
+                  "' -f " + prevfile + " -v " + CFvarnp
+                otrackf.write("\n")
+                otrackf.write("# " + CFvarnp + " " + Fopers + "\n")
+                otrackf.write(pyins + "\n")
+
+            # removing the given variable-dimension
+            varnCFs.remove(dimvarn)
+
         elif op == 'direct':
             # no statistics
@@ -2334,4 +2366,29 @@
     return
 
+def opexplained(Opn,Exp):
+    """ Function to provide the final explanation for the title in the graph. Some operations have 
+      values separated by `~' which need to be processed
+      Opn= full operation string
+      Exp= explanation from dictionary
+    >>> opexplained('dimvarvalue~pres~85000','@')
+    pres@85000
+    >>> opexplained('xmean','xmean')
+    xmean
+    """
+    fname = 'opexplained'
+
+    if Opn.find('~') == -1:
+        explanation = Exp
+    else:
+        Opnv = Opn.split('~')
+        if Opnv[0] == 'dimvarvalue':
+            explanation =  Opnv[1] + Exp + Opnv[2]
+        else:
+            print errormsg
+            print '  ' + fname + ": unknow '~' separated operation '" + Opnv[0] +    \
+              "' !!"
+            quit(-1)
+    return explanation
+
 def optitle(op,opexp):
     """ Function to creat the operation section in the title of a figure ('!' for spaces)
@@ -2340,4 +2397,6 @@
     >>> optitle('pinterp+xmean+tmean',{'pinterp':'pinterp', 'xmean':'xmean', 'tmean':'tmean'})
     $_{[pinterp\!xmean\!tmean]}$
+    >>> optitle('pinterp+dimvarvalue~pres~85000+tmean',{'dimvarvalue':'@', 'pinterp':'pinterp', 'xmean':'xmean', 'tmean':'tmean'})
+    $_{[pinterp\!pres@85000\!tmean]}$
     """
     fname = 'optitle'
@@ -2345,16 +2404,20 @@
     opvals = op.split('+')
     for op1 in opvals:
-        if not opexp.has_key(op1):
+        op1n = op1.split('~')[0]
+        if not opexp.has_key(op1n):
             print errmsg
-            print '  '+fname+": no explanation for operation '"+op1+"' !!"
+            print '  ' + fname + ": no explanation for operation '" + op1n + "' !!"
             print '    provided:', opexp.keys()
             quit(-1)
-        if op1 == opvals[0]:
-            titop = '$_{[' + opexp[op1].replace(' ','!')
+        # Final explanation
+        op1en = opexplained(op1,opexp[op1n]).replace(' ','!')
+
+        if op1n == opvals[0].split('~')[0]:
+            titop = '$_{[' + op1en
             if len(opvals) == 1: titop = titop + ']}$'
-        elif op1 == opvals[len(opvals)-1]:
-            titop = titop + '\!' + opexp[op1].replace(' ','!') + ']}$'
+        elif op1n == opvals[len(opvals)-1].split('~')[0]:
+            titop = titop + '\!' + op1en + ']}$'
         else:
-            titop = titop + '\!' + opexp[op1].replace(' ','!')
+            titop = titop + '\!' + op1en
 
     return titop
@@ -2373,4 +2436,8 @@
     >>> create_figure_title('WRF','current',['ua|pinterp+xmean+tmean', 'va|pinterp+xmean+last'], expops)
     WRF!current!ua$_{[pinterp\!xmean\!tmean]}$!&!va$_{[pinterp\!xmean\!last]}$
+    >>> create_figure_title('WRF','current',['uas|dimvarvalue~lon~23.23', 'vas|dimvarvalue~lon~23.23'], expops)
+    WRF!current!uas!&!vas$_{[lon@23.23]}$
+    >>> create_figure_title('WRF','current',['hus|pinterp+tmean+dimvarvalue~pres~85000.', 'ta|pinterp+tmean+dimvarvalue~pres~85000.'], expops)
+    WRF!current!hus!&!ta$_{[pinterp\!tmean\!pres@85000.]}$
     """
     fname = 'create_figure_title'
@@ -2435,5 +2502,6 @@
                     titfig = titfig + ',!' + vnop
 
-    return titfig
+    return titfig.replace('!!','!')
+#expops = {'dimvarvalue':'@', 'last':'last', 'pinterp':'pinterp', 'xmean':'xmean', 'tmean':'tmean'}
 
 def draw_plots(config, plots, mod, exp, odir, allvarcomp, figscr, debug):
@@ -2619,4 +2687,7 @@
             # End of variable-operation
             figname = figname + '.' + kindfigure
+
+            # Removig double '..' (from `dimvarvalue')
+            figname = figname.replace('..', '.')
 
             # Title of figure
@@ -2978,4 +3049,5 @@
         acc: temporal accumulated values
         diff: differences between models
+        dimvarvalue~[dimvarn]~[value]: Slicing along the index at the nearest given value of a dimension-variable
         direct: no statistics
         last: last temporal value
@@ -3066,4 +3138,36 @@
             wrongstats.append(varn + '_' + opers)
             break
+
+        elif op[0:11] == 'dimvarvalue':
+            # Slicing along the index at the nearest given value of a dimension-variable
+            dimvarn = op.split('~')[1]
+            dimvalue = op.split('~')[2]
+            vals = dimvarn + ',' + dimvalue + ',' + dimvalue + ',0'
+            if dofile:
+                try:
+                    with gen.Capturing() as output:
+                        ncvar.DataSetSection_multivars(vals,prevfile,CFvarnp)
+                except:
+                    print errmsg
+                    print 'DataSetSection_multivars('+vals+',', prevfile, ',' +      \
+                      CFvarnp + ')'
+                    for s1out in output: print s1out
+                    quit(-1)
+
+                if db:
+                    for s1out in output: print s1out
+
+                sout = sub.call('mv DataSetSection_multivars.nc '+fileon, shell=True)
+
+                # Keeping the operations
+                pyins=pyH + "/nc_var.py -o DataSetSection_multivars -S '" + vals +   \
+                  "' -f " + prevfile + " -v " + CFvarnp
+                otrackf.write("\n")
+                otrackf.write("# " + CFvarnp + " " + Fopers + "\n")
+                otrackf.write(pyins + "\n")
+
+            # removing the given variable-dimension
+            varnCFs.remove(dimvarn)
+
         elif op == 'direct':
             # no statistics
@@ -4692,5 +4796,4 @@
             # op and var differences
             diffvarcompf = owdir + '/' + difffiles[0]
-            print 'Lluis HERE !2!1!: diffvarcompf:', diffvarcompf
             if not os.path.isfile(diffvarcompf):
                 alldiffop, alldiffvar,Nopdiffs,Nvardiffs=diffvarop_listconstruct(cnf,\
