Index: /trunk/tools/documentation/ncmanage/compute_opersvarsfiles.html
===================================================================
--- /trunk/tools/documentation/ncmanage/compute_opersvarsfiles.html	(revision 1534)
+++ /trunk/tools/documentation/ncmanage/compute_opersvarsfiles.html	(revision 1535)
@@ -30,4 +30,5 @@
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'add': adding [var] ([prevalues] + [var])<BR>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'addc',[modval1]: add [modval1] to [prevalues]<BR>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'arctan', arctangent [-p1, pi]<BR>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'centerderiv',[N],[ord],[dim]: un-scaled center [N]-derivative of order [ord] along dimension [dim] of [var]<BR>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'div': dividing by [var] ([prevalues] / [var])<BR>
@@ -39,4 +40,11 @@
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'mul': multiplying by [var] ([prevvalues] * [var])<BR>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'mulc',[modval1]: [prevalues] multiplied by [modval1]<BR>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'norm_meanminmax',[NOTnormdims]: normalization of data as: (val-<val>)/(max(val)-min(val)) except along <BR>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'norm_minmax',[NOTnormdims]: normalization of data as: [2val-(max(val)-min(val)]/[max(val)+min(val)]<BR>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'norm_meanstd',[NOTnormdims]: normalization of data as: (val-<val>)/stdev(val) except along <BR>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)<BR>
+       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;dimensions [NOTnormdims] (':' list of dimension names)<BR>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'pot': powering with [var] ([prevalues] ** [var])<BR>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'potc',[modval1]: [prevalues] ** [modval1]<BR>
@@ -60,6 +68,14 @@
     </DIV>
     <DIV CLASS="valins">
-      $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|Times|3@add|wrfout_d01_2001-11-11_00:00:00|T2%west_east|XLONG|-1;south_north|XLAT|-1;Time|Times|3@subc,273.15|wrfout_d01_2001-11-11_00:00:00|None' -v 'tempC,air!temperature,C'<BR>
-      $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'lon|lon|-1;lat|lat|-1;time_counter|time_counter|-1@forwrdderiv,1,1,2|/ccc/store/cont003/gen7593/fitaborl/etudes/DynamicoESM/aquaplanet/AR40/19800101000000-19810101000000/histday.nc|t2m' -v 'tasderiv,x-derivative|of|air|temperature,K
+    * Transforming temperature from Kelvin to &deg;C<BR>
+    &nbsp;&nbsp;  $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|Times|3@subc,273.15|wrfout_d01_2001-11-11_00:00:00|T2' -v 'tempC,air!temperature,C'<BR>
+    * Computing the x-derivative of first order<BR>
+    &nbsp;&nbsp;  $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'lon|lon|-1;lat|lat|-1;time_counter|time_counter|-1@forwrdderiv,1,1,2|histday.nc|t2m' -v 'tasderiv,x-derivative|of|air|temperature,K' <BR>
+    * Normalizing a variable by substracting its mean and weighting by its standard-deviation<BR>
+    &nbsp;&nbsp; $ python ${pyHOME}/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@norm_meanstd,Time|wrfout_d01_1995-01-01_00:00:00|T2' -v 'tasnorm,normalized!2m!temperature!substracting!mean!and!weighting!by!standard!deviation,K' <BR>
+    * Getting height of the frist level from surface from a WRF file<BR>
+    &nbsp;&nbsp; $ python $pyHOME/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;bottom_top_stag|ZNW|1@addc,0|wrfout_d01_1995-01-01_00:00:00|PH%west_east|XLONG|-1;south_north|XLAT|-1;bottom_top_stag|ZNW|1@add|wrfout_d01_1995-01-01_00:00:00|PHB%contoperation@divc,9.81%west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@sub|wrfout_d01_1995-01-01_00:00:00|HGT' -v 'height1lev,height!above!surface!of!first!level,m'
+    * Computing wind-direction from a WRF file<BR>
+    &nbsp;&nbsp; $ python $pyHOME/nc_var.py -o compute_opersvarsfiles -S 'west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@addc,0|wrfout_d01_1995-01-01_00:00:00|V10%west_east|XLONG|-1;south_north|XLAT|-1;Time|WRFtime|-1@arctan|wrfout_d01_1995-01-01_00:00:00|U10%contoperation@mulc,57.2957795131' -v 'wsdir,2m!wind!direction,Degrees'
     </DIV>
   </BODY>
