Index: /trunk/UTIL/PYTHON/planetoplot_v2/examples/ppclass_additional/stream.py
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot_v2/examples/ppclass_additional/stream.py	(revision 1108)
+++ /trunk/UTIL/PYTHON/planetoplot_v2/examples/ppclass_additional/stream.py	(revision 1108)
@@ -0,0 +1,24 @@
+#! /usr/bin/env python
+from ppclass import pp
+from ppplot import plot2d
+import numpy as np
+
+## load streamfunction from another file
+## ** USE kind3d="tzy" --> because 3D file is different
+pfield = pp(file="histmth.1401_PSI.nc",x=0,t=10,var="psi",verbose=True,kind3d="tzy").getf()
+
+## get field and define a plot
+t = pp()
+t.file = "histmth.1401.nc"
+t.x = "-180,180"
+t.t = 10
+t.var = "temp"
+t.logy = True
+t.get()
+t.defineplot()
+
+## add the streamfunction as contour
+t.p[0].c = pfield
+
+## make plot
+t.makeplot()
Index: /trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
===================================================================
--- /trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 1107)
+++ /trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py	(revision 1108)
@@ -165,4 +165,5 @@
                       svy=1,\
                       compute="mean",\
+                      kind3d="tyx",\
                       verbose=False,\
                       quiet=False,\
@@ -223,4 +224,5 @@
         self.svy = svy
         self.compute = compute
+        self.kind3d = kind3d
         self.verbose = verbose
         self.quiet = quiet
@@ -290,4 +292,6 @@
             self.sx = other.sx ; self.sy = other.sy
             self.sz = other.sz ; self.st = other.st
+            self.compute = other.compute
+            self.kind3d = other.kind3d
             self.verbose = other.verbose
             self.noproj = other.noproj
@@ -628,4 +632,6 @@
               # indicate the computation method
               obj.compute = self.compute
+              # indicate the kind of 3D fields
+              obj.kind3d = self.kind3d
               # open the files (the same file might be opened several times but this is cheap)
               obj.openfile()
@@ -749,4 +755,5 @@
               elif obj.field.ndim == 2:
                   obj.field = ppcompute.smooth2d(obj.field,window=window)
+                  #obj.field = ppcompute.smooth2diter(obj.field,n=window)
 
     ##############################################################################################  
@@ -1315,4 +1322,5 @@
         self.sx = 1 ; self.sy = 1 ; self.sz = 1 ; self.st = 1
         self.missing = '!! missing value: I am not set, damned !!'
+        self.kind3d = '!! kind3d: I am not set, damned !!'
 
     # open a file. for now it is netcdf. TBD for other formats.
@@ -1356,5 +1364,13 @@
           elif self.dim == 3:
               if self.verbose: print "**** OK. 3D field. I assume this is time-varying lat-lon map."
-              self.dim_x = shape[2] ; self.dim_y = shape[1] ; self.dim_z = 1 ; self.dim_t = shape[0]
+              ## see below for comment
+              if self.kind3d == "tyx":
+                self.dim_x = shape[2] ; self.dim_y = shape[1] ; self.dim_z = 1 ; self.dim_t = shape[0]
+              elif self.kind3d == "tzy":
+                self.dim_x = 1 ; self.dim_y = shape[2] ; self.dim_z = shape[1] ; self.dim_t = shape[0]
+              else:
+                print "!! ERROR !! This kind of 3D field is not supported. Please send feedback."
+                print self.kind3d
+                exit() 
           elif self.dim == 4:
               if self.verbose: print "**** OK. 4D field."
@@ -1703,6 +1719,14 @@
             self.field = self.f.variables[self.var][self.index_y,self.index_x]
         elif self.dim == 3:
-            nt = self.index_t.size ; nz = 1 ; ny = self.index_y.size ; nx = self.index_x.size
-            self.field = self.f.variables[self.var][self.index_t,self.index_y,self.index_x]
+            ## DEFAULT tyx (time-varying 2D field)
+            if self.kind3d == "tyx":
+               nt = self.index_t.size ; nz = 1 ; ny = self.index_y.size ; nx = self.index_x.size
+               self.field = self.f.variables[self.var][self.index_t,self.index_y,self.index_x]
+            ## CASE tzy (e.g. time-varying zonal mean y-z field)
+            elif self.kind3d == "tzy":
+               nt = self.index_t.size ; nz = self.index_z.size ; ny = self.index_y.size ; nx = 1
+               self.field = self.f.variables[self.var][self.index_t,self.index_z,self.index_y]
+            else:
+               print "!! ERROR !! This kind of 3D field is not supported. Please send feedback." ; exit()
             # this is far faster than retrieving each term with a loop
         elif self.dim == 4:
