Index: trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
===================================================================
--- trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 942)
+++ trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 960)
@@ -25,4 +25,5 @@
 ###################################
 # where settings files are located...
+# ... this can be hardcoded here
 whereset = None
 whereset = ppcompute.findset(whereset)
@@ -39,5 +40,5 @@
     for stuff in lines[17].strip().split(';'): glob_listarea.append(stuff)
 except IOError: 
-    print "warning: "+zefile+" not in "+whereset+" ; no presets."
+    print "PPCLASS warning: "+zefile+" not in "+whereset+" ; no presets."
 
 ##################################
@@ -135,5 +136,7 @@
                       stridez=1,stridet=1,\
                       compute="mean",\
-                      verbose=False,noproj=False,\
+                      verbose=False,\
+                      quiet=False,\
+                      noproj=False,\
                       superpose=False,\
                       plotin=None,\
@@ -154,6 +157,8 @@
                       label=None,\
                       changetime=None,\
+                      units=None,\
                       title=None):
         self.request = None
+        self.nrequest = 0
         self.nfin = 0 ; self.nvin = 0
         self.nplotx = None ; self.nploty = None
@@ -165,5 +170,6 @@
         self.p = None
         self.customplot = False
-        self.allfield = None
+        self.f = None
+        self.l = None
         ## what could be defined by the user
         self.file = file
@@ -177,4 +183,5 @@
         self.compute = compute
         self.verbose = verbose
+        self.quiet = quiet
         self.noproj = noproj
         self.plotin = plotin
@@ -198,8 +205,10 @@
         self.color = color
         self.label = label
+        self.units = units
         self.title = title
 
     # print status
     def printstatus(self):
+      if not self.quiet:
         if self.filename == "THIS_IS_A_CLONE":
             pass
@@ -243,4 +252,5 @@
             self.color = other.color
             self.label = other.label
+            self.units = other.units
             self.title = other.title
             self.includedate = other.includedate
@@ -319,6 +329,8 @@
               if not isnum:   
                   ope = other.request[i][j][t][z][y][x].field
-                  if obj_ref.field.shape != ope.shape:
-                    print "!! ERROR !! The two fields for operation do not have the same shape.",self.field.shape,other.field.shape
+                  if ope.ndim == 0: 
+                    ope = float(ope) # if no dimension then this means that ope is a single value (not to be kept as an array)
+                  elif obj_ref.field.shape != ope.shape:
+                    print "!! ERROR !! The two fields for operation do not have the same shape.",obj_ref.field.shape,ope.shape
                     exit()
               else:           
@@ -347,6 +359,8 @@
               if not isnum:
                   ope = other.request[i][j][t][z][y][x].field
-                  if obj_ref.field.shape != ope.shape:
-                    print "!! ERROR !! The two fields for operation do not have the same shape.",self.field.shape,other.field.shape
+                  if ope.ndim == 0: 
+                    ope = float(ope) # if no dimension then this means that ope is a single value (not to be kept as an array)
+                  elif obj_ref.field.shape != ope.shape:
+                    print "!! ERROR !! The two fields for operation do not have the same shape.",obj_ref.field.shape,ope.shape
                     exit()
               else:
@@ -375,6 +389,8 @@
               if not isnum:
                   ope = other.request[i][j][t][z][y][x].field
-                  if obj_ref.field.shape != ope.shape:
-                    print "!! ERROR !! The two fields for operation do not have the same shape.",self.field.shape,other.field.shape
+                  if ope.ndim == 0: 
+                    ope = float(ope) # if no dimension then this means that ope is a single value (not to be kept as an array)
+                  elif obj_ref.field.shape != ope.shape:
+                    print "!! ERROR !! The two fields for operation do not have the same shape.",obj_ref.field.shape,ope.shape
                     exit()
               else:
@@ -403,6 +419,8 @@
               if not isnum:
                   ope = other.request[i][j][t][z][y][x].field
-                  if obj_ref.field.shape != ope.shape:
-                    print "!! ERROR !! The two fields for operation do not have the same shape.",self.field.shape,other.field.shape
+                  if ope.ndim == 0: 
+                    ope = float(ope) # if no dimension then this means that ope is a single value (not to be kept as an array)
+                  elif obj_ref.field.shape != ope.shape:
+                    print "!! ERROR !! The two fields for operation do not have the same shape.",obj_ref.field.shape,ope.shape
                     exit()
               else:
@@ -526,4 +544,6 @@
                        for z in range(self.nplotz)] for t in range(self.nplott)] \
                        for j in range(self.nvin)]   for i in range(self.nfin)] 
+        # store how many onerequest() objects are in self.request
+        self.nrequest = self.nfin*self.nvin*self.nplotx*self.nploty*self.nplotz*self.nplott
         # loop on onerequest() objects
         for i in range(self.nfin):
@@ -571,11 +591,10 @@
         # check if things were done OK before
         if self.status != "defined": print "!! ERROR !! Please use .define() to define your pp object." ; exit()
-        # create the list of allfield() objects
-        # --> so that the user can easily access values
-        self.allfield = [[[[[[ \
-                        [] \
-                        for x in range(self.nplotx)] for y in range(self.nploty)] \
-                        for z in range(self.nplotz)] for t in range(self.nplott)] \
-                        for j in range(self.nvin)]   for i in range(self.nfin)]
+        ## create the list of f() and l() objects
+        ## --> so that the user can easily access values (and labels for easy exploration)
+        ## --> see example easy_get_field
+        self.f = [ [] for iii in range(self.nrequest) ]
+        self.l = [ [] for iii in range(self.nrequest) ]
+        count = 0
         ## first get fields
         ## ... only what is needed is extracted from the files