Index: /trunk/tools/generic_tools.py
===================================================================
--- /trunk/tools/generic_tools.py	(revision 1534)
+++ /trunk/tools/generic_tools.py	(revision 1535)
@@ -10155,4 +10155,5 @@
         'add': adding matB to matA (matA + matB)
         'addc',[modval1]: add [modval1]
+        'arctan', arctangent of matA (result [-pi, pi])
         'centerderiv',[N],[ord],[dim]: un-scaled center [N]-derivative of order [ord] along dimension [dim] of matA
         'div': dividing by matB (matA / matB)
@@ -10164,4 +10165,12 @@
         'mul': multiplying ny matB (matA * matB)
         'mulc',[modval1]: multiply by [modval1]
+        'norm_meanminmax',[dimns],[normdimns],[idims]: normalization of data of dimensions [dimns] (':' list) as: 
+          (val - <val>)/(max(val)-min(val)) along dimension-names [normdimns] (':' list of names) and 
+          dimension-indices [idims] (':' list of indices) of matA
+        'norm_minmax',[NOTnormdims]: normalization of data as: [2val-(max(val)-min(val)]/[max(val)+min(val)]
+          except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)
+        'norm_meanstd',[dimns],[normdimns],[idims]: normalization of data of dimensions [dimns] (':' list) as: 
+          (val - <val>)/stdev(val) along dimension-names [normdimns] (':' list of names) and dimension-indices
+          [idims] (':' list of indices) of matA
         'pot': powering with matB (matA ** matB)
         'potc',[modval1]: [val] ** [modval1]
@@ -10294,7 +10303,9 @@
 
     # Dictionary with the description of the operations
