Index: trunk/UTIL/PYTHON/mcd/gale.py
===================================================================
--- trunk/UTIL/PYTHON/mcd/gale.py	(revision 795)
+++ trunk/UTIL/PYTHON/mcd/gale.py	(revision 796)
@@ -45,3 +45,3 @@
 import matplotlib.pyplot as mpl
 #mpl.show()
-mpl.savefig("img/temp.png",dpi=110,bbox_inches='tight',pad_inches=0.4)
+mpl.savefig("temp.png",dpi=110,bbox_inches='tight',pad_inches=0.4)
Index: trunk/UTIL/PYTHON/mcd/mcd.py
===================================================================
--- trunk/UTIL/PYTHON/mcd/mcd.py	(revision 795)
+++ trunk/UTIL/PYTHON/mcd/mcd.py	(revision 796)
@@ -32,8 +32,16 @@
         ## 1. spatio-temporal coordinates
         self.lat       = 0.
+        self.lats      = None
+        self.late      = None
         self.lon       = 0.
+        self.lons      = None
+        self.lone      = None
         self.loct      = 0.
+        self.locts     = None
+        self.locte     = None
         self.xdate     = 0.  # see datekey
         self.xz        = 10. # see zkey
+        self.xzs       = None
+        self.xze       = None
         ## 1bis. related settings
         self.zkey      = 3  # specify that xz is the altitude above surface (m)
@@ -177,5 +185,9 @@
     def getnameset(self):
     # set a name referring to settings [convenient for databases]
-        name = str(self.zkey)+str(self.xz)+str(self.lon)+str(self.lat)+str(self.hrkey)+str(self.datekey)+str(self.xdate)+str(self.loct)+str(self.dust)
+        strlat = str(self.lat)+str(self.lats)+str(self.late)
+        strlon = str(self.lon)+str(self.lons)+str(self.lone)
+        strxz = str(self.xz)+str(self.xzs)+str(self.xze)
+        strloct = str(self.loct)+str(self.locts)+str(self.locte)
+        name = str(self.zkey)+strxz+strlon+strlat+str(self.hrkey)+str(self.datekey)+str(self.xdate)+strloct+str(self.dust)
         return name
 
@@ -257,29 +269,49 @@
       self.extvartab[i,1:100] = self.extvar[0:99] ## note: var numbering according to MCD manual is kept
 
-    def diurnal(self,nd=13,start=0.,end=24.):
+    def diurnal(self,nd=13):
     ### retrieve a local time slice
       self.xlabel = "Local time (Martian hour)"
-      self.prepare(ndx=nd) ; self.xcoord = np.linspace(start,end,nd)
+      self.prepare(ndx=nd) 
+      if self.locts is not None and self.locte is not None:
+          if self.locts > self.locte: yeah = self.locts ; self.locts = self.locte ; self.locte = yeah
+          self.xcoord = np.linspace(self.locts,self.locte,nd)
+      else:
+          self.xcoord = np.linspace(0.,24.,nd)
       for i in range(nd): self.loct = self.xcoord[i] ; self.update() ; self.put1d(i)
 
-    def zonal(self,nd=37,start=-180.,end=180.):
+    def zonal(self,nd=37):
     ### retrieve a longitude slice
       self.xlabel = "East longitude (degrees)"
-      self.prepare(ndx=nd) ; self.xcoord = np.linspace(start,end,nd)
+      self.prepare(ndx=nd) 
+      if self.lons is not None and self.lone is not None:
+          if self.lons > self.lone: yeah = self.lons ; self.lons = self.lone ; self.lone = yeah
+          self.xcoord = np.linspace(self.lons,self.lone,nd)
+      else:
+          self.xcoord = np.linspace(-180.,180.,nd)
       for i in range(nd): self.lon = self.xcoord[i] ; self.update() ; self.put1d(i)
 
-    def meridional(self,nd=19,start=-90.,end=90.):
+    def meridional(self,nd=19):
     ### retrieve a latitude slice
       self.xlabel = "North latitude (degrees)"
-      self.prepare(ndx=nd) ; self.xcoord = np.linspace(start,end,nd)
+      self.prepare(ndx=nd)
+      if self.lats is not None and self.late is not None: 
+          if self.lats > self.late: yeah = self.lats ; self.lats = self.late ; self.late = yeah
+          self.xcoord = np.linspace(self.lats,self.late,nd)
+      else:                                               
+          self.xcoord = np.linspace(-90.,90.,nd)
       for i in range(nd): self.lat = self.xcoord[i] ; self.update() ; self.put1d(i)
 
