Index: /trunk/tools/diagnostics.py
===================================================================
--- /trunk/tools/diagnostics.py	(revision 1998)
+++ /trunk/tools/diagnostics.py	(revision 1999)
@@ -830,4 +830,10 @@
         diagout, diagoutd, diagoutvd = diag.compute_td(var0,var1,var2,dnamesvar,dvnamesvar)
 
+        # Removing the nonChecking variable-dimensions from the initial list
+        varsadd = []
+        for nonvd in NONchkvardims:
+            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
+            varsadd.append(nonvd)
+
         ncvar.insert_variable(ncobj, 'tdas', diagout, diagoutd, diagoutvd, newnc)
 
@@ -843,4 +849,10 @@
         diagout, diagoutd, diagoutvd = diag.compute_wds(var0,var1,dnamesvar,dvnamesvar)
 
+        # Removing the nonChecking variable-dimensions from the initial list
+        varsadd = []
+        for nonvd in NONchkvardims:
+            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
+            varsadd.append(nonvd)
+
         ncvar.insert_variable(ncobj, 'wds', diagout, diagoutd, diagoutvd, newnc)
 
@@ -855,4 +867,10 @@
 
         diagout, diagoutd, diagoutvd = diag.compute_wss(var0,var1,dnamesvar,dvnamesvar)
+
+        # Removing the nonChecking variable-dimensions from the initial list
+        varsadd = []
+        for nonvd in NONchkvardims:
+            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
+            varsadd.append(nonvd)
 
         ncvar.insert_variable(ncobj, 'wss', diagout, diagoutd, diagoutvd, newnc)
@@ -1121,6 +1139,14 @@
             
         diagout = var0 + var1
-
-        ncvar.insert_variable(ncobj, 'pres', diagout, dnames, dvnames, newnc)
+        diagoutd = list(ncobj.variables[depvars[0]].dimensions)
+        diagoutvd = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
+
+        # Removing the nonChecking variable-dimensions from the initial list
+        varsadd = []
+        for nonvd in NONchkvardims:
+            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
+            varsadd.append(nonvd)
+
+        ncvar.insert_variable(ncobj, 'pres', diagout, diagoutd, diagoutvd, newnc)
 
 # WRFpos 
@@ -1262,15 +1288,31 @@
 
         # un-staggering variables
-        unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        if len(var0.shape) == 4:
+            unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        elif len(var0.shape) == 3:
+            # Asuming sunding point (dimt, dimz, dimstgx)
+            unstgdims = [var0.shape[0], var0.shape[1]]
+
         ua = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float)
-        unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
-        unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
-
-        for iz in range(var0.shape[1]):
-            ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2
-
-        dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        if len(var0.shape) == 4:
+            unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
+            unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
+
+            for iz in range(var0.shape[1]):
+                ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2
+
+            dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        elif len(var0.shape) == 3:
+            unstgvar0 = 0.5*(var0[:,:,0] + var0[:,:,1])
+            unstgvar1 = 0.5*(var1[:,:,0] + var1[:,:,1])
+            for iz in range(var0.shape[1]):
+                ua[:,iz] = unstgvar0[:,iz]*var3 - unstgvar1[:,iz]*var2
+
+            dnamesvar = ['Time','bottom_top']
+
         dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
 
@@ -1292,14 +1334,31 @@
 
         # un-staggering variables
-        unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        if len(var0.shape) == 4:
+            unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        elif len(var0.shape) == 3:
+            # Asuming sunding point (dimt, dimz, dimstgx)
+            unstgdims = [var0.shape[0], var0.shape[1]]
+
         va = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float)
-        unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
-        unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
-        for iz in range(var0.shape[1]):
-            va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3
-
-        dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        if len(var0.shape) == 4:
+            unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
+            unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
+
+            for iz in range(var0.shape[1]):
+                va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3
+
+            dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        elif len(var0.shape) == 3:
+            unstgvar0 = 0.5*(var0[:,:,0] + var0[:,:,1])
+            unstgvar1 = 0.5*(var1[:,:,0] + var1[:,:,1])
+            for iz in range(var0.shape[1]):
+                va[:,iz] = unstgvar0[:,iz]*var2 + unstgvar1[:,iz]*var3
+
+            dnamesvar = ['Time','bottom_top']
+
         dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
 
@@ -1321,17 +1380,34 @@
 
         # un-staggering variables
-        unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        if len(var0.shape) == 4:
+            unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        elif len(var0.shape) == 3:
+            # Asuming sunding point (dimt, dimz, dimstgx)
+            unstgdims = [var0.shape[0], var0.shape[1]]
+
         ua = np.zeros(tuple(unstgdims), dtype=np.float)
         va = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float)
-        unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
-        unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
-
-        for iz in range(var0.shape[1]):
-            ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2
-            va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3
-
-        dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        if len(var0.shape) == 4:
+            unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
+            unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
+
+            for iz in range(var0.shape[1]):
+                ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2
+                va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3
+
+            dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        elif len(var0.shape) == 3:
+            unstgvar0 = 0.5*(var0[:,:,0] + var0[:,:,1])
+            unstgvar1 = 0.5*(var1[:,:,0] + var1[:,:,1])
+            for iz in range(var0.shape[1]):
+                ua[:,iz] = unstgvar0[:,iz]*var3 - unstgvar1[:,iz]*var2
+                va[:,iz] = unstgvar0[:,iz]*var2 + unstgvar1[:,iz]*var3
+
+            dnamesvar = ['Time','bottom_top']
+
         dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
 
@@ -1360,15 +1436,35 @@
     elif diagn == 'ws':
             
-        var0 = ncobj.variables[depvars[0]][:]
-        var1 = ncobj.variables[depvars[1]][:]
         # un-staggering variables
-        unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        if len(var0.shape) == 4:
+            unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
+        elif len(var0.shape) == 3:
+            # Asuming sunding point (dimt, dimz, dimstgx)
+            unstgdims = [var0.shape[0], var0.shape[1]]
+
+        ua = np.zeros(tuple(unstgdims), dtype=np.float)
         va = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float)
         unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float)
-        unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
-        unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
-
-        dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        if len(var0.shape) == 4:
+            unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
+            unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
+
+            for iz in range(var0.shape[1]):
+                ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2
+                va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3
+
+            dnamesvar = ['Time','bottom_top','south_north','west_east']
+
+        elif len(var0.shape) == 3:
+            unstgvar0 = 0.5*(var0[:,:,0] + var0[:,:,1])
+            unstgvar1 = 0.5*(var1[:,:,0] + var1[:,:,1])
+            for iz in range(var0.shape[1]):
+                ua[:,iz] = unstgvar0[:,iz]*var3 - unstgvar1[:,iz]*var2
+                va[:,iz] = unstgvar0[:,iz]*var2 + unstgvar1[:,iz]*var3
+
+            dnamesvar = ['Time','bottom_top']
+
         diagout = np.sqrt(unstgvar0*unstgvar0 + unstgvar1*unstgvar1)
 
