Index: /trunk/UTIL/PYTHON/myplot.py
===================================================================
--- /trunk/UTIL/PYTHON/myplot.py	(revision 547)
+++ /trunk/UTIL/PYTHON/myplot.py	(revision 548)
@@ -41,10 +41,5 @@
     elif 'phisinit' in nc.variables:           typefile = 'gcm'
     elif 'time_counter' in nc.variables:       typefile = 'earthgcm'
-    elif hasattr(nc,'START_DATE'):
-      if '9999' in getattr(nc,'START_DATE') :  typefile = 'mesoideal'
-      elif 'vert' in nc.variables:             typefile = 'mesoapi'
-      elif 'U' in nc.variables:                typefile = 'meso'
-      #elif 'HGT_M' in nc.variables:            typefile = 'geo'
-      elif 'HGT' in nc.variables:              typefile = 'meso'
+    elif hasattr(nc,'START_DATE'):             typefile = 'meso' 
     elif 'HGT_M' in nc.variables:              typefile = 'geo'
     else:                                      typefile = 'gcm' # for lslin-ed files from gcm
@@ -275,8 +270,8 @@
 ## Author: AS
 def getstralt(nc,nvert):
-    typefile = whatkindfile(nc)
-    if typefile is 'meso':                      
+    varinfile = nc.variables.keys()
+    if 'vert' not in varinfile:
         stralt = "_lvl" + str(nvert)
-    elif typefile is 'mesoapi':
+    else:
         zelevel = int(nc.variables['vert'][nvert])
         if abs(zelevel) < 10000.:   strheight=str(zelevel)+"m"
@@ -287,6 +282,4 @@
         elif 'pressure'     in nc.dimensions:   stralt = "_"+str(zelevel)+"Pa"
         else:                                   stralt = ""
-    else:
-        stralt = ""
     return stralt
 
@@ -347,5 +340,5 @@
 def getproj (nc):
     typefile = whatkindfile(nc)
-    if typefile in ['mesoapi','meso','geo']:
+    if typefile in ['meso','geo']:
         ### (il faudrait passer CEN_LON dans la projection ?)
         map_proj = getattr(nc, 'MAP_PROJ')
@@ -366,6 +359,6 @@
         else:
             proj="merc"
-    elif typefile in ['gcm']:  proj="cyl"    ## pb avec les autres (de trace derriere la sphere ?)
-    else:                      proj="ortho"
+    elif typefile in ['gcm']:        proj="cyl"    ## pb avec les autres (de trace derriere la sphere ?)
+    else:                            proj="ortho"
     return proj    
 
@@ -439,6 +432,19 @@
     ## getcoord2d for predefined types
     typefile = whatkindfile(nc)
-    if typefile in ['mesoapi','meso']:
-        [lon2d,lat2d] = getcoord2d(nc)
+    if typefile in ['meso']:
+        if '9999' not in getattr(nc,'START_DATE') :   
+            ## regular mesoscale  
+            [lon2d,lat2d] = getcoord2d(nc)  
+        else:                     
+            ## idealized mesoscale                      
+            nx=getattr(nc,'WEST-EAST_GRID_DIMENSION')
+            ny=getattr(nc,'SOUTH-NORTH_GRID_DIMENSION')
+            dlat=getattr(nc,'DX')
+            ## this is dirty because Martian-specific
+            # ... but this just intended to get "lat-lon" like info
+            falselon = np.arange(-dlat*(nx-1)/2.,dlat*(nx-1)/2.,dlat)/60000.
+            falselat = np.arange(-dlat*(ny-1)/2.,dlat*(ny-1)/2.,dlat)/60000.
+            [lon2d,lat2d] = np.meshgrid(falselon,falselat) ## dummy coordinates
+            print "WARNING: domain plot artificially centered on lat,lon 0,0"
     elif typefile in ['gcm']: 
         [lon2d,lat2d] = getcoord2d(nc,nlat="latitude",nlon="longitude",is1d=True)
@@ -447,8 +453,4 @@
     elif typefile in ['geo']:
         [lon2d,lat2d] = getcoord2d(nc,nlat='XLAT_M',nlon='XLONG_M')
