Index: trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/api_wrapper.py
===================================================================
--- trunk/MESOSCALE/PLOT/PYTHON/mylib/api_wrapper.py	(revision 200)
+++ trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/api_wrapper.py	(revision 207)
@@ -14,5 +14,6 @@
                     extrapolate     = 0, \
                     unstagger_grid  = False, \
-                    onelevel        = 0.020  ):
+                    onelevel        = 0.020, \
+                    nocall          = False ):
     import api
     import numpy as np
@@ -27,5 +28,6 @@
     print input_name, output_name
 
-    api.api_main ( path_to_input, input_name, path_to_output, output_name, \
+    if nocall:     pass
+    else:          api.api_main ( path_to_input, input_name, path_to_output, output_name, \
                    process, fields, debug, bit64, oldvar, np.arange(299), \
                    interp_method, extrapolate, unstagger_grid, onelevel )
Index: trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/myplot.py
===================================================================
--- trunk/MESOSCALE/PLOT/PYTHON/mylib/myplot.py	(revision 200)
+++ trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/myplot.py	(revision 207)
@@ -62,25 +62,9 @@
     return lschar, zehour, zehourin
 
-def api_onelevel (  path_to_input   = None, \
-                    input_name      = 'wrfout_d0?_????-??-??_??:00:00', \
-                    path_to_output  = None, \
-                    output_name     = 'output.nc', \
-                    process         = 'list', \
-                    fields          = 'tk,W,uvmet,HGT', \
-                    debug           = False, \
-                    bit64           = False, \
-                    oldvar          = True, \
-                    interp_method   = 4, \
-                    extrapolate     = 0, \
-                    unstagger_grid  = False, \
-                    onelevel        = 0.020  ):
-    import api
-    import numpy as np
-    if not path_to_input:   path_to_input  = './'
-    if not path_to_output:  path_to_output = path_to_input
-    api.api_main ( path_to_input, input_name, path_to_output, output_name, \
-                   process, fields, debug, bit64, oldvar, np.arange (299), \
-                   interp_method, extrapolate, unstagger_grid, onelevel )
-    return
+def getprefix (nc):
+    prefix = 'LMD_MMM_'
+    prefix = prefix + 'd'+str(getattr(nc,'GRID_ID'))+'_'
+    prefix = prefix + str(int(getattr(nc,'DX')/1000.))+'km_'
+    return prefix
 
 def getproj (nc):
@@ -177,4 +161,13 @@
     	return improc
 
+def getwinds (nc,charu='Um',charv='Vm'):
+    import numpy as np
+    u = nc.variables[charu]
+    v = nc.variables[charv]
+    if charu == 'U': u = u[:, :, :, 0:len(u[0,0,0,:])-1]
+    if charv == 'V': v = v[:, :, 0:len(v[0,0,:,0])-1, :]
+                     ### ou alors prendre les coordonnees speciales
+    return u,v
+
 def vectorfield (u, v, x, y, stride=3, scale=15., factor=250., color='black', csmooth=1, key=True):
     ## scale regle la reference du vecteur
@@ -182,10 +175,4 @@
     import  matplotlib.pyplot               as plt
     import  numpy                           as np
-    #posx = np.max(x) + np.std(x) / 3.  ## pb pour les domaines globaux ...
-    #posy = np.mean(y)
-    #posx = np.min(x)
-    #posy = np.max(x)
-    #posx = np.max(x) - np.std(x) / 10.
-    #posy = np.max(y) + np.std(y) / 10.
     posx = np.min(x) - np.std(x) / 10.
     posy = np.min(y) - np.std(y) / 10.
@@ -199,7 +186,6 @@
                     angles='xy',color=color,\
                     scale=factor,width=widthvec )
-    if color=='white':     kcolor='black'
-    elif color=='yellow':  kcolor=color
-    else:                  kcolor=color
+    if color in ['white','yellow']:     kcolor='black'
+    else:                               kcolor=color
     if key: p = plt.quiverkey(q,posx,posy,scale,\
                    str(int(scale)),coordinates='data',color=kcolor,labelpos='S',labelsep = 0.03)