-    def profile(self,nd=20,start=0.,end=120000.,tabperso=None):
+    def profile(self,nd=20,tabperso=None):
     ### retrieve an altitude slice (profile)
       self.xlabel = "Altitude (m)"
       if tabperso is not None: nd = len(tabperso)
       self.prepare(ndx=nd) 
-      if tabperso is None:  self.xcoord = np.linspace(start,end,nd)
-      else:                 self.xcoord = tabperso
+      if tabperso is not None:
+          self.xcoord = tabperso
+      elif self.xzs is not None and self.xze is not None:
+          ## here we should code the log axis for pressure
+          self.xcoord = np.linspace(self.xzs,self.xze,nd)
+      else:
+          self.xcoord = np.linspace(0.,120000.,nd)
       for i in range(nd): self.xz = self.xcoord[i] ; self.update() ; self.put1d(i)
 
@@ -332,10 +364,19 @@
 ###################
 
-    def latlon(self,ndx=37,startx=-180.,endx=180.,ndy=19,starty=-90.,endy=90.,fixedlt=False):
+    def latlon(self,ndx=37,ndy=19,fixedlt=False):
     ### retrieve a latitude/longitude slice
     ### default is: local time is not fixed. user-defined local time is at longitude 0.
       self.xlabel = "East longitude (degrees)" ; self.ylabel = "North latitude (degrees)"
       self.prepare(ndx=ndx,ndy=ndy)
-      self.xcoord = np.linspace(startx,endx,ndx) ; self.ycoord = np.linspace(starty,endy,ndy)
+      if self.lons is not None and self.lone is not None:
+          if self.lons > self.lone: yeah = self.lons ; self.lons = self.lone ; self.lone = yeah
+          self.xcoord = np.linspace(self.lons,self.lone,ndx)
+      else:
+          self.xcoord = np.linspace(-180.,180.,ndx)
+      if self.lats is not None and self.late is not None:
+          if self.lats > self.late: yeah = self.lats ; self.lats = self.late ; self.late = yeah
+          self.ycoord = np.linspace(self.lats,self.late,ndy)
+      else:
+          self.ycoord = np.linspace(-90.,90.,ndy)
       if not fixedlt: umst = self.loct
       for i in range(ndx):
@@ -355,17 +396,20 @@
       self.extvartab[i,j,1:100] = self.extvar[0:99] ## note: var numbering according to MCD manual is kept
 
-    def makemap2d(self,choice,incwind=False,fixedlt=False):
+    def makemap2d(self,choice,incwind=False,fixedlt=False,proj="cyl"):
     ### one 2D map is created for the user-defined variable in choice.
       self.latlon(fixedlt=fixedlt) ## a map is implicitely a lat-lon plot. otherwise it is a plot (cf. makeplot2d)
-      (field, fieldlab) = self.definefield(choice)
-      if incwind:
+      if choice == "wind" or incwind:
           (windx, fieldlabwx) = self.definefield("u")
           (windy, fieldlabwy) = self.definefield("v")
-          myplot.maplatlon(self.xcoord,self.ycoord,field,title=fieldlab,proj="cyl",vecx=windx,vecy=windy)
-      else:
-          myplot.maplatlon(self.xcoord,self.ycoord,field,title=fieldlab,proj="moll")
+      if choice == "wind":
+          field = np.sqrt(windx*windx + windy*windy)
+          fieldlab = "Horizontal wind speed (m/s)"
+      else:    
+          (field, fieldlab) = self.definefield(choice)
+      if incwind:   myplot.maplatlon(self.xcoord,self.ycoord,field,title=fieldlab,proj=proj,vecx=windx,vecy=windy) #,stride=1)
+      else:         myplot.maplatlon(self.xcoord,self.ycoord,field,title=fieldlab,proj=proj)
       mpl.figtext(0.5, 0.0, "Mars Climate Database (c) LMD/OU/IAA/ESA/CNES", ha='center')
 
-    def map2d(self,tabtodo,incwind=False,fixedlt=False):
+    def map2d(self,tabtodo,incwind=False,fixedlt=False,proj="cyl"):
     ### complete 2D figure with possible multiplots
       if isinstance(tabtodo,np.str): tabtodo=[tabtodo] ## so that asking one element without [] is possible.