-    Lopn = {'add': '+', 'addc': '+', 'div': '/', 'divc': '/', 'inv': '^(-1)',        \
-      'lowthres': '<', 'mul': '*', 'mulc': '*', 'pot': '^', 'potc': '^',             \
-      'repl': 'repl_excpt', 'replbig': 'repl_excpt_bigger',                          \
+    Lopn = {'add': '+', 'addc': '+', 'arctan': 'arctangent', 'div': '/', 'divc': '/',\
+      'inv': '^(-1)', 'lowthres': '<', 'mul': '*', 'mulc': '*',                      \
+      'norm_meanminmax': 'Norm_mean_minmax',                                         \
+      'norm_minmax': 'Norm_minmax', 'norm_meanstd': 'Norm_mean_devstd', 'pot': '^',  \
+      'potc': '^', 'repl': 'repl_excpt', 'replbig': 'repl_excpt_bigger',             \
       'repless': 'repl_excpt_less', 'sub': '-', 'subc': '-', 'upthres': '<'}
     # Operations by constant value
@@ -10304,7 +10315,9 @@
 
     # Available operations
-    opavail = ['add', 'addc', 'centerderiv', 'div', 'divc', 'forwrdderiv', 'inv',    \
-      'lowthres', 'lowthres@oper', 'mul', 'mulc', 'pot', 'potc', 'repl', 'replbig',  \
-      'repless', 'sub', 'subc', 'upthres', 'upthres@oper']
+    opavail = ['add', 'addc', 'arctan', 'centerderiv', 'div', 'divc', 'forwrdderiv', \
+      'inv',    \
+      'lowthres', 'lowthres@oper', 'mul', 'mulc', 'norm_meanminmax', 'norm_minmax',  \
+      'norm_meanstd', 'pot', 'potc', 'repl', 'replbig', 'repless', 'sub', 'subc',    \
+      'upthres', 'upthres@oper']
     opavailc = ['addc', 'divc', 'inv', 'mulc', 'potc', 'subc']
 
@@ -10315,4 +10328,7 @@
         value1 = retype(opN.split(',')[1], valtype)
         Lopn['addc'] = '+' + str(value1)
+    elif opN[0:6] == 'arctan':
+        opn = 'arctan'
+        Lopn['arctan'] = 'arctan'
     elif opN[0:11] == 'centerderiv':
         opn = 'centerderiv'
@@ -10390,4 +10406,25 @@
         value1 = retype(opN.split(',')[1], valtype)
         Lopn['mulc'] = '*' + str(value1)         
+    elif opN[0:15] == 'norm_meanminmax':
+        opn = 'norm_meanminmax'
+        dimns = opN.split(',')[1].split(':')
+        normdimns = opN.split(',')[2].split(':')
+        idimsS = opN.split(',')[3].split(':')
+        idims = tuple(np.array(idimsS, dtype=int))
+        Lopn['norm_meanminmax'] = 'Norm_mean_minmax(' + ','.join(normdimns) + ')'
+    elif opN[0:11] == 'norm_minmax':
+        opn = 'norm_minmax'
+        dimns = opN.split(',')[1].split(':')
+        normdimns = opN.split(',')[2].split(':')
+        idimsS = opN.split(',')[3].split(':')
+        idims = tuple(np.array(idimsS, dtype=int))
+        Lopn['norm_minmax'] = 'Norm_minmax(' + ','.join(normdimns) + ')'
+    elif opN[0:12] == 'norm_meanstd':
+        opn = 'norm_meanstd'
+        dimns = opN.split(',')[1].split(':')
+        normdimns = opN.split(',')[2].split(':')
+        idimsS = opN.split(',')[3].split(':')
+        idims = tuple(np.array(idimsS, dtype=int))
+        Lopn['norm_meanstd'] = 'Norm_mean_std(' + ','.join(normdimns) + ')'
     elif opN[0:4] == 'potc':
         opn = 'potc'
@@ -10431,8 +10468,11 @@
    
     # Carrying on the operation
+    additional = None
     if opn == 'add':
         newmat = matA + matB
     elif opn == 'addc':
         newmat = matA + value1
+    elif opn == 'arctan':
+        newmat = np.arctan2(matA,matB)
     elif opn == 'centerderiv':
         sdim = matAshape[dim]
@@ -10602,4 +10642,49 @@
     elif opn == 'mulc':
         newmat = matA * value1
+    elif opn == 'norm_meanminmax':
+        newmat = np.zeros((matA.shape), dtype=matA.dtype)
+        meanval = np.mean(matA, axis=idims)
+        minval = np.min(matA, axis=idims)
+        maxval = np.max(matA, axis=idims)
+        slices = provide_slices(dimns, matA.shape, normdimns)
+        Nslices = len(slices)
+        for islc in range(Nslices):
+            listv = list(slices[islc])
+            for iind in range(len(idims)):
+                indv = idims[iind] - iind
+                listv.pop(indv)
+            newmat[tuple(slices[islc])] = (matA[tuple(slices[islc])] -               \
+              meanval[tuple(listv)]) / (maxval[tuple(listv)]-minval[tuple(listv)])
+        additional = [meanval, minval, maxval]
+
+    elif opn == 'norm_minmax':
+        newmat = np.zeros((matA.shape), dtype=matA.dtype)
+        minval = np.min(matA, axis=idims)
+        maxval = np.max(matA, axis=idims)
+        slices = provide_slices(dimns, matA.shape, normdimns)
+        Nslices = len(slices)
+        for islc in range(Nslices):
+            listv = list(slices[islc])
+            for iind in range(len(idims)):
+                indv = idims[iind] - iind
+                listv.pop(indv)
+            xnadd = maxval[tuple(listv)]+minval[tuple(listv)]
+            xnsub = maxval[tuple(listv)]-minval[tuple(listv)]
+            newmat[tuple(slices[islc])] = (2.*matA[tuple(slices[islc])]-xnadd)/xnsub
+        additional = [minval, maxval]
+    elif opn == 'norm_meanstd':
+        newmat = np.zeros((matA.shape), dtype=matA.dtype)
+        meanval = np.mean(matA, axis=idims)
+        stdval = np.std(matA, axis=idims)
+        slices = provide_slices(dimns, matA.shape, normdimns)
+        Nslices = len(slices)
+        for islc in range(Nslices):
+            listv = list(slices[islc])
+            for iind in range(len(idims)):
+                indv = idims[iind] - iind
+                listv.pop(indv)
+            newmat[tuple(slices[islc])] = (matA[tuple(slices[islc])] -               \
+              meanval[tuple(listv)]) / stdval[tuple(listv)]
+        additional = [meanval, stdval]
     elif opn == 'pot':
         newmat = matA ** matB
@@ -10641,5 +10726,5 @@
         quit(-1)
 
-    return newmat, Lopn[opn]
+    return newmat, Lopn[opn], additional
 
 def latex_fig_array(figs, obf, figcaption, figlabel, dist='sqr', refsize=0.9,        \
Index: /trunk/tools/nc_var_tools.py
===================================================================
--- /trunk/tools/nc_var_tools.py	(revision 1534)
+++ /trunk/tools/nc_var_tools.py	(revision 1535)
@@ -7178,6 +7178,6 @@
       (OPER1.FILE1_VAR1 OPER2.FILE2_VAR2), operations are going to be sequentially made
       compute_opersvarsfiles(values, varinfo). 
-        NOTE: Values from the first file (with always operation 'add')
         [prevalues]: values from the previous operations
+        NOTE: to start with a multiple operations one can use as operation of the first variable 'addc,0'
         values= '%' separated list of dimension ranges and file,operation,variable to compute
           [dimranges1]@[operfile1var]%[dimranges2]@[operfile2var]%[...[dimrangesM]@[operfileMvar]]
@@ -7189,8 +7189,11 @@
                       int, a single value
             [beg,end,frq], from a beginning to an end with a given frequency
+             'WRFtime': as time variable computed from WRF 'Times' variable
           operfilevar: [oper]|[file]|[var] '|' separated list of triplets of [operation], [file], [variable name to use]
+          NOTE: use 'contoperation' to continue an operation with the result of previous operations [prevalues]
            * [oper]: operations (being [prevalues] the values computed until the operation)
              'add': adding [var] ([prevalues] + [var])
              'addc',[modval1]: add [modval1] to [prevalues]
+             'arctan', arctangent [-pi, pi]
              'centerderiv',[N],[ord],[dim]: un-scaled center [N]-derivative of order [ord] along dimension [dim] of [var]
              'div': dividing by [var] ([prevalues] / [var])
@@ -7202,4 +7205,10 @@
              'mul': multiplying by [var] ([prevvalues] * [var])
              'mulc',[modval1]: [prevalues] multiplied by [modval1]
+             'norm_meanminmax',[NOTnormdims]: normalization of data as: (val-<val>)/(max(val)-min(val)) except along 
+               dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)
+             'norm_minmax',[NOTnormdims]: normalization of data as: [2val-(max(val)-min(val)]/[max(val)+min(val)]
+               except along dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)
+             'norm_meanstd',[NOTnormdims]: normalization of data as: (val-<val>)/stdev(val) except along 
+               dimensions [NOTnormdims] (':' list of dimension names, or 'any' for using all dimensions)
              'pot': powering with [var] ([prevalues] ** [var])
              'potc',[modval1]: [prevalues] ** [modval1]
@@ -7218,5 +7227,5 @@
               'lowthres@oper', 'mulc', 'potc', 'subc', 'upthres', 'upthres@oper'
         varinfo= [varname],[Lvarname],[varunits]
-          varname: name of the final variable 
+          varname: name of the final variable (to be used as standard name)
           Lvarname: long name of the final variable ('!' for spaces)
           varunits: units of the final variable ('!' for spaces)
@@ -7234,4 +7243,6 @@
     # List of operations which need to be started with a matrix of ones
     opinione = ['mul', 'div', 'pot']
+    # Operations which need to deal with dimension's names and indices
+    opdim=['norm_meanminmax', 'norm_meanstd', 'norm_minmax']
 
     varname = varinfo.split(',')[0]
@@ -7250,14 +7261,28 @@
     varns = []
     for fileoper in fileopers:
-        ranges.append(fileoper.split('@')[0])
+        print 'fileoper', fileoper
+        arguments = '[dimranges]@[operfilevar]'
+        gen.check_arguments(fname, fileoper, arguments, '@')
         fnop = fileoper.split('@')[1]
-        opers.append(fnop.split('|')[0])
-        filens.append(fnop.split('|')[1])
-        varns.append(fnop.split('|')[2])
+        if fileoper.split('@')[0] != 'contoperation':
+            ranges.append(fileoper.split('@')[0])
+            arguments = '[oper]|[file]|[var]'
+            gen.check_arguments(fname, fnop, arguments, '|')
+            opers.append(fnop.split('|')[0])
+            filens.append(fnop.split('|')[1])
+            varns.append(fnop.split('|')[2])
+        else:
+            ranges.append('continuation')
+            opers.append(fnop)
+            filens.append('continuation')
+            varns.append('continuation')
 
     print '  ' + fname + 'Files/Operations to perform _______'
     for ifop in range(Nfileopers):
-        print '    ' + filens[ifop] + ' range: ' + ranges[ifop] + ' operation: ' +   \
-          opers[ifop] + ' variable: ' + varns[ifop]
+        if filens[ifop] != 'continuation':
+            print '    ' + filens[ifop] + ' range: ' + ranges[ifop] + ' operation: '+\
+              opers[ifop] + ' variable: ' + varns[ifop]
+        else:
+            print '    continuing computation by: ' + opers[ifop]
 
     newunits = '-'
@@ -7273,30 +7298,39 @@
     # Dictionary with the attributes dictionay of the dimension-variables of the dimensions of `prevalues'
     Dadv = {}
+    # Dictionary with the additional values for certain operations of `prevalues'
+    Dadditionalv = {}
+    # Dictionary with the additional dimensions which are not used for certain operations of `prevalues'
+    Dadditionaldim = {}
+    # Dictionary with the additional units used for certain operations of `prevalues'
+    Dadditionalunits = {}
+    # Dictionary with the Headers for the names of the additional variables
+    DHadditionalvars = {'norm_meanminmax': ['mean','min','max'],                     \
+      'norm_meanstd': ['mean','std'], 'norm_minmax': ['min','max']}
 
     prevalues = None
     for ifv in range(Nfileopers):
-        opern = opers[ifv]
+        operN = opers[ifv]
         filen = filens[ifv]
         varn = varns[ifv]
         rng = ranges[ifv].split(';')
-        if opern.find(',') != -1:
-            opernS = opern.split(',')[0]
+        if operN.find(',') != -1:
+            opernS = operN.split(',')[0]
         else:
-            opernS = opern
+            opernS = operN
 
         opervars.append(varn)
 
-        if not os.path.isfile(filen):
-            print errormsg
-            print '  ' + fname + ' file: "' + filen + '" does not exist !!'
-            quit(-1)
-
-        objnc = NetCDFFile(filen, 'r')
-
-        # Operation with a variable
-        if varn != 'None' or prevalues is None:
-            if not objnc.variables.has_key(varn):
+        if filen != 'continuation':
+            if not os.path.isfile(filen):
                 print errormsg
-                print '  ' + fname + ': netCDF file "' + filen +                     \
+                print '  ' + fname + ' file: "' + filen + '" does not exist !!'
+                quit(-1)
+
+            objnc = NetCDFFile(filen, 'r')
+
+            # Operation with a variable
+            if varn != 'WRFtime' and not objnc.variables.has_key(varn):
+                print errormsg
+                print '  ' + fname + ': netCDF file "' + filen +                 \
                   '" does not have variable "' + varn + '" !!!!'
                 quit(-1)
@@ -7317,13 +7351,15 @@
                 # Dimension-variable
                 if not objnc.variables.has_key(dimv):
-                    print warnmsg
-                    print '  ' + fname + ": file '" + filen + "' does not have " +   \
-                      "dimension-variable '" + dimv + "' !!"
-                    print '    keep going on'
-                    #quit(-1)
+                    if dimv == 'WRFtime':
+                        Ddimvs.append([dimn, 'WRFtime', dimr])
+                    else:
+                        print warnmsg
+                        print '  ' +fname+ ": file '" + filen + "' does not have " + \
+                          "dimension-variable '" + dimv + "' !!"
+                        print '    keep going on'
+                        #quit(-1)
                 else:
                     # Keeping the dimensions
                     Ddimvs.append([dimn, dimv, dimr])
-
             # Getting values of the variable
             varslice, dimvarvals = SliceVarDict(varobj, dictslice)
@@ -7332,13 +7368,14 @@
             varvals = slice_createArray(varslice, varobj.dtype)
             if len(varvals.shape) > 1:
-                if varvals.shape[0] != 0:
-                    for ix in range(varvals.shape[0]):
-                        varvals[ix,...] = varobj[ix,...]
-                else:
-                    for ix in range(varvals.shape[len(varvals.shape)-1]):
-                        varvals[...,ix] = varobj[...,ix]
+#               if varvals.shape[0] != 0:
+#                   for ix in range(varvals.shape[0]):
+#                       varvals[ix,...] = varobj[tuple(varslice[ix,...])]
+#               else:
+#                   for ix in range(varvals.shape[len(varvals.shape)-1]):
+#                       varvals[...,ix] = varobj[tuple(varslice[...,ix])]
+                varvals[:] = varobj[tuple(varslice)]
             else:
                 varvals[:] = varobj[:]
-
+            
             # Getting values of the correspondant dimensions of the variable
             for iddd in range(len(Ddimvs)):
@@ -7347,5 +7384,5 @@
                 dimv = DD[1]
                 dimr = DD[2]
-                if dimv != 'WRFt':
+                if dimv != 'WRFtime':
                     odimv = objnc.variables[dimv]
                     varslice, Dddv[dimn] = SliceVarDict(odimv, dictslice)
@@ -7358,4 +7395,6 @@
                     Dadv[dimn] = dicattrs
                 else:
+                    print infmsg
+                    print '  ' + fname + ": computing time-variable from 'WRF'-Time"
                     datesv = []
                     wrft = objnc.variables['Times']
@@ -7370,17 +7409,17 @@
                     minref=refdate[10:12]
                     secref=refdate[12:14]
-
+    
                     refdateS = yrref + '-' + monref + '-' + dayref + ' ' + horref +  \
                       ':' + minref + ':' + secref
-
+    
                     dt = fdates.shape[0]
                     cftimes = np.zeros((dt), dtype=np.float)
                     for it in range(dt):
-                        wrfdates = gen.datetimeStr_conversion(timewrfv[it,:],        \
-                          'WRFdatetime', 'matYmdHMS')
+                        wrfdates = gen.datetimeStr_conversion(wrft[it,:],            \
+                         'WRFdatetime', 'matYmdHMS')
                         cftimes[it] = gen.realdatetime1_CFcompilant(wrfdates,        \
                           refdate, tunitsval)
                     tunits = tunitsval + ' since ' + refdateS
-                    Dddv[dimn] = 'Time'
+                    Dddv[dimn] = ['Time']
                     Ddv[dimn] = cftimes
                     Dtdv[dimn] = np.float
@@ -7388,35 +7427,86 @@
                       'units': tunitsval + ' since ' + refdateS}
 