-    elif typefile in ['mesoideal']:
-        nx=getattr(nc,'WEST-EAST_GRID_DIMENSION')
-        ny=getattr(nc,'SOUTH-NORTH_GRID_DIMENSION')
-        [lon2d,lat2d] = np.meshgrid(np.arange(nx),np.arange(ny))
     return lon2d,lat2d    
 
@@ -539,15 +541,15 @@
 ## Author: AS
 def getwinddef (nc):    
-    ## getwinds for predefined types
-    typefile = whatkindfile(nc)
     ###
-    if typefile is 'mesoapi':                  [uchar,vchar] = ['Um','Vm']
-    elif typefile is 'gcm':                    [uchar,vchar] = ['u','v']
-    elif typefile in ['meso','mesoideal']:     [uchar,vchar] = ['U','V']
-    else:                                      [uchar,vchar] = ['not found','not found']
+    varinfile = nc.variables.keys()
+    if 'Um' in varinfile:   [uchar,vchar] = ['Um','Vm'] #; print "this is API meso file"
+    elif 'U' in varinfile:  [uchar,vchar] = ['U','V']   #; print "this is RAW meso file"
+    elif 'u' in varinfile:  [uchar,vchar] = ['u','v']   #; print "this is GCM file"
+     ### you can add choices here !
+    else:                   [uchar,vchar] = ['not found','not found']
     ###
-    if typefile in ['meso']:     metwind = False ## geometrical (wrt grid) 
-    else:                        metwind = True  ## meteorological (zon/mer)
-    if metwind is False:         print "Not using meteorological winds. You trust numerical grid as being (x,y)"
+    if uchar in ['U']:         metwind = False ## geometrical (wrt grid) 
+    else:                      metwind = True  ## meteorological (zon/mer)
+    if metwind is False:       print "Not using meteorological winds. You trust numerical grid as being (x,y)"
     ###
     return uchar,vchar,metwind
Index: /trunk/UTIL/PYTHON/planetoplot.py
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot.py	(revision 547)
+++ /trunk/UTIL/PYTHON/planetoplot.py	(revision 548)
@@ -126,9 +126,7 @@
       ### ... TYPEFILE
       typefile = whatkindfile(nc)
-      if typefile in ['mesoideal']:   mapmode=0
-      elif typefile in ['gcm'] and len(nc.variables["longitude"][:]) is 1 and len(nc.variables["latitude"][:]) is 1:       mapmode=0
-      elif typefile in ['earthgcm'] and len(nc.variables["lon"][:]) is 1 and len(nc.variables["lat"][:]) is 1:       mapmode=0
-      if mapmode == 0:       winds=False
-      elif mapmode == 1 and redope is None:
+      if typefile in ['gcm'] and len(nc.variables["longitude"][:]) is 1 and len(nc.variables["latitude"][:]) is 1:       mapmode=0 ; winds=False
+      elif typefile in ['earthgcm'] and len(nc.variables["lon"][:]) is 1 and len(nc.variables["lat"][:]) is 1:           mapmode=0 ; winds=False
+      if redope is None and mapmode == 1:
           if svert is None:  svert = readslices(str(level)) ; nvert=1
           if stime is None and mrate is None:
@@ -152,5 +150,5 @@
       [lon2d,lat2d] = getcoorddef(nc)
       ### ... PROJECTION
-      if ((proj == None) and (typefile not in ['mesoideal'])):   proj = getproj(nc)                 
+      if proj == None:   proj = getproj(nc)                 
 
       if firstfile:
@@ -184,5 +182,5 @@
               time = (initime+time*24)%24
               print "LOCAL TIMES.... ", time
-      elif typefile in ['meso','mesoapi','geo','mesoideal']:
+      elif typefile in ['meso','geo']:
           area = None ## not active for the moment
           ###### STUFF TO GET THE CORRECT LAT/LON FROM MESOSCALE FILES WITH 2D LAT/LON ARRAYS
@@ -208,5 +206,5 @@
               lonp,latp = ( lon2d[indices[0,0,0],indices[0,0,1]] , lat2d[indices[0,0,0],indices[0,0,1]] )
           ######