@@ -373,7 +417,7 @@
       fig = mpl.figure()
       subv,subh = myplot.definesubplot( len(tabtodo) , fig ) 
-      for i in range(len(tabtodo)): mpl.subplot(subv,subh,i+1) ; self.makemap2d(tabtodo[i],incwind=incwind,fixedlt=fixedlt)
-
-    def htmlmap2d(self,tabtodo,incwind=False,fixedlt=False,figname="temp.png"):
+      for i in range(len(tabtodo)): mpl.subplot(subv,subh,i+1) ; self.makemap2d(tabtodo[i],incwind=incwind,fixedlt=fixedlt,proj=proj)
+
+    def htmlmap2d(self,tabtodo,incwind=False,fixedlt=False,figname="temp.png",title=""):
     ### complete 2D figure with possible multiplots
     ### added in 09/2012 for online MCD
@@ -392,5 +436,6 @@
         yeah = fig.add_subplot(subv,subh,i+1)
         choice = tabtodo[i]
-        self.latlon(fixedlt=fixedlt) ## a map is implicitely a lat-lon plot. otherwise it is a plot (cf. makeplot2d)
+        self.latlon(fixedlt=fixedlt) 
+        ## a map is implicitely a lat-lon plot. otherwise it is a plot (cf. makeplot2d)
         (field, fieldlab) = self.definefield(choice)
         if incwind: (windx, fieldlabwx) = self.definefield("u") ; (windy, fieldlabwy) = self.definefield("v")
@@ -428,9 +473,10 @@
         Figure.colorbar(fig,c,orientation='vertical',format="%.1e")
         ax = fig.gca() ; ax.set_title(fieldlab) ; ax.set_ylabel("Latitude") ; ax.set_xlabel("Longitude")
-        ax.set_xticks(np.arange(-180,181,45)) ; ax.set_xbound(lower=-180, upper=180)
-        ax.set_yticks(np.arange(-90,91,30)) ; ax.set_ybound(lower=-90, upper=90)
+        ax.set_xticks(np.arange(-180,181,45)) ; ax.set_xbound(lower=self.lons, upper=self.lone)
+        ax.set_yticks(np.arange(-90,91,30)) ; ax.set_ybound(lower=self.lats, upper=self.late)
         if incwind:
           [x2d,y2d] = np.meshgrid(x,y)
           yeah.quiver(x2d,y2d,np.transpose(windx),np.transpose(windy))
+      fig.text(0.5, 0.95, title, ha='center')
       fig.text(0.5, 0.01, "Mars Climate Database (c) LMD/OU/IAA/ESA/CNES", ha='center')
       canvas = FigureCanvasAgg(fig)
Index: trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py
===================================================================
--- trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py	(revision 795)
+++ trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py	(revision 796)
@@ -1,2 +1,3 @@
+###!/usr/bin/env python
 #!/usr/bin/python
 ###!/home/aymeric/Software/epd-7.0-2-rh5-x86/bin/python
@@ -12,4 +13,5 @@
 ##################################################
 ### ajouts et corrections par Franck Guyon 09/2012
+### ajouts suite a brainstorm equipe AS 10/2012
 
 import cgi, cgitb 
@@ -36,22 +38,30 @@
 # Get data from user-defined fields and define free dimensions
 # FG: add tests if var==None to have values in local without forms ones
+query.lat = -9999.
 getlat = form.getvalue("latitude")
-if getlat == None: getlat = 1
-if getlat == "all":  islatfree = 1 ; query.lat = -9999.
+if getlat == None: getlat = "1"
+if getlat == "all":  islatfree = 1 ; query.lats = -90. ; query.late = 90.
+elif ";" in getlat:  islatfree = 1 ; ind = getlat.find(";") ; query.lats = float(getlat[:ind]) ; query.late = float(getlat[ind+1:])
 else:                islatfree = 0 ; query.lat = float(getlat)
 
+query.lon = -9999.
 getlon = form.getvalue("longitude")