-            # Getting sizes of the dimensions
-            for dvn in dimvarvals:
-                dimobj = objnc.dimensions[dvn]
-                if dimobj.isunlimited():
-                    Dds[dvn] = None
-                else:
-                    Dds[dvn] = len(dimobj)
-
-            # operation
-            if prevalues is None:
-                # Creation of an empty variable to start with
-                if gen.searchInlist(opinizero,opernS):
-                    inimat = np.zeros(varvals.shape, dtype=varobj.dtype)
-                elif gen.searchInlist(opinione,opernS):
-                    inimat = np.ones(varvals.shape, dtype=varobj.dtype)
-
-                prevalues, operS = gen.matoperations(opern, varvals, inimat)
+                # Getting sizes of the dimensions
+                for dvn in dimvarvals:
+                    dimobj = objnc.dimensions[dvn]
+                    if dimobj.isunlimited():
+                        Dds[dvn] = None
+                    else:
+                        Dds[dvn] = len(dimobj)
+            # Checking right slice for each dimension in variable
+            for dimn in dimvarvals:
+                found = False
+                if not gen.searchInlist(Dddv.keys(), dimn):
+                    print errormsg
+                    print '  ' + fname + ": sliced variable has dimension '" + dimn+ \
+                      "' but there is no slicing-dimension information"
+                    print "    add range for the dimension as '[dim]|[dimv]|[range]'" 
+                    quit(-1)
+
+        else:
+        # Computing using results of previous computations
+            varvals = prevalues.copy()
+            dimvarvals = prevdims
+            print infmsg
+            print '  ' + fname + ': continuing operation with previous values'
+            print '    shape:', varvals.shape
+            print '    dimensions:', dimvarvals
+
+        # Conditions for certain operations
+        if gen.searchInlist(opdim, opernS):
+            opn = operN.split(',')[0]
+            normd = gen.str_list(operN.split(',')[1], ':')
+            usedims = list(dimvarvals)
+            if normd[0] != 'any':
+                normi = []
+                for dn in normd:
+                    normi.append(dimvarvals.index(dn))
+                    usedims.remove(dn)
+                normi.sort()
             else:
