Index: trunk/tools/nc_var_tools.py
===================================================================
--- trunk/tools/nc_var_tools.py	(revision 422)
+++ trunk/tools/nc_var_tools.py	(revision 429)
@@ -10847,4 +10847,30 @@
     return dist
 
+def lonlat2D(lon,lat):
+    """ Function to return lon, lat 2D matrices from any lon,lat matrix
+      lon= matrix with longitude values
+      lat= matrix with latitude values
+    """
+    fname = 'lonlat2D'
+
+    if len(lon.shape) != len(lat.shape):
+        print errormsg
+        print '  ' + fname + ': longitude values with shape:', lon.shape,            \
+          'is different that latitude values with shape:', lat.shape, '(dif. size) !!'
+        quit(-1)
+
+    if len(lon.shape) == 3:
+        lonvv = lon[0,:,:]
+        latvv = lat[0,:,:]
+    elif len(lon.shape) == 2:
+        lonvv = lon[:]
+        latvv = lat[:]
+    elif len(lon.shape) == 1:
+        lonlatv = np.meshgrid(lon[:],lat[:])
+        lonvv = lonlatv[0]
+        latvv = lonlatv[1]
+
+    return lonvv, latvv
+
 def compute_tevolboxtraj(values, ncfile, varn):
     """ Function to compute tevolboxtraj: temporal evolution at a given point along 
@@ -10878,5 +10904,4 @@
     check_arguments(fname,len(arguments.split(',')),arguments,',',8)
 
-
     trajfile = values.split(',')[0].split('@')[0]
     Tbeg = int(values.split(',')[0].split('@')[1])
@@ -10931,10 +10956,5 @@
             varns = [varn]
 
-    if len(lonobj.shape) == 3:
-        lonv = lonobj[0,:,:]
-        latv = latobj[0,:,:]
-    elif len(lonobj.shape) == 2:
-        lonv = lonobj[:]
-        latv = latobj[:]
+    lonv, latv = lonlat2D(lonobj[:],latobj[:])
 
     dimx = lonv.shape[1]
@@ -10942,5 +10962,4 @@
 
     timv = timobj[:]
-
 
 # Selecting accordingly a trajectory
@@ -11133,8 +11152,14 @@
     newdim = objofile.createDimension('time', None)
 
-    statnames = ['minbox', 'maxbox', 'meanbox', 'mean2box', 'stdevbox']
+    stsn = ['min', 'max', 'mean', 'mean2', 'stdev', 'ac']
     vstlname = ['minimum value within', 'maximum value within', 'mean value within', \
-      'squared mean value within', 'standard deviation value within']
-    cstatnames = ['mincircle','maxcircle','meancircle','mean2circle','stdevcircle']
+      'squared mean value within', 'standard deviation value within',                \
+      'accumulated value within']
+    Nsts = len(stsn)
+    statnames = []
+    cstatnames = []
+    for i in range(Nsts):
+        statnames.append(stsn[i] + 'box')
+        cstatnames.append(stsn[i] + 'circle')
 
 # Getting values
@@ -11200,6 +11225,6 @@
             rlatvals = np.ones(tuple([Ttraj,dimz,Nrad*2+1,Nrad*2+1]), dtype=np.float)
 
-            statvarvals = np.ones(tuple([Ttraj,dimz,6]), dtype=np.float)
-            rstatvarvals = np.ones(tuple([Ttraj,dimz,6]), dtype=np.float)
+            statvarvals = np.ones(tuple([Ttraj,dimz,Nsts]), dtype=np.float)
+            rstatvarvals = np.ones(tuple([Ttraj,dimz,Nsts]), dtype=np.float)
 
             for it in range(Ttraj):
@@ -11248,4 +11273,6 @@
                         statvarvals[it,iz,5] = np.sqrt(statvarvals[it,iz,4] -        \
                           statvarvals[it,iz,3]*statvarvals[it,iz,3])
+                        statvarvals[it,iz,6] = np.sum(varvalst[iz,:,:])
+
                 else:
                     slicev.append(slice(0,dimz))
@@ -11280,4 +11307,5 @@
                         statvarvals[it,iz,5] = np.sqrt(statvarvals[it,iz,4] -        \
                           statvarvals[it,iz,3]*statvarvals[it,iz,3])
+                        statvarvals[it,iz,6] = np.sum(varvalst[iz,:,:])
 
 # Circle values
@@ -11324,4 +11352,5 @@
                         rstatvarvals[it,iz,5] = np.sqrt(rstatvarvals[it,iz,4] -      \
                           rstatvarvals[it,iz,3]*rstatvarvals[it,iz,3])
+                        rstatvarvals[it,iz,6] = np.sum(varvalst[iz,:,:])
 
                 else:
@@ -11364,4 +11393,5 @@
                         rstatvarvals[it,iz,5] = np.sqrt(rstatvarvals[it,iz,4] -      \
                           rstatvarvals[it,iz,3]*rstatvarvals[it,iz,3])
+                        rstatvarvals[it,iz,6] = maskedvals[iz,:,:].sum()
 
 #            print 'statistics:',rstatvarvals[it,:] 
@@ -11447,6 +11477,6 @@
             rlatvals = np.ones(tuple([Ttraj,Nrad*2+1,Nrad*2+1]), dtype=np.float)
 
-            statvarvals = np.ones(tuple([Ttraj,6]), dtype=np.float)
-            rstatvarvals = np.ones(tuple([Ttraj,6]), dtype=np.float)
+            statvarvals = np.ones(tuple([Ttraj,Nsts]), dtype=np.float)
+            rstatvarvals = np.ones(tuple([Ttraj,Nsts]), dtype=np.float)
 
             for it in range(Ttraj):
@@ -11489,4 +11519,5 @@
                     statvarvals[it,5] = np.sqrt(statvarvals[it,4] -                   \
                       statvarvals[it,3]*statvarvals[it,3])
+                    statvarvals[it,6] = maskedvals.sum()
 
                     varvalst[tuple(slice2D)] = lonv[tuple(slicevnoT)]
@@ -11523,4 +11554,5 @@
                     statvarvals[it,5] = np.sqrt(statvarvals[it,4] -                  \
                       statvarvals[it,3]*statvarvals[it,3])
+                    statvarvals[it,6] = np.sum(varvalst)
 
                     varvalst = lonv[tuple(slicevnoT)]
@@ -11561,4 +11593,5 @@
                     rstatvarvals[it,5] = np.sqrt(rstatvarvals[it,4] -                \
                       rstatvarvals[it,3]*rstatvarvals[it,3])
+                    rstatvarvals[it,6] = maskedvals2.sum()
 
                 else:
@@ -11593,4 +11626,5 @@
                     rstatvarvals[it,5] = np.sqrt(rstatvarvals[it,4] -                \
                       rstatvarvals[it,3]*rstatvarvals[it,3])
+                    rstatvarvals[it,6] = maskedvals.sum()
 
 #            print 'statistics:',rstatvarvals[it,:] 
