Index: trunk/UTIL/PYTHON/planetoplot_v2/pp.py
===================================================================
--- trunk/UTIL/PYTHON/planetoplot_v2/pp.py	(revision 989)
+++ trunk/UTIL/PYTHON/planetoplot_v2/pp.py	(revision 990)
@@ -55,4 +55,5 @@
 parser.add_option('-s','--changetime',action='store',dest='changetime',type="string",default=None,\
                   help="transformation on time axis : [None] | mars_sol2ls | mars_meso_ls | mars_meso_sol | mars_meso_utc | mars_meso_lt ")
+parser.add_option('-p','--print',action='store_true',dest='savtxt',default=False,help="[1D] output field+coord in an ASCII file")
 parser.add_option('--stridex',action='store',dest='stridex',type="int",default=1,help="Load data every stridex grid points over x dimension")
 parser.add_option('--stridey',action='store',dest='stridey',type="int",default=1,help="Load data every stridex grid points over y dimension")
@@ -138,4 +139,5 @@
 user.stridevecx = opt.stridevecx
 user.stridevecy = opt.stridevecy
+user.savtxt = opt.savtxt
 # define field
 user.define()
Index: trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
===================================================================
--- trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 989)
+++ trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 990)
@@ -161,4 +161,5 @@
                       changetime=None,\
                       units=None,\
+                      savtxt=False,\
                       title=None):
         self.request = None
@@ -199,4 +200,5 @@
         self.includedate = includedate
         self.changetime = changetime
+        self.savtxt = savtxt
         ## here are user-defined plot settings 
         ## -- if not None, valid on all plots in the pp() objects
@@ -262,4 +264,5 @@
             self.includedate = other.includedate
             self.changetime = other.changetime
+            self.savtxt = other.savtxt
         else:
             print "!! ERROR !! argument must be a pp object." ; exit()
@@ -943,4 +946,9 @@
             # finally make the plot
             pl.make()
+            # possibly print results in a text file
+            if self.savtxt:
+                if self.verbose: print "**** Printing results in a text file"
+                name = pl.var + "%04d" % self.n
+                ppplot.writeascii(field=pl.field,absc=pl.absc,name=name) 
             # increment plot count (and propagate this in plotin)
             self.n = self.n+1
@@ -1299,6 +1307,15 @@
             self.name_z = "z grid points"
           else:
-            self.field_z = self.f.variables[self.name_z][:] # specify dimension
-                                                            # TBD: have to check that this is not a 3D field
+            tabalt = self.f.variables[self.name_z]
+            # (consider the case where tabtime is not dim 1) TBD: 2D and 3D cases
+            if tabalt.ndim == 4: 
+                try:
+                    self.field_z = tabalt[1,:,0,0] # 4D case. alt is usually third dimension.
+                                                   # 1 for time to avoid initial 0s
+                except:
+                    self.field_z = tabalt[0,:,0,0]
+                if self.verbose: print "!! WARNING !! "+self.name_z+" is 4D var. We made it 1D."
+            else: 
+                self.field_z = self.f.variables[self.name_z][:] # specify dimension
           if self.dim_z > 1: 
                if self.verbose: print "**** OK. z axis %4.0f values [%5.1f,%5.1f]" % (self.dim_z,self.field_z.min(),self.field_z.max())
Index: trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py
===================================================================
--- trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py	(revision 989)
+++ trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py	(revision 990)
@@ -247,4 +247,29 @@
     what_I_plot[ what_I_plot > zevmax ] = zevmax*(1.-small_enough)
     return what_I_plot
+
+# a function to output an ascii file
+# ----------------------------------
+def writeascii (field=None,absc=None,name=None):
+    if name is None:
+        name = "prof"
+        for ttt in timelib.gmtime():
+            name = name + "_" + str(ttt)
+    if field is None or absc is None:
+        print "!! WARNING !! Not printing the file, incorrect field or absc."
+    else:
+        if field.ndim == 1:
+            myfile = open(name, 'w')
+            for ix in range(len(absc)):
+                myfile.write("%15.5e%15.5e\n" % ( absc[ix], field[ix] ))
+            myfile.close()
+        else:
+            print "!! WARNING !! Not printing the file, 2D fields not supported yet."
+#    mydata = np.transpose([absc,np.transpose(field)]) #tab
+#    for line in mydata:
+#        zeline = str(line)
+#        zeline = zeline.replace('[','')
+#        zeline = zeline.replace(']','')
+#        myfile.write(zeline + '\n')
+    return
 
 # a generic function to show (GUI) or save a plot (PNG,EPS,PDF,...)
Index: trunk/UTIL/PYTHON/planetoplot_v2/set_ppclass.txt
===================================================================
--- trunk/UTIL/PYTHON/planetoplot_v2/set_ppclass.txt	(revision 989)
+++ trunk/UTIL/PYTHON/planetoplot_v2/set_ppclass.txt	(revision 990)
@@ -10,5 +10,5 @@
   # z-axis: possible names to search for. add in the line with a separating ;
   #
-altitude;Alt;vert;presnivs;bottom_top;altitude_abg;lev
+altitude;Alt;vert;presnivs;bottom_top;altitude_abg;lev;PTOT
   # t-axis: possible names to search for. add in the line with a separating ;
   #
Index: trunk/UTIL/PYTHON/planetoplot_v2/set_var.txt
===================================================================
--- trunk/UTIL/PYTHON/planetoplot_v2/set_var.txt	(revision 989)
+++ trunk/UTIL/PYTHON/planetoplot_v2/set_var.txt	(revision 990)
@@ -13,4 +13,5 @@
 VM ; %.1f ; jet ; Meridional wind ; m s$^{-1}$
 W ; %.2f ; jet ; Vertical wind ; m s$^{-1}$
+U025 ; %.1f ; jet ; Wind speed 25cm above the surface ; m s$^{-1}$
 WIND ; %.0f ; YlOrRd ; Wind speed ; m s$^{-1}$
 UV ; %.0f ; YlOrRd ; Wind speed ; m s$^{-1}$