-                print ' ' + fname + ': Lluis opern:', opern
-                prevalues, operS = gen.matoperations(opern, prevalues, varvals)
-            operS = ' ' + operS + '[' + varn + ']'
+                normi = range(len(varvals.shape))
+                usedims = 'any'
+            for iv in range(len(normi)): normi[iv] = str(normi[iv])
+            opern = opernS + ',' + ':'.join(dimvarvals) + ',' +                  \
+              operN.split(',')[1] + ',' + ':'.join(normi)
+            Dadditionaldim[opernS+'@'+varn] = usedims
+            if varn != 'continuation':
+                Dadditionalunits[opernS+'@'+varn] = get_varunits(varobj)
+            else:
+                Dadditionalunits[opernS+'@'+varn] = '?'
         else:
-            prevalues, operS = gen.matoperations(opern, prevalues)
-            operS = ' ' + operS
-
-        if opern == opers[0]:
+            opern = operN
+
+        if varn != 'continuation':
+            objnc.close()
+
+        # operation
+        if prevalues is None:
+            # Creation of an empty variable to start with
+            if gen.searchInlist(opinizero,opernS):
+                inimat = np.zeros(varvals.shape, dtype=varobj.dtype)
+            elif gen.searchInlist(opinione,opernS):
+                inimat = np.ones(varvals.shape, dtype=varobj.dtype)
+            else:
+                inimat = varvals
+
+            prevalues, operS, addvs = gen.matoperations(opern, varvals, inimat)
+        else:
+            prevalues, operS, addvs = gen.matoperations(opern, prevalues, varvals)
+        operS = ' ' + operS + '[' + varn + ']'
+
+#        elif varn == 'None' and prevalues is not None:
+#            prevalues, operS, addvs = gen.matoperations(opern, prevalues)
+#            operS = ' ' + operS
+
+        if operN == opers[0]:
             operationS = operS 
         else:
             operationS = operationS + operS
 
