Index: trunk/UTIL/PYTHON/mcd/exampleascii.py
===================================================================
--- trunk/UTIL/PYTHON/mcd/exampleascii.py	(revision 811)
+++ trunk/UTIL/PYTHON/mcd/exampleascii.py	(revision 811)
@@ -0,0 +1,14 @@
+#! /usr/bin/python
+
+from mcd import mcd
+
+
+yeah = mcd()
+
+yeah.diurnal()
+yeah.getascii(["u","t"],filename="diurnal.txt")
+
+
+yeah.zonal()
+yeah.getascii(["u","t"],filename="zonal.txt")
+
Index: trunk/UTIL/PYTHON/mcd/mcd.py
===================================================================
--- trunk/UTIL/PYTHON/mcd/mcd.py	(revision 808)
+++ trunk/UTIL/PYTHON/mcd/mcd.py	(revision 811)
@@ -200,4 +200,18 @@
     def update(self):
     # retrieve fields from MCD (call_mcd). more info in fmcd.call_mcd.__doc__
+        ## sanity first
+        self.loct = abs(self.loct)%24
+        if self.locts is not None and self.locte is not None: 
+            self.locts = abs(self.locts)%24
+            self.locte = abs(self.locte)%24
+            if self.locts == self.locte: self.locte = self.locts + 24
+        if self.lat > 90.: self.lat = 90.
+        if self.lat < -90.: self.lat = -90.
+        if self.lats is not None and self.late is not None:
+            if abs(self.lats) > 90.: self.lats = 90.
+            if abs(self.late) > 90.: self.late = 90.
+            if abs(self.lats) < -90.: self.lats = -90.
+            if abs(self.late) < -90.: self.late = -90.
+        ## now MCD request
         (self.pres, self.dens, self.temp, self.zonwind, self.merwind, \
          self.meanvar, self.extvar, self.seedout, self.ierr) \
@@ -388,4 +402,21 @@
       for i in range(nd): self.xdate = self.xcoord[i] ; self.update() ; self.put1d(i)
       self.xdate = save
+
+    def getascii(self,tabtodo,filename="output.txt"):
+    ### print out values in an ascii file
+      if isinstance(tabtodo,np.str): tabtodo=[tabtodo] ## so that asking one element without [] is possible.
+      if isinstance(tabtodo,np.int): tabtodo=[tabtodo] ## so that asking one element without [] is possible.
+      asciifile = open(filename, "w")
+      for i in range(len(tabtodo)):  
+          (field, fieldlab) = self.definefield(tabtodo[i])
+          self.gettitle()
+          asciifile.write("### " + self.title + "\n")
+          asciifile.write("### " + self.ack + "\n")
+          asciifile.write("### Column 1 is " + self.xlabel + "\n")
+          asciifile.write("### Column 2 is " + fieldlab + "\n")
+          for ix in range(len(self.xcoord)):
+              asciifile.write("%15.5e%15.5e\n" % ( self.xcoord[ix], field[ix] ) )
+      asciifile.close()
+      return 
 
     def makeplot1d(self,choice):
@@ -423,4 +454,9 @@
         ax = fig.gca() ; ax.set_ylabel(ordolab) ; ax.set_xlabel(absclab)
         if self.zkey == 4: ax.set_yscale('log') ; ax.set_ylim(ax.get_ylim()[::-1])
+
+        if self.lats is not None:      ax.set_xticks(np.arange(-90,91,15)) ; ax.set_xbound(lower=self.lats, upper=self.late)
+        elif self.lons is not None:    ax.set_xticks(np.arange(-360,361,30)) ; ax.set_xbound(lower=self.lons, upper=self.lone)
+        elif self.locts is not None:   ax.set_xticks(np.arange(0,26,2)) ; ax.set_xbound(lower=self.locts, upper=self.locte)
+
       self.gettitle()
       fig.text(0.5, 0.95, self.title, ha='center')
@@ -529,4 +565,5 @@
       from matplotlib.backends.backend_agg import FigureCanvasAgg
       from matplotlib.cm import get_cmap
+      from matplotlib import rcParams 
 
       #from mpl_toolkits.basemap import Basemap
@@ -554,5 +591,5 @@
         yeah = fig.add_subplot(subv,subh,i+1)
         choice = tabtodo[i]
-        self.latlon(fixedlt=fixedlt) 
+        self.latlon(fixedlt=fixedlt,ndx=64,ndy=48) 
         ## a map is implicitely a lat-lon plot. otherwise it is a plot (cf. makeplot2d)
         (field, fieldlab) = self.definefield(choice)
@@ -584,17 +621,21 @@
         palette = get_cmap(name=colorb)
 
+        # You can set negative contours to be solid instead of dashed:
+        rcParams['contour.negative_linestyle'] = 'solid'
         ## contours topo
         zelevc = np.linspace(-9.,20.,11)
         yeah.contour( xc, yc, fieldc, zelevc, colors='black',linewidths = 0.4)
