Index: /trunk/UTIL/PYTHON/planetoplot_v2/README.TXT
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot_v2/README.TXT	(revision 919)
+++ /trunk/UTIL/PYTHON/planetoplot_v2/README.TXT	(revision 920)
@@ -7,4 +7,5 @@
 Contents
 --------
+--------
 core
 ----
@@ -14,5 +15,5 @@
 scripts
 -------
-- pp.py --> command line utility to use ppclass
+- pp.py --> command line utility to use ppclass [HELP with 'pp.py -h']
 - pp_reload.py --> command line utility to load saved plot objects *.ppobj
 - example/* --> example scripts using ppclass
@@ -33,4 +34,5 @@
 Requirements
 ------------
+------------
 python + numpy + matplotlib + netCDF4
 - for mapping --> Basemap
@@ -40,4 +42,5 @@
 Installation
 ------------
+------------
 - install required softwares and librairies in requirements
 - add planetoplot_v2 in your PYTHONPATH environment variable (and in your PATH to use pp.py)
@@ -45,7 +48,9 @@
 Take a demo tour
 ----------------
+----------------
 pp_reload.py demo_data/*
 
 Improvements compared to v1
+---------------------------
 ---------------------------
 * code readability and structuration for future improvements
@@ -75,4 +80,5 @@
 Acknowledgements
 ----------------
+----------------
 Thanks to A. Colaitis, T. Navarro, J. Leconte
 for feedbacks and contributions on version 1
Index: /trunk/UTIL/PYTHON/planetoplot_v2/pp.py
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot_v2/pp.py	(revision 919)
+++ /trunk/UTIL/PYTHON/planetoplot_v2/pp.py	(revision 920)
@@ -20,40 +20,43 @@
 #####################################
 parser = OptionParser()
-parser.add_option('--verbose',action='store_true',dest='verbose',default=False,help='')
+parser.add_option('--verbose',action='store_true',dest='verbose',default=False,help='make the program verbose')
 # field --> lower case
-parser.add_option('-f','--file',action='append',dest='file',type="string",default=None,help='')
-parser.add_option('-v','--var',action='append',dest='var',type="string",default=None,help='')
-parser.add_option('-x','--lon',action='append',dest='x',type="string",default=None,help='')
-parser.add_option('-y','--lat',action='append',dest='y',type="string",default=None,help='')
-parser.add_option('-z','--vert',action='append',dest='z',type="string",default=None,help='')
-parser.add_option('-t','--time',action='append',dest='t',type="string",default=None,help='')
-parser.add_option('-c','--contour',action='store',dest='contour',type="string",default=None,help='')
-parser.add_option('-i','--vecx',action='store',dest='vecx',type="string",default=None,help='')
-parser.add_option('-j','--vecy',action='store',dest='vecy',type="string",default=None,help='')
-parser.add_option('-m','--mult',action='store',dest='mult',type="float",default=None,help='')
-parser.add_option('-a','--add',action='store',dest='add',type="float",default=None,help='')
-parser.add_option('-o','--output',action='store',dest='filename',type="string",default="myplot",help='')
-parser.add_option('-d','--directory',action='store',dest='folder',type="string",default="./",help='')
+parser.add_option('-f','--file',action='append',dest='file',type="string",default=None,help="[NEEDED] 'file' or ['file1','file2',etc]")
+parser.add_option('-v','--var',action='append',dest='var',type="string",default=None,help="'variable' or ['var1','var2',etc]")
+parser.add_option('-x','--lon',action='append',dest='x',type="string",default=None,help="x axis value. either one value; or val1,val2 (computations)")
+parser.add_option('-y','--lat',action='append',dest='y',type="string",default=None,help="y axis value. either one value; or val1,val2 (computations)")
+parser.add_option('-z','--vert',action='append',dest='z',type="string",default=None,help="z axis value. either one value; or val1,val2 (computations)")
+parser.add_option('-t','--time',action='append',dest='t',type="string",default=None,help="t axis value. either one value; or val1,val2 (computations)")
+parser.add_option('-u','--compute',action='store',dest='compute',type="string",default="mean",help="computation: mean, min, max")
+parser.add_option('-c','--contour',action='store',dest='contour',type="string",default=None,help="one 'variable' for contour")
+parser.add_option('-i','--vecx',action='store',dest='vecx',type="string",default=None,help="one 'variable' for wind vector x component")
+parser.add_option('-j','--vecy',action='store',dest='vecy',type="string",default=None,help="one 'variable' for wind vector x component")
+parser.add_option('-m','--mult',action='store',dest='mult',type="float",default=None,help="multiplicative factor on field")
+parser.add_option('-a','--add',action='store',dest='add',type="float",default=None,help="additive factor on field")
+parser.add_option('-o','--output',action='store',dest='filename',type="string",default="myplot",help="name of output files")
+parser.add_option('-d','--directory',action='store',dest='folder',type="string",default="./",help="directory of output files")
 # plot --> upper case
 # -- generic
-parser.add_option('-T','--title',action='append',dest='title',type="string",default=None,help='')
-parser.add_option('-X','--xlabel',action='append',dest='xlabel',type="string",default=None,help='')
-parser.add_option('-Y','--ylabel',action='append',dest='ylabel',type="string",default=None,help='')
-parser.add_option('-D','--div',action='store',dest='div',type="int",default=20,help='')
-parser.add_option('-H','--trans',action='store',dest='trans',type="float",default=1.0,help='')
-parser.add_option('-Z','--logy',action='store_true',dest='logy',default=False,help='')
-parser.add_option('-O','--save',action='store',dest='out',type="string",default="gui",help='')
+parser.add_option('-T','--title',action='append',dest='title',type="string",default=None,help="change 'title'")
+parser.add_option('-X','--xlabel',action='append',dest='xlabel',type="string",default=None,help="change 'xlabel'")
+parser.add_option('-Y','--ylabel',action='append',dest='ylabel',type="string",default=None,help="change 'ylabel'")
+parser.add_option('-D','--div',action='store',dest='div',type="int",default=20,help="integer for number of divisions")
+parser.add_option('-H','--trans',action='store',dest='trans',type="float",default=1.0,help="float for transparency (0=transp,1=opaque)")
+parser.add_option('-Z','--logy',action='store_true',dest='logy',default=False,help="set log for vertical axis")
+parser.add_option('-O','--save',action='store',dest='out',type="string",default="gui",help="save mode: 'gui' 'png' 'pdf' 'eps' 'svg' 'ps'")
 # -- 1D plot
-parser.add_option('-L','--lstyle',action='append',dest='lstyle',type="string",default=None,help='')
-parser.add_option('-S','--superpose',action='store_true',dest='superpose',default=False,help='')
+parser.add_option('-L','--lstyle',action='append',dest='lstyle',type="string",default=None,help="[1D] linestyle: '-' '--' '.' '..'")
+parser.add_option('-Q','--color',action='append',dest='color',type="string",default=None,help="[1D] color: 'b' 'g' 'r' etc")
+parser.add_option('-K','--marker',action='append',dest='marker',type="string",default=None,help="[1D] marker: '' 'x' 'o' etc")
+parser.add_option('-S','--superpose',action='store_true',dest='superpose',default=False,help="[1D] use same axis for all plots")
 # -- 2D plot
-parser.add_option('-C','--colorb',action='append',dest='colorb',type="string",default=None,help='')
-parser.add_option('-P','--proj',action='append',dest='proj',type="string",default=None,help='')
-parser.add_option('-B','--back',action='append',dest='back',type="string",default=None,help='')
-parser.add_option('-A','--area',action='append',dest='area',type="string",default=None,help='')
-parser.add_option('-I','--blon',action='append',dest='blon',type="float",default=None,help='')
-parser.add_option('-J','--blat',action='append',dest='blat',type="float",default=None,help='')
-parser.add_option('-N','--vmin',action='append',dest='vmin',type="float",default=None,help='')
-parser.add_option('-M','--vmax',action='append',dest='vmax',type="float",default=None,help='')
+parser.add_option('-C','--colorb',action='append',dest='colorb',type="string",default=None,help="[2D] colormap: http://micropore.files.wordpress.com/2010/06/colormaps.png")
+parser.add_option('-P','--proj',action='append',dest='proj',type="string",default=None,help="[2D] map projection: 'cyl' 'npstere' 'spstere' 'ortho' 'moll' 'robin' 'lcc' 'laea' 'merc'")
+parser.add_option('-B','--back',action='append',dest='back',type="string",default=None,help='[2D] predefined map background (cf. set_back.txt)')
+parser.add_option('-A','--area',action='append',dest='area',type="string",default=None,help='[2D] predefined region of mapping (cf. set_area.txt)')
+parser.add_option('-I','--blon',action='append',dest='blon',type="float",default=None,help='[2D] float: bounding longitude for stere (or center longitude for ortho)')
+parser.add_option('-J','--blat',action='append',dest='blat',type="float",default=None,help='[2D] float: bounding latitude for stere (or center latitude for ortho) ')
+parser.add_option('-N','--vmin',action='append',dest='vmin',type="float",default=None,help='[2D] float: minimum value for displayed field')
+parser.add_option('-M','--vmax',action='append',dest='vmax',type="float",default=None,help='[2D] float: maximum value for displayed field')
 (opt,args) = parser.parse_args()
 
@@ -78,7 +81,14 @@
     if opt.vecy is not None: var.append(opt.vecy) ; vargoal.append("vector")
 # set pp object
-user = pp(file=opt.file, var=var, vargoal=vargoal, \
-          x=opt.x, y=opt.y, z=opt.z, t=opt.t,\
-          verbose=opt.verbose)
+user = pp()
+user.file = opt.file
+user.var = var
+user.vargoal = vargoal
+user.x = opt.x
+user.y = opt.y
+user.z = opt.z
+user.t = opt.t
+user.verbose = opt.verbose
+user.compute = opt.compute
 # define field
 user.define()
@@ -105,4 +115,7 @@
 command = ""
 for arg in sys.argv: command = command + arg + ' '
-f = open(opt.filename+'.sh', 'w')
-f.write(command)
+try:
+    f = open(opt.folder+'/'+opt.filename+'.sh', 'w')
+    f.write(command)
+except IOError:
+    print "!! WARNING !! pp.py command not saved. Probably do not have permission to write here."
Index: /trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 919)
+++ /trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 920)
@@ -172,5 +172,8 @@
     # print status
     def printstatus(self):
-        print "**** Done step: " + self.status
+        if self.filename == "THIS_IS_A_CLONE":
+            pass
+        else:
+            print "**** Done step: " + self.status
 
     #####################################################
@@ -216,4 +219,5 @@
                setattr(the_clone,k,v)
         the_clone.verbose = False
+        the_clone.filename = "THIS_IS_A_CLONE" # trick to avoid additional outputs
         the_clone.define()
         for i in range(self.nfin):
@@ -511,5 +515,5 @@
         self.printstatus()
         # check if things were done OK before
-        if self.status != "defined": print "!! ERROR !! Please use .define() to define your pp object."
+        if self.status != "defined": print "!! ERROR !! Please use .define() to define your pp object." ; exit()
         ## first get fields
         ## ... only what is needed is extracted from the files
@@ -777,9 +781,13 @@
         if (self.n == self.howmanyplots): 
             ppplot.save(mode=self.out,filename=self.filename,folder=self.folder,custom=customplot)
+            mpl.close()
         # SAVE A PICKLE FILE WITH THE self.p ARRAY OF OBJECTS
         if self.verbose: print "**** Saving session in "+self.filename + ".ppobj"
         savfile = self.folder + "/" + self.filename + ".ppobj"
-        filehandler = open(savfile, 'w')
-        pickle.dump(self.p, filehandler)
+        try: 
+            filehandler = open(savfile, 'w')
+            pickle.dump(self.p, filehandler)
+        except IOError: 
+            print "!! WARNING !! Saved object file not written. Probably do not have permission to write here."
 
     ###########################################################
@@ -884,4 +892,14 @@
             except: 
                 try: self.p[iii].lstyle = opt.lstyle[0]
+                except: pass
+            ###
+            try: self.p[iii].color = opt.color[iii]
+            except:  
+                try: self.p[iii].color = opt.color[0]
+                except: pass
+            ###
+            try: self.p[iii].marker = opt.marker[iii]
+            except:  
+                try: self.p[iii].marker = opt.marker[0]
                 except: pass
             ###
Index: /trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py	(revision 919)
+++ /trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py	(revision 920)
@@ -202,4 +202,12 @@
        # special case: negative values with stddev while field is positive
        if zevmin < 0. and ppcompute.min(fieldcalc) > 0.: zevmin = 0.
+    # check that bounds are not too tight given the field
+    amin = ppcompute.min(field)
+    amax = ppcompute.max(field)
+    cmin = 100.*np.abs((amin - zevmin)/amin)
+    cmax = 100.*np.abs((amax - zevmax)/amax)
+    if cmin > 150. or cmax > 150.:
+        print "!! WARNING !! Bounds are a bit too tight. Might need to reconsider those."
+        print "!! WARNING !! --> actual",amin,amax,"adopted",zevmin,zevmax
     return zevmin, zevmax    
     #### treat vmin = vmax for continuity 
Index: /trunk/UTIL/PYTHON/planetoplot_v2/set_var.txt
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot_v2/set_var.txt	(revision 919)
+++ /trunk/UTIL/PYTHON/planetoplot_v2/set_var.txt	(revision 920)
@@ -57,2 +57,3 @@
 ASR ; %.0f ; gist_heat ; Absorbed Solar Radiation (W m$^{-2}$)
 ISR ; %.0f ; gist_heat ; Incoming Solar Radiation (W m$^{-2}$)
+SWDOWNZ ; %.0f ; gist_heat ; $\Phi^{SW}\downarrow$ (W m$^{-2}$)