-        objnc.close()
+        Dadditionalv[opernS+'@'+varn] = addvs
+
+        prevdims = list(dimvarvals)
+        prevsizedims = varvals.shape
 
 # Creation of the new file
@@ -7451,4 +7541,42 @@
 
     newattr = basicvardef(newvar, varname, Lvarname, varunits)
+
+    # Additional variables. Each necessary dimension to fill up the information will be created as:
+    #   dimension name: dim + '_' + operS + '_' + var
+    #   dimension size: value from the shape of the additional values
+
+    for operSvarn in Dadditionalv.keys():
+        addvs = Dadditionalv[operSvarn]
+        if addvs is not None:
+            operS = operSvarn.split('@')[0]
+            vnS = operSvarn.split('@')[1]
+            addopdims = Dadditionaldim[operSvarn]
+            addunits = Dadditionalunits[operSvarn]
+            Hvarns = DHadditionalvars[operS]
+            iHv = 0
+            if type(addopdims) == type('S') and addopdims == 'any':
+                for Hvarn in Hvarns:
+                    newvn = Hvarn + '_' + operS + '_' + vnS
+                    newvar = objofile.createVariable(newvn, 'f4')
+                    newvar[:] = addvs[iHv]
+                    Lattr = Hvarn + ' value for operation ' + operS + ' with variable ' + vnS
+                    basicvardef(newvar, newvn, Lattr, addunits)
+                    iHv = iHv + 1
+            else:
+                idim = 0
+                newvdims = []
+                for dimn in addopdims:
+                    newdimn = dimn + '_' + operS + '_' + vnS
+                    dsize = addvs[0].shape[idim]
+                    newdim = objofile.createDimension(newdimn,dsize)
+                    newvdims.append(newdimn)
+
+                for Hvarn in Hvarns:
+                    newvn = Hvarn + '_' + operS + '_' + vnS
+                    newvar = objofile.createVariable(newvn, 'f4', tuple(newvdims))
+                    newvar[:] = addvs[iHv]
+                    Lattr = Hvarn + ' value for operation ' + operS + ' with variable ' + vnS
+                    basicvardef(newvar, newvn, Lattr, addunits)
+                    iHv = iHv + 1
 
 # Global attributes
