Index: /trunk/tools/nc_var_tools.py
===================================================================
--- /trunk/tools/nc_var_tools.py	(revision 276)
+++ /trunk/tools/nc_var_tools.py	(revision 277)
@@ -10076,27 +10076,4 @@
     newdim = objofile.createDimension('time', None)
 
-# var dimensions
-    newvar = objofile.createVariable('trlon', 'f8', ('time'))
-    newattr = basicvardef(newvar,'trlon','trajectory longitude','degrees west_east')
-    newvar[:] = trajvals[:,1]
-
-    newvar = objofile.createVariable('trlat', 'f8', ('time'))
-    newattr = basicvardef(newvar,'trlat','trajectory latitude','degrees north_south')
-    newvar[:] = trajvals[:,2]
-
-    newvar = objofile.createVariable('time', 'f8', ('time'))
-    newattr = basicvardef(newvar, 'time', 'time', tunits)
-    newvar[:] = trajvals[:,0]
-
-    newvar = objofile.createVariable('lon', 'f8', ('time', 'y', 'x'),                \
-      fill_value=fillValue)
-    newattr = basicvardef(newvar, 'longitude', 'longitude', 'degrees west_east')
-    newvar[:] = lonvals
-
-    newvar = objofile.createVariable('lat', 'f8', ('time', 'y', 'x'),                \
-      fill_value=fillValue)
-    newattr = basicvardef(newvar, 'latitude', 'latitude', 'degrees north_south')
-    newvar[:] = latvals
-
     statnames = ['minbox', 'maxbox', 'meanbox', 'mean2box', 'stdevbox']
     vstlname = ['minimum value within', 'maximum value within', 'mean value within', \
@@ -10120,5 +10097,4 @@
         if Nvardims == 4:
 # Too optimistic, but at this stage...
-            dimt = varobj.shape[0]
             dimz = varobj.shape[1]
  
@@ -10151,9 +10127,5 @@
 
             varvals = np.ones(tuple([Ttraj,dimz,boxs,boxs]), dtype=np.float)
-            lonvals = np.ones(tuple([Ttraj,dimz,boxs,boxs]), dtype=np.float)
-            latvals = np.ones(tuple([Ttraj,dimz,boxs,boxs]), dtype=np.float)
             rvarvals = np.ones(tuple([Ttraj,dimz,Nrad*2+1,Nrad*2+1]), dtype=np.float)
-            rlonvals = np.ones(tuple([Ttraj,dimz,Nrad*2+1,Nrad*2+1]), dtype=np.float)
-            rlatvals = np.ones(tuple([Ttraj,dimz,Nrad*2+1,Nrad*2+1]), dtype=np.float)
 
             statvarvals = np.ones(tuple([Ttraj,6]), dtype=np.float)
@@ -10194,9 +10166,4 @@
                       statvarvals[it,:,3]*statvarvals[it,:,3])
 
-                    varvalst[tuple(slice2D)] = lonv[tuple(slicevnoT)]
-                    lonvals[it,:,:,:] = varvalst
-                    varvalst[tuple(slice2D)] = latv[tuple(slicevnoT)]           
-                    latvals[it,:,:,:] = varvalst
-
                 else:
                     slicev.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2]+box2+1))
@@ -10227,9 +10194,4 @@
                     statvarvals[it,:,5] = np.sqrt(statvarvals[it,:,4] -              \
                       statvarvals[it,:,3]*statvarvals[it,:,3])
-
-                    varvalst = lonv[tuple(slicevnoT)]
-                    lonvals[it,:,:] = varvalst
-                    varvalst = latv[tuple(slicevnoT)]           
-                    latvals[it,:,:] = varvalst
 
 # Circle values
@@ -10267,9 +10229,4 @@
                       rstatvarvals[it,:,3]*rstatvarvals[it,:,3])
 
-                    rvarvalst[tuple(cslice2D)] = lonv[tuple(cslicevnoT)]
-                    rlonvals[it,:,:,:] = rvarvalst
-                    rvarvalst[tuple(cslice2D)] = latv[tuple(cslicevnoT)]           
-                    rlatvals[it,:,:,:] = rvarvalst
-
                 else:
                     slicev.append(slice(gtrajvals[it,2]-Nrad,gtrajvals[it,2]+Nrad+1))
@@ -10300,9 +10257,4 @@
                     rstatvarvals[it,:,5] = np.sqrt(rstatvarvals[it,4] -              \
                       rstatvarvals[it,:,3]*rstatvarvals[it,3])
-
-                    rvarvalst = lonv[tuple(cslicevnoT)]
-                    rlonvals[it,:,:,:] = rvarvalst
-                    rvarvalst = latv[tuple(cslicevnoT)]           
-                    rlatvals[it,:,:,:] = rvarvalst
 
 #            print 'statistics:',rstatvarvals[it,:] 
@@ -10490,9 +10442,4 @@
                       rstatvarvals[it,3]*rstatvarvals[it,3])
 
-                    rvarvalst[tuple(cslice2D)] = lonv[tuple(cslicevnoT)]
-                    rlonvals[it,:,:] = rvarvalst
-                    rvarvalst[tuple(cslice2D)] = latv[tuple(cslicevnoT)]           
-                    rlatvals[it,:,:] = rvarvalst
-
                 else:
                     slicev.append(slice(gtrajvals[it,2]-Nrad,gtrajvals[it,2]+Nrad+1))
@@ -10523,9 +10470,4 @@
                     rstatvarvals[it,5] = np.sqrt(rstatvarvals[it,4] -                \
                       rstatvarvals[it,3]*rstatvarvals[it,3])
-
-                    rvarvalst = lonv[tuple(cslicevnoT)]
-                    rlonvals[it,:,:] = rvarvalst
-                    rvarvalst = latv[tuple(cslicevnoT)]           
-                    rlatvals[it,:,:] = rvarvalst
 
 #            print 'statistics:',rstatvarvals[it,:] 
@@ -10599,4 +10541,35 @@
 #                newattr = set_attributek(newvar,'_FillValue',fillValue,'npfloat')
                 ist = ist + 1
+
+        if not objofile.has_key('trlon') and Nvardims == 3:
+# var dimensions
+            newvar = objofile.createVariable('trlon', 'f8', ('time'))
+            newattr = basicvardef(newvar,'trlon','trajectory longitude',             \
+              'degrees west_east')
+            newvar[:] = trajvals[:,1]
+
+            newvar = objofile.createVariable('trlat', 'f8', ('time'))
+            newattr = basicvardef(newvar,'trlat','trajectory latitude',              \
+              'degrees north_south')
+            newvar[:] = trajvals[:,2]
+
+            newvar = objofile.createVariable('time', 'f8', ('time'))
+            newattr = basicvardef(newvar, 'time', 'time', tunits)
+            newvar[:] = trajvals[:,0]
+
+            newvar = objofile.createVariable('lon', 'f8', ('time', 'y', 'x'),        \
+              fill_value=fillValue)
+            newattr = basicvardef(newvar, 'longitude', 'longitude',                  \
+              'degrees west_east')
+            newvar[:] = lonvals
+
+            newvar = objofile.createVariable('lat', 'f8', ('time', 'y', 'x'),        \
+              fill_value=fillValue)
+            newattr = basicvardef(newvar, 'latitude', 'latitude',                    \
+              'degrees north_south')
+            newvar[:] = latvals
+
+        ivar = ivar + 1
+
 
 # global attributes
