Index: trunk/UTIL/PYTHON/create_ecmwf.py
===================================================================
--- trunk/UTIL/PYTHON/create_ecmwf.py	(revision 570)
+++ trunk/UTIL/PYTHON/create_ecmwf.py	(revision 571)
@@ -28,4 +28,10 @@
 area = "Whole"
 ##########################################################################
+var = ["130"]
+fieldtype = "3d"
+lev = ["1000.","900.","800.","700.","600."]
+tim = ["00"]
+date = ['01','09','2009','01','09','2009']
+area = "Whole"
 
 ##########################################################################
Index: trunk/UTIL/PYTHON/myplot.py
===================================================================
--- trunk/UTIL/PYTHON/myplot.py	(revision 570)
+++ trunk/UTIL/PYTHON/myplot.py	(revision 571)
@@ -91,4 +91,23 @@
           else:out=field
     return out
+
+## Author: AC
+def windamplitude (nc)
+    varinfile = nc.variables.keys()
+    if "U" in varinfile: zu=getfield(nc,'U')
+    elif "Um" in varinfile: zu=getfield(nc,'Um')
+    if "V" in varinfile: zv=getfield(nc,'V')
+    elif "Vm" in varinfile: zv=getfield(nc,'Vm')
+    znt,znz,zny,znx = np.array(zu).shape
+    if "U" in varinfile:znx=znx-1
+    zuint = np.zeros([znt,znz,zny,znx])
+    zvint = np.zeros([znt,znz,zny,znx])
+    if "U" in varinfile:
+       for xx in np.arange(znx):      zuint[:,:,:,xx] = (zu[:,:,:,xx] + zu[:,:,:,xx+1])/2.
+       for yy in np.arange(zny):      zvint[:,:,yy,:] = (zv[:,:,yy,:] + zv[:,:,yy+1,:])/2.
+    else:
+       zuint=zu
+       zvint=zv
+    return np.sqrt(zuint**2 + zvint**2)
 
 ## Author: AS + TN + AC
Index: trunk/UTIL/PYTHON/planetoplot.py
===================================================================
--- trunk/UTIL/PYTHON/planetoplot.py	(revision 570)
+++ trunk/UTIL/PYTHON/planetoplot.py	(revision 571)
@@ -274,5 +274,9 @@
       if var2: all_var2[k] = getfield(nc,var2)
       if winds: all_windu[k] = getfield(nc,uchar) ; all_windv[k] = getfield(nc,vchar)
-      ##### SPECIFIC
+      #####################
+      ##### GETFIELDS #####
+      #####################
+      ##### SPECIFIC CASES
+      ##### 1. saturation temperature
       if varname in ["temp","t","T_nadir_nit","T_nadir_day","temp_day","temp_night"] and tsat:
           tt=getfield(nc,varname) ; print "computing Tsat-T, I ASSUME Z-AXIS IS PRESSURE"
@@ -280,27 +284,10 @@
           else:                                 tinput=tt
           all_var[k]=get_tsat(vert,tinput,zlon=lon,zlat=lat,zalt=vert,ztime=time)
+      ##### 2. wind amplitude
+      elif ((varname in ['UV','uv','uvmet']) and (typefile in ['meso']) and (varname not in nc.variables)):
+          all_var[k]=windamplitude(nc)
       else:
       ##### GENERAL STUFF HERE
-          if ((varname in ['UV','uv','uvmet']) and (typefile in ['meso']) and (varname not in nc.variables)):
-             if "U" in varinfile: zu=getfield(nc,'U')
-             elif "Um" in varinfile: zu=getfield(nc,'Um')
-             if "V" in varinfile: zv=getfield(nc,'V')
-             elif "Vm" in varinfile: zv=getfield(nc,'Vm')
-             znt,znz,zny,znx = np.array(zu).shape
-             if "U" in varinfile:znx=znx-1
-             zuint = np.zeros([znt,znz,zny,znx])
-             zvint = np.zeros([znt,znz,zny,znx])
-             if "U" in varinfile:
-                for xx in np.arange(znx):
-                    zuint[:,:,:,xx] = (zu[:,:,:,xx] + zu[:,:,:,xx+1])/2.
-                for yy in np.arange(zny):
-                    zvint[:,:,yy,:] = (zv[:,:,yy,:] + zv[:,:,yy+1,:])/2.
-             else:
-                    zuint=zu
-                    zvint=zv
-             all_var[k] = np.sqrt(zuint**2 + zvint**2)
-          else:
-             all_var[k] = getfield(nc,varname)
-
+          all_var[k] = getfield(nc,varname)
       print "**** GOT SUBDATA:",k," NAMEFILE:",namefile," VAR:",varname, var2 ; k += 1 ; firstfile = False
       #### End of for namefile in namefiles
@@ -314,28 +301,10 @@
              if ope in ["-","+","-%"]:
                 if fileref is not None:   
-
-                   if ((all_varname[k-1] in ['UV','uv','uvmet']) and (typefile in ['meso']) and (all_varname[k-1] not in Dataset(fileref).variables)):
-                      if "U" in varinfile: zu=getfield(Dataset(fileref),'U')
-                      elif "Um" in varinfile: zu=getfield(Dataset(fileref),'Um')
-                      if "V" in varinfile: zv=getfield(Dataset(fileref),'V')
-                      elif "Vm" in varinfile: zv=getfield(Dataset(fileref),'Vm')
-                      znt,znz,zny,znx = np.array(zu).shape
-                      if "U" in varinfile:znx=znx-1
-                      zuint = np.zeros([znt,znz,zny,znx])
-                      zvint = np.zeros([znt,znz,zny,znx])
-                      if "U" in varinfile:
-                         for xx in np.arange(znx):
-                             zuint[:,:,:,xx] = (zu[:,:,:,xx] + zu[:,:,:,xx+1])/2.
-                         for yy in np.arange(zny):
-                             zvint[:,:,yy,:] = (zv[:,:,yy,:] + zv[:,:,yy+1,:])/2.
-                      else:
-                         zuint=zu
-                         zvint=zv
-                      all_var[k] = np.sqrt(zuint**2 + zvint**2)
+                   ncref = Dataset(fileref)
+                   if ((all_varname[k-1] in ['UV','uv','uvmet']) and (typefile in ['meso']) and (all_varname[k-1] not in ncref.variables)):
+                      all_var[k] = windamplitude(ncref)
                    else:
-                      all_var[k] = getfield(Dataset(fileref),all_varname[k-1])
-          
+                      all_var[k] = getfield(ncref,all_varname[k-1])
                    all_varname[k] = all_varname[k-1] ; all_time[k] = all_time[k-1] ; all_namefile[k] = all_namefile[k-1] ; all_var2[k] = all_var2[k-1]
-
                 else: errormess("fileref is missing!") 
                 if ope == "-":     all_var[k+1]= all_var[k-1] - all_var[k]
@@ -510,5 +479,4 @@
 
                     if which == "unidim":
-                        #lbls = ["<TH+RiSL+MY4> tau=0.5","<Convadj> tau=0.5","<TH+RiSL+MY4> tau=1","<Convadj> tau=1"]
                         lbl = ""
                         if indexlat is not None:  lbl = lbl + " ix" + str(indexlat[0])