-          if typefile in ['mesoapi','meso'] and mapmode == 1: lon2d = dumpbdy(lon2d,6) ; lat2d = dumpbdy(lat2d,6)  ### important to do that now and not before
+          if typefile in ['meso'] and mapmode == 1: lon2d = dumpbdy(lon2d,6) ; lat2d = dumpbdy(lat2d,6)  ### important to do that now and not before
           ######
           if varname in ['PHTOT','W']:    vertdim='BOTTOM-TOP_PATCH_END_STAG'
@@ -333,5 +331,5 @@
        else:                                 indextime = getsindex(stime,((nplot-1)//(nlon*nlat*nvert))%ntime,time)
        ltst = None 
-       if typefile in ['mesoapi','meso'] and indextime is not None:  ltst = localtime ( interv[0]+indextime*interv[1], 0.5*(wlon[0]+wlon[1]) )  
+       if typefile in ['meso'] and indextime is not None:  ltst = localtime ( interv[0]+indextime*interv[1], 0.5*(wlon[0]+wlon[1]) )  
        print "********** INDEX LON:",indexlon," LAT:",indexlat," VERT:",indexvert," TIME:",indextime
        ##var = nc.variables["phisinit"][:,:]
@@ -443,5 +441,5 @@
                             m = define_proj(proj,wlon,wlat,back=back,blat=blat,blon=blon)  ## this is dirty, defined above but out of imov loop
                             x, y = m(lon2d, lat2d)                                         ## this is dirty, defined above but out of imov loop
-                    if typefile in ['mesoapi','meso'] and mapmode == 1:   what_I_plot_frame = dumpbdy(what_I_plot_frame,6,condition=True)
+                    if typefile in ['meso'] and mapmode == 1:   what_I_plot_frame = dumpbdy(what_I_plot_frame,6,condition=True)
 #                   if typefile in ['mesoideal']:    what_I_plot_frame = dumpbdy(what_I_plot_frame,0,stag='W',condition=dumped_vert_stag)
 
@@ -471,4 +469,5 @@
                             #zelevels = np.linspace(zevmin*(1. + 1.e-7),zevmax*(1. - 1.e-7)) #,num=20)
                             zelevels = np.linspace(zevmin,zevmax,num=ticks)
+                            #what_I_plot_frame = smooth(what_I_plot_frame,100)
                             if mapmode == 1:       m.contourf( x, y, what_I_plot_frame, zelevels, cmap = palette, alpha=trans)
                             elif mapmode == 0:     contourf( x, y, what_I_plot_frame, zelevels, cmap = palette, alpha=trans)
@@ -487,10 +486,10 @@
                             if zeorientation == "horizontal" and zetitle != "fill": zecb.ax.set_xlabel(zetitle) ; zetitle=""
                         if winds:
-                            if typefile in ['mesoapi','meso']:
+                            if typefile in ['meso']:
                                 [vecx_frame,vecy_frame] = [dumpbdy(vecx_frame,6,stag=uchar,condition=True), dumpbdy(vecy_frame,6,stag=vchar,condition=True)]
                                 key = True
                             elif typefile in ['gcm']:
                                 key = False
-                            if metwind:  [vecx_frame,vecy_frame] = m.rotate_vector(vecx_frame, vecy_frame, lon2d, lat2d)
+                            if metwind and mapmode == 1:   [vecx_frame,vecy_frame] = m.rotate_vector(vecx_frame, vecy_frame, lon2d, lat2d)
                             if var:       colorvec = definecolorvec(back)
                             else:         colorvec = definecolorvec(colorb)
@@ -559,5 +558,5 @@
            basename = basename + getstralt(nc,level) 
        if mrate is not None: basename = "movie_" + basename 
-       if typefile in ['mesoapi','meso']:
+       if typefile in ['meso']:
             if slon is not None: basename = basename + "_lon_" + str(int(round(lonp)))
             if slat is not None: basename = basename + "_lat_" + str(int(round(latp)))
@@ -598,5 +597,5 @@
     ### Save the figure in a file in the data folder or an user-defined folder
     if outputname is None:
-       if typefile in ['meso','mesoapi']:   prefix = getprefix(nc)
+       if typefile in ['meso']:   prefix = getprefix(nc)
        elif typefile in ['gcm']:            prefix = 'LMD_GCM_'
        else:                                prefix = ''