@@ -232,6 +218,6 @@
     elif wlat[0] <= -80.:  blat = -40. 
     else:                  blat = wlat[0]
-    h = 2000.
-    radius = 3397200
+    h = 50.  ## en km
+    radius = 3397200.
     if   char == "cyl":     m = Basemap(rsphere=radius,projection='cyl',\
                               llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])
@@ -242,10 +228,13 @@
     elif char == "npstere": m = Basemap(rsphere=radius,projection='npstere', boundinglat=blat, lon_0=0.)
     elif char == "spstere": m = Basemap(rsphere=radius,projection='spstere', boundinglat=blat, lon_0=0.)
+    elif char == "nplaea":  m = Basemap(rsphere=radius,projection='nplaea', boundinglat=wlat[0], lon_0=meanlon)
+    elif char == "laea":    m = Basemap(rsphere=radius,projection='laea',lon_0=meanlon,lat_0=meanlat,lat_ts=meanlat,\
+                              llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])
     elif char == "nsper":   m = Basemap(rsphere=radius,projection='nsper',lon_0=meanlon,lat_0=meanlat,satellite_height=h*1000.)
     elif char == "merc":    m = Basemap(rsphere=radius,projection='merc',lat_ts=0.,\
                               llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])
     fontsizemer = int(mpl.rcParams['font.size']*3./4.)
-    if char in ["cyl","lcc","merc"]:   step = findstep(wlon)
-    else:                              step = 10.
+    if char in ["cyl","lcc","merc","nsper","laea"]:   step = findstep(wlon)
+    else:                                             step = 10.
     m.drawmeridians(np.r_[-180.:180.:step*2.], labels=[0,0,0,1], color='grey', fontsize=fontsizemer)
     m.drawparallels(np.r_[-90.:90.:step], labels=[1,0,0,0], color='grey', fontsize=fontsizemer)
@@ -255,10 +244,54 @@
     return m
 
+def fmtvar (whichvar="def"):
+    fmtvar    =     { \
+             "tk":           "%.0f",\
+             "tpot":         "%.0f",\
+             "def":          "%.1e",\
+             "PTOT":         "%.0f",\
+             "HGT":          "%.1e",\
+             "USTM":         "%.2f",\
+                    }
+    if whichvar not in fmtvar:
+        whichvar = "def"
+    return fmtvar[whichvar]
+
+def defcolorb (whichone="def"):
+    whichcolorb =    { \
+             "def":          "spectral",\
+             "HGT":          "spectral",\
+             "tk":           "gist_heat",\
+             "QH2O":         "PuBu",\
+             "USTM":         "YlOrRd",\
+#"RdPu",\
+                     }
+    if whichone not in whichcolorb:
+        whichone = "def"
+    return whichcolorb[whichone]
+
+def definecolorvec (whichone="def"):
+        whichcolor =    { \
+                "def":          "black",\
+                "vis":          "yellow",\
+                "vishires":     "yellow",\
+                "molabw":       "yellow",\
+                "mola":         "black",\
+                "gist_heat":    "white",\
+                "hot":          "tk",\
+                "gist_rainbow": "black",\
+                "spectral":     "black",\
+                "gray":         "red",\
+                "PuBu":         "black",\
+                        }
+        if whichone not in whichcolor:
+                whichone = "def"
+        return whichcolor[whichone]
+
 def marsmap (whichone="vishires"):
 	whichlink = 	{ \
 		"vis":		"http://maps.jpl.nasa.gov/pix/mar0kuu2.jpg",\
-		"vishires":	"http://users.info.unicaen.fr/~karczma/TEACH/InfoGeo/Images/Planets/MarsMap_2500x1250.jpg",\
+		"vishires":	"http://dl.dropbox.com/u/11078310/MarsMap_2500x1250.jpg",\
 		"mola":		"http://www.lns.cornell.edu/~seb/celestia/mars-mola-2k.jpg",\
-		"molabw":	"http://users.info.unicaen.fr/~karczma/TEACH/InfoGeo/Images/Planets/MarsElevation_2500x1250.jpg",\
+		"molabw":	"http://dl.dropbox.com/u/11078310/MarsElevation_2500x1250.jpg",\
 			}
 	if whichone not in whichlink: 