@@ -590,5 +609,17 @@
               obj.getfield()
               obj.computations()
-              self.allfield[i][j][t][z][y][x] = obj.field
+              # save fields in self.f for the user
+              self.f[count] = obj.field
+              # save a label in self.l for the user
+              self.l[count] = "_"
+              if self.nfin > 1:   self.l[count] = self.l[count] + "f=#"+str(int(i+1))+'_'
+              if self.nvin > 1:   self.l[count] = self.l[count] + "v="+obj.var+'_'
+              if self.nplotx > 1: self.l[count] = self.l[count] + "x="+str(self.x[x])+'_'
+              if self.nploty > 1: self.l[count] = self.l[count] + "y="+str(self.y[y])+'_'
+              if self.nplotz > 1: self.l[count] = self.l[count] + "z="+str(self.z[z])+'_'
+              if self.nplott > 1: self.l[count] = self.l[count] + "t="+str(self.t[t])+'_'
+              count = count + 1
+        ## make it simple: self.f is simply the data array if self.nrequest=1
+        if self.nrequest == 1: self.f = self.f[0]
         # change status
         self.status = "retrieved"
@@ -602,4 +633,24 @@
         self.retrieve()
         return self  
+
+    ###########################################################
+    # getf: a shortcut method for the define + retrieve chain #
+    #       ... in which the output is self.f                 #
+    #       ... and the ppclass is kept quiet                 #
+    ###########################################################
+    def getf(self):
+        self.quiet = True
+        self.get()
+        return self.f
+
+    ############################################################
+    # getfl: a shortcut method for the define + retrieve chain #
+    #       ... in which the output is self.f, self.l          #
+    #       ... and the ppclass is kept quiet                 #
+    ############################################################
+    def getfl(self):
+        self.quiet = True
+        self.get()
+        return self.f,self.l
 
     ########################################
@@ -730,4 +781,5 @@
                     if self.ycoeff is not None: plobj.ycoeff = self.ycoeff
                     if self.title is not None: plobj.title = self.title
+                    if self.units is not None: plobj.units = self.units
                     # -- 1D specific
                     if dp == 1:
@@ -799,5 +851,5 @@
             if self.verbose: print "**** OK. expect %i plots" % (self.howmanyplots)
         else:
-            exit() # because this means that we only had 0D values !
+            pass # because this means that we only had 0D values !
         # final status
         self.status = "definedplot"
@@ -813,4 +865,5 @@
     ##############################################################################################
     def makeplot(self):
+      if self.howmanyplots > 0:
         self.printstatus()
         # a few initial operations
@@ -888,5 +941,5 @@
             pickle.dump(self.p, filehandler)
         except IOError: 
-            print "!! WARNING !! Saved object file not written. Probably do not have permission to write here."
+            if self.verbose: print "!! WARNING !! Saved object file not written. Probably do not have permission to write here."
         return self
 
@@ -915,11 +968,11 @@
         return self
 
-    ##############################################################
-    # f: operation on two pp objects being on status 'definedplot'
+    #################################################################
+    # func: operation on two pp objects being on status 'definedplot'
     # this allows for one field being function of another one
-    # e.g. u.f(v) means u will be displayed as a function of v
-    # ... no need to do defineplot after u.f(v), makeplot directly
-    ##############################################################
-    def f(self,other):
+    # e.g. u.func(v) means u will be displayed as a function of v
+    # ... no need to do defineplot after u.func(v), makeplot directly
+    #################################################################
+    def func(self,other):
         # preamble: for this operation to work, defineplot() must have been done
         if self.status != "definedplot":
@@ -1149,5 +1202,5 @@
           if "grid points" not in self.name_x:
             if self.field_x.all() == self.field_x[0,0]:
-               print "!! WARNING !! xy axis look undefined. creating non-dummy ones."
+               if self.verbose: print "!! WARNING !! xy axis look undefined. creating non-dummy ones."
                self.field_x = np.array(range(self.dim_x)) ; self.name_x = "x grid points"
                self.field_y = np.array(range(self.dim_y)) ; self.name_y = "y grid points"
@@ -1242,5 +1295,5 @@
                             self.field_t = self.field_t % 24 # so that the user is not mistaken!
             else:
-                print "!! WARNING !! This time change is not implemented. Nothing is done."
+                if self.verbose: print "!! WARNING !! This time change is not implemented. Nothing is done."
             if self.verbose: print "**** OK. new t axis values [%5.1f,%5.1f]" % (self.field_t.min(),self.field_t.max())
 
@@ -1396,8 +1449,9 @@
     def getfield(self):
         ## first tell what is to be done
-        if self.dimplot > 2:                       print "**** !! ERROR !! "+str(self.dimplot)+"D plots not supported!" ; exit()
-        elif self.dimplot == 0 and self.verbose:   print "**** OK. 0D value requested."
-        elif self.dimplot == 1 and self.verbose:   print "**** OK. 1D plot requested."
-        elif self.verbose:                         print "**** OK. 2D section requested."
+        if self.verbose:
+          if self.dimplot > 2:                       print "**** !! WARNING !! "+str(self.dimplot)+"D plots will not be supported!"
+          elif self.dimplot == 0 and self.verbose:   print "**** OK. 0D value requested."
+          elif self.dimplot == 1 and self.verbose:   print "**** OK. 1D plot requested."
+          elif self.verbose:                         print "**** OK. 2D section requested."
         # well, now get field from netcdf file
         # part below is necessary otherwise there is an index error below