+        yeah.contour( np.array(xc) + 360., yc, fieldc, zelevc, colors='black',linewidths = 0.4)
+        yeah.contour( np.array(xc) - 360., yc, fieldc, zelevc, colors='black',linewidths = 0.4)
         # contour field
         c = yeah.contourf( x, y, what_I_plot, zelevels, cmap = palette, alpha = trans )
         clb = Figure.colorbar(fig,c,orientation='vertical',format="%.2e",ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,21])))
         clb.set_label(fieldlab)
-        ax = fig.gca() ; ax.set_ylabel("Latitude") ; ax.set_xlabel("Longitude")
-        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))
+        ax = fig.gca() ; ax.set_ylabel("Latitude") ; ax.set_xlabel("Longitude")
+        ax.set_xticks(np.arange(-360,361,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)
       self.gettitle()
       fig.text(0.5, 0.95, self.title, ha='center')
@@ -640,8 +681,13 @@
         clb.set_label(fieldlab)
         ax = fig.gca() ; ax.set_ylabel(self.ylabel) ; ax.set_xlabel(self.xlabel)
-        if self.zkey == 4: ax.set_yscale('log') ; ax.set_ylim(ax.get_ylim()[::-1])
-
-        #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 self.zkey == 4: 
+            ax.set_yscale('log') ; ax.set_ylim(ax.get_ylim()[::-1])
+        else:
+            #ax.set_yticks(np.arange(self.xzs,self.xze,10000.)) ; 
+            ax.set_ybound(lower=self.xzs, upper=self.xze)
+
+        if self.lons is not None: ax.set_xticks(np.arange(-360,361,45)) ; ax.set_xbound(lower=self.lons, upper=self.lone)
+        elif self.lats is not None: ax.set_xticks(np.arange(-90,91,30)) ; ax.set_xbound(lower=self.lats, upper=self.late)
 
       self.gettitle()
Index: trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py
===================================================================
--- trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py	(revision 808)
+++ trunk/UTIL/PYTHON/mcd/proto/cgi-bin/mcdcgi.py	(revision 811)
@@ -43,4 +43,6 @@
 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:])
+elif "," in getlat:  islatfree = 1 ; ind = getlat.find(",") ; query.lats = float(getlat[:ind]) ; query.late = float(getlat[ind+1:])
+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)
 
@@ -50,4 +52,6 @@
 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:])
+elif "," in getlon:  islonfree = 1 ; ind = getlon.find(",") ; query.lons = float(getlon[:ind]) ; query.lone = float(getlon[ind+1:])
+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)
 
@@ -57,4 +61,6 @@
 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:])
+elif "," in getloct: isloctfree = 1 ; ind = getloct.find(",") ; query.locts = float(getloct[:ind]) ; query.locte = float(getloct[ind+1:])
+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)
 
@@ -73,4 +79,6 @@
     elif query.zkey == 1:  query.xzs = 3396000. ; query.xze = 3596000.
 elif ";" in getalt:  isaltfree = 1 ; ind = getalt.find(";") ; query.xzs = float(getalt[:ind]) ; query.xze = float(getalt[ind+1:])
+elif "," in getalt:  isaltfree = 1 ; ind = getalt.find(",") ; query.xzs = float(getalt[:ind]) ; query.xze = float(getalt[ind+1:])
+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)
 
@@ -124,4 +132,5 @@
 reference = query.getnameset()+str(var1)+str(var2)+str(var3)+str(var4)+str(iswind)+str(isfixedlt)
 figname = '../img/'+reference+'.png'
+txtname = '../txt/'+reference
 testexist = daos.path.isfile(figname)
 
@@ -133,5 +142,5 @@
 
     ### getting data
-    if isloctfree == 1:  	query.diurnal(nd=24)
+    if isloctfree == 1:  	query.diurnal(nd=24) 
     elif islonfree == 1: 	query.zonal()
     elif islatfree == 1: 	query.meridional()
@@ -140,4 +149,5 @@
 
     ### generic building of figure
+    query.getascii(vartoplot,filename=txtname)
     query.htmlplot1d(vartoplot,figname=figname)
     #mpl.savefig("img/temp.png",dpi=85,bbox_inches='tight',pad_inches=0.25)
@@ -178,5 +188,8 @@
 ## Now the part which differs
 if sumfree == 0: 	query.update() ; query.htmlprinttabextvar(vartoplot)  #query.printmeanvar()
-elif sumfree >= 1: 	print "<img src='"+figname+"'><br />"
+elif sumfree == 2: 	print "<img src='"+figname+"'><br />"
+elif sumfree == 1:      
+    print "<a href='"+txtname+"'>Click here to download an ASCII file containing data</a><br />"
+    print "<img src='"+figname+"'><br />"
 else:			print "<h1>ERROR : sumfree is not or badly defined ...</h1></body></html>"
 