-if getlon == None: getlon = 1
-if getlon == "all":  islonfree = 1 ; query.lon = -9999.
+if getlon == None: getlon = "1"
+if getlon == "all":  islonfree = 1 ; query.lons = -180. ; query.lone = 180.
+elif ";" in getlon:  islonfree = 1 ; ind = getlon.find(";") ; query.lons = float(getlon[:ind]) ; query.lone = float(getlon[ind+1:])
 else:                islonfree = 0 ; query.lon = float(getlon)
 
+query.loct = -9999.
 getloct = form.getvalue("localtime")
-if getloct == None: getloct = 1
-if getloct == "all": isloctfree = 1 ; query.loct = -9999.
+if getloct == None: getloct = "1"
+if getloct == "all": isloctfree = 1 ; query.locts = 0. ; query.locte = 24.
+elif ";" in getloct: isloctfree = 1 ; ind = getloct.find(";") ; query.locts = float(getloct[:ind]) ; query.locte = float(getloct[ind+1:])
 else:                isloctfree = 0 ; query.loct = float(getloct)
 
+query.xz = -9999.
 getalt = form.getvalue("altitude")
-if getalt == None: getalt = 1
-if getalt == "all":  isaltfree = 1 ; query.xz = -9999.
+if getalt == None: getalt = "1"
+if getalt == "all":  isaltfree = 1 ; query.xzs = 0. ; query.xze = 120000.
+elif ";" in getalt:  isaltfree = 1 ; ind = getalt.find(";") ; query.xzs = float(getalt[:ind]) ; query.xze = float(getalt[ind+1:])
 else:                isaltfree = 0 ; query.xz = float(getalt)
 
@@ -96,5 +106,5 @@
 
 # reference name (to test which figures are already in the database)
-reference = str(islatfree)+str(islonfree)+str(isloctfree)+str(isaltfree)+query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)
+reference = query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)
 figname = '../img/'+reference+'.png'
 
@@ -127,5 +137,6 @@
 
     ### figure    
-    query.htmlmap2d(vartoplot,incwind=iswindlog,fixedlt=input_fixedlt,figname=figname) 
+    zetitle = "MCD v4.3 - Dust scenario "+str(query.dust)+" - Date is "+str(query.xdate)
+    query.htmlmap2d(vartoplot,incwind=iswindlog,fixedlt=input_fixedlt,figname=figname,title=zetitle) 
     #mpl.savefig("img/temp.png",dpi=110,bbox_inches='tight',pad_inches=0.4)
     #Image.open("img/temp.png").save(figname,'JPEG') ##lighter images   
Index: trunk/UTIL/PYTHON/mcd/proto/index.html
===================================================================
--- trunk/UTIL/PYTHON/mcd/proto/index.html	(revision 795)
+++ trunk/UTIL/PYTHON/mcd/proto/index.html	(revision 796)
@@ -96,9 +96,10 @@
 <td align="center">
 <b>CUSTOMIZE COORDINATES ON MARS</b><br />
+please give: a value (or) a range val1;val2 (or) 'all'<br />
 <ul>
-<li>Latitude <input type="text" size="3" name="latitude" value="0."> (write a value or 'all')
-<li>Longitude <input type="text" size="3" name="longitude" value="0."> (write a value or 'all')
-<li>Local Time <input type="text" size="2" name="localtime" value="0."> (write a value or 'all')
-<li>Altitude (m) <input type="text" size="3" name="altitude" value="10."> (write a value or 'all')
+<li>North Latitude <input type="text" size="7" name="latitude" value="0."> 
+<li>East Longitude <input type="text" size="7" name="longitude" value="0."> 
+<li>Local Time <input type="text" size="7" name="localtime" value="0."> 
+<li>Altitude (m) <input type="text" size="7" name="altitude" value="10."> 
 <!--
 <li>Latitude   
Index: trunk/UTIL/PYTHON/myplot.py
===================================================================
--- trunk/UTIL/PYTHON/myplot.py	(revision 795)
+++ trunk/UTIL/PYTHON/myplot.py	(revision 796)
@@ -1419,5 +1419,6 @@
     elif numdim == 1:	[lon2d,lat2d] = np.meshgrid(lon,lat)
     else:               errormess("lon and lat arrays must be 1D or 2D")
-    [wlon,wlat] = latinterv()
+    #[wlon,wlat] = latinterv()
+    [wlon,wlat] = simplinterv(lon2d,lat2d)
     ## define projection and background. define x and y given the projection
     m = define_proj(proj,wlon,wlat,back=zeback,blat=None,blon=None)
