Index: /trunk/tools/nc_var_tools.py
===================================================================
--- /trunk/tools/nc_var_tools.py	(revision 598)
+++ /trunk/tools/nc_var_tools.py	(revision 599)
@@ -11049,5 +11049,5 @@
           'wrf': WRF kind
         [boxsize]: size in grid points of the box (square centered, better even number!)
-        [circler]: radius in grid points of a centerd circle
+        [circler]: radius in grid points of a centerd circle (as 2*circler+1)
       ncfile= netCDF file to use
       varn= ',' list of variables' name ('all', for all variables)
@@ -11131,9 +11131,9 @@
     Ttraj = file_nlines(trajfile,'#')
     if timekind == 'wrf':
-        dimt = objfile.variables[timn].shape[0] 
+        dimt = objfile.variables[timn].shape[0]
     else:
-        dimt = objfile.variables[timn].shape
-
-    if Tbeg + Ttraj > dimt:
+        dimt = objfile.variables[timn].shape[0]
+
+    if Tbeg + Ttraj > dimt - 1:
         print errormsg
         print '  ' + fname + ': trajectory has ', Ttraj, ' time steps and starts ' + \
@@ -11141,5 +11141,5 @@
         quit(-1)
 
-    print '    ' + fname + ': Number of time-steps in trajectory file: ',Ttraj
+    print '    ' + fname + ': Number of time-steps in trajectory file: ',Ttraj, 'dimt',dimt
 
     trajobj = open(trajfile,'r')
@@ -11179,5 +11179,5 @@
 # Slicing brings to reduce 1 time-step.... ???
         if line[0:1] != '#':
-            gtrajvals[it,0] = Tbeg + iline
+            gtrajvals[it,0] = Tbeg + iline - 1
             gtrajvals[it,1] = int(line.split(' ')[1])
             gtrajvals[it,2] = int(line.split(' ')[2])
@@ -11221,7 +11221,7 @@
                     yinit2D = 0
 
-                if gtrajvals[it,2]+box2 + 1 > dimy + 1: 
-                    yend = dimy + 1
-                    yend2D = dimy + 1 - gtrajvals[it,2] + box2
+                if gtrajvals[it,2]+box2 + 1 > dimy: 
+                    yend = dimy - 1
+                    yend2D = dimy - 1 - gtrajvals[it,2] + box2
                 else:
                     yend = gtrajvals[it,2]+box2 + 1
@@ -11235,7 +11235,7 @@
                     xinit2D = 0
 
-                if gtrajvals[it,1]+box2 + 1 > dimx + 1: 
-                    xend = dimx + 1
-                    xend2D = dimx + 1 - gtrajvals[it,1] - box2
+                if gtrajvals[it,1]+box2 + 1 > dimx: 
+                    xend = dimx - 1
+                    xend2D = dimx - 1 - gtrajvals[it,1] - box2
                 else:
                     xend = gtrajvals[it,1]+box2 + 1
@@ -11254,5 +11254,4 @@
 # circle values
             circdist[it,:,:] = radius_dist(dimy,dimx,gtrajvals[it,2],gtrajvals[it,1])
-
             if gtrajvals[it,2]-Nrad < 0 or gtrajvals[it,2]+Nrad + 1 > dimy + 1 \
               or gtrajvals[it,1]-Nrad < 0 or gtrajvals[it,1]+Nrad + 1 > dimx + 1:
@@ -11265,7 +11264,7 @@
                     yinit2D = 0
 
-                if gtrajvals[it,2]+Nrad + 1 > dimy + 1: 
-                    yend = dimy + 1
-                    yend2D = dimy + 1 - gtrajvals[it,2] + Nrad
+                if gtrajvals[it,2]+Nrad + 1 > dimy: 
+                    yend = dimy - 1
+                    yend2D = dimy - 1 - gtrajvals[it,2] + Nrad
                 else:
                     yend = gtrajvals[it,2]+Nrad + 1
@@ -11279,7 +11278,7 @@
                     xinit2D = 0
 
-                if gtrajvals[it,1]+Nrad + 1 > dimx + 1: 
-                    xend = dimx + 1
-                    xend2D = dimx + 1 - gtrajvals[it,1] - Nrad
+                if gtrajvals[it,1]+Nrad + 1 > dimx: 
+                    xend = dimx - 1
+                    xend2D = dimx - 1 - gtrajvals[it,1] - Nrad
                 else:
                     xend = gtrajvals[it,1]+Nrad + 1
@@ -11672,5 +11671,4 @@
 
                     rvarvalst = np.ones((Nrad*2+1, Nrad*2+1),dtype=np.float)*fillValue
-
                     varvalst[tuple(slice2D)] = varobj[tuple(slicev)]
                     varvals[it,:,:] = varvalst
@@ -15679,5 +15677,5 @@
             dimt = varobj.shape[0]
  
-            varvals = np.ones(tuple([Ttraj,boxs,boxs]), dtype=np.float)
+            varvals = np.ones(tuple([Ttraj,boxs,boxs1]), dtype=np.float)
             lonvals = np.ones(tuple([Ttraj,boxs,boxs]), dtype=np.float)
             latvals = np.ones(tuple([Ttraj,boxs,boxs]), dtype=np.float)
