Index: /trunk/tools/drawing.py
===================================================================
--- /trunk/tools/drawing.py	(revision 539)
+++ /trunk/tools/drawing.py	(revision 540)
@@ -1175,9 +1175,9 @@
     return
 
-def draw_barbs(ncfiles, values, varns):
+def draw_barbs(ncfile, values, varns):
     """ Function to plot wind barbs
-      values= [X/Y/Z/T]|[dimname]|[vardimname]|[value]:[vecvals]:[windlabs]:[mapvalues]:
+      values= [dimname]|[vardimname]|[value]:[vecvals]:[windlabs]:[mapvalues]:
         [gtit]:[kindfig]:[figuren]
-        [dimname]|[vardimname]|[value]: ',', list for each basic dimension '|' separated of:
+        'X/Y/Z/T'|[dimname]|[vardimname]|[value]: ',', list for each basic dimension '|' separated of:
           [dimname]: name of the dimension in the file
           [vardimname]: name of the variable with the values for the dimension in the file
@@ -1185,8 +1185,8 @@
           No value takes all the range of the dimension
         [vecvals]= [frequency],[color],[length]
-          [freqv]: [xfreq]@[yfreq] frequency of values allong each axis ('None', all grid points; 
+          [frequency]: [xfreq]@[yfreq] frequency of values allong each axis ('None', all grid points; 
             'auto', computed automatically to have 20 vectors along each axis)
-          [colorv]: color of the vectors ('None', for 'red')
-          [lengthv]: length of the wind barbs ('None', for 9)
+          [color]: color of the vectors ('auto', for 'red')
+          [length]: length of the wind barbs ('auto', for 9)
         [windlabs]= [windname],[windunits]
           [windname]: name of the wind variable in the graph
@@ -1224,5 +1224,5 @@
     dimvals = values.split(':')[0]
     vecvals = values.split(':')[1]
-    windlabs = values.split(':')[2]
+    windlabels = values.split(':')[2]
     mapvalues = values.split(':')[3]
     gtit = values.split(':')[4]
@@ -1235,12 +1235,14 @@
     for dimv in dimvals.split(','):
         dns = dimv.split('|')
-        dims[dns[0]] = [dns[1], dns[2]]
+        dims[dns[0]] = [dns[1], dns[2], dns[3]]
 
     varNs = []
     for dn in dims.keys():
         if dn == 'X':
-            varNs.append(dims[dn][2])
+            varNs.append(dims[dn][1])
+            dimx = len(of.dimensions[dims[dn][0]])
         elif dn == 'Y':
-            varNs.append(dims[dn][2])
+            varNs.append(dims[dn][1])
+            dimy = len(of.dimensions[dims[dn][0]])
 
     ivar = 0
@@ -1257,34 +1259,60 @@
     ivar = 0
     for varN in varNs:
+        print varN,'...'
         varslice = []
 
         ovarN = of.variables[varN]
-        vard = ovarN.dimensions.keys()
+        vard = ovarN.dimensions
         for vdn in vard:
+            found = False
             for dd in dims.keys():
-                if dd == vdn:
-                    if dims[dd][1].find('@') != -1:
-                        rvals = dims[dd][1].replace('@')
+                if dims[dd][0] == vdn:
+                    if dims[dd][2].find('@') != -1:
+                        rvals = dims[dd][2].split('@')
                         varslice.append(slice(int(rvals[0]), int(rvals[1])))
-                    elif dims[dd][1] == '-1':
-                        varslice.append(slice(0,len(of.dimensions[dims[dd]])))
+                    elif dims[dd][2] == '-1':
+                        varslice.append(slice(0,len(of.dimensions[dims[dd][0]])))
+                    else:
+                        varslice.append(int(dims[dd][2]))
+
+                    found = True
                     break
-                else:
-                    varslice.append(slice(0,len(of.dimensions[dims[dd]])))
-
-        if ivar == 0:
-            lonvals0 = ovarN[tuple(varslice)]
-        elif ivar == 1:
-            latvals0 = ovarN[tuple(varslice)]
+            if not found:
+                varslice.append(slice(0,len(of.dimensions[dims[dd][0]])))
+
+        if varN == dims['X'][1]:
+            lonvals0 = np.squeeze(ovarN[tuple(varslice)])
+        elif varN == dims['Y'][1]:
+            latvals0 = np.squeeze(ovarN[tuple(varslice)])
         elif ivar == 2:
-            uwvals = ovarN[tuple(varslice)]
+            uwvals = np.squeeze(np.array(ovarN[tuple(varslice)]))
         elif ivar == 3:
-            vwvals = ovarN[tuple(varslice)]
+            vwvals = np.squeeze(ovarN[tuple(varslice)])
+
+        ivar = ivar + 1
+
+#    print 'Final shapes:',lonvals0.shape,':',latvals0.shape,':',uwvals.shape,':',
+#      vwvals.shape
+
+    if len(uwvals.shape) != 2 or len(vwvals.shape) != 2:
+        print errormsg
+        print '  ' + fname + ': wrong size of the wind fields! they must be ' +      \
+          '2-dimensional!'
+        print '    u-winds shape:',uwvals.shape,'dims:',of.variables[varNs[2]]
+        print '    v-winds shape:',vwvals.shape,'dims:',of.variables[varNs[3]]
+        print '      provide more values for their dimensions!!'
+        quit(-1)
 
     if len(lonvals0.shape) == 1:
         lonvals, latvals = np.meshgrid(lonvals0, latvals0)
+    else:
+        lonvals = lonvals0
+        latvals = latvals0
 
 # Vecor values
-    freqv = vecvals.split(',')[0]
+    if vecvals.split(',')[0] == 'None':
+        freqv = None
+    else:
+        freqv = vecvals.split(',')[0] 
     colorv = vecvals.split(',')[1]
     lengthv = vecvals.split(',')[2]
Index: /trunk/tools/drawing_tools.py
===================================================================
--- /trunk/tools/drawing_tools.py	(revision 539)
+++ /trunk/tools/drawing_tools.py	(revision 540)
@@ -5172,5 +5172,5 @@
     return
 
-def plot_barbs(xvals,yvals,vecfreq,veccolor,veclength,windn,wuts,mapv,graphtit,kfig,figname):
+def plot_barbs(xvals,yvals,uvals,vvals,vecfreq,veccolor,veclength,windn,wuts,mapv,graphtit,kfig,figname):
     """ Function to plot wind barbs
       xvals= values for the 'x-axis'
@@ -5213,10 +5213,10 @@
         yfreq=int(vecfreq.split('@')[1])
 
-    if veccolor is None:
+    if veccolor == 'auto':
         vcolor = "red"
     else:
         vcolor = veccolor
 
-    if veclength is None:
+    if veclength == 'auto':
         vlength = 9
     else:
@@ -5266,7 +5266,6 @@
         plt.ylabel('S-N')
 
-    plt.barbs(xvals[::yfreq,::xfreq], yvals[::yfreq,::xfreq],                        \
-      uvals[timev,lev,::yfreq,::xfreq],vvals[timev,lev,::yfreq,::xfreq],color=vcolor,\
-      pivot='tip')
+    plt.barbs(xvals[::yfreq,::xfreq], yvals[::yfreq,::xfreq], uvals[::yfreq,::xfreq],\
+      vvals[::yfreq,::xfreq], color=vcolor, pivot='tip')
 
     plt.annotate(windn.replace('_','\_') +' (' + units_lunits(wuts) + ')',           \
