Ignore:
Timestamp:
Jun 14, 2013, 9:52:31 AM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON planetoplot_v2. ASCII output. 4D altitude coordinate is possible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py

    r984 r990  
    161161                      changetime=None,\
    162162                      units=None,\
     163                      savtxt=False,\
    163164                      title=None):
    164165        self.request = None
     
    199200        self.includedate = includedate
    200201        self.changetime = changetime
     202        self.savtxt = savtxt
    201203        ## here are user-defined plot settings
    202204        ## -- if not None, valid on all plots in the pp() objects
     
    262264            self.includedate = other.includedate
    263265            self.changetime = other.changetime
     266            self.savtxt = other.savtxt
    264267        else:
    265268            print "!! ERROR !! argument must be a pp object." ; exit()
     
    943946            # finally make the plot
    944947            pl.make()
     948            # possibly print results in a text file
     949            if self.savtxt:
     950                if self.verbose: print "**** Printing results in a text file"
     951                name = pl.var + "%04d" % self.n
     952                ppplot.writeascii(field=pl.field,absc=pl.absc,name=name)
    945953            # increment plot count (and propagate this in plotin)
    946954            self.n = self.n+1
     
    12991307            self.name_z = "z grid points"
    13001308          else:
    1301             self.field_z = self.f.variables[self.name_z][:] # specify dimension
    1302                                                             # TBD: have to check that this is not a 3D field
     1309            tabalt = self.f.variables[self.name_z]
     1310            # (consider the case where tabtime is not dim 1) TBD: 2D and 3D cases
     1311            if tabalt.ndim == 4:
     1312                try:
     1313                    self.field_z = tabalt[1,:,0,0] # 4D case. alt is usually third dimension.
     1314                                                   # 1 for time to avoid initial 0s
     1315                except:
     1316                    self.field_z = tabalt[0,:,0,0]
     1317                if self.verbose: print "!! WARNING !! "+self.name_z+" is 4D var. We made it 1D."
     1318            else:
     1319                self.field_z = self.f.variables[self.name_z][:] # specify dimension
    13031320          if self.dim_z > 1:
    13041321               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())
Note: See TracChangeset for help on using the changeset viewer.