Ignore:
Timestamp:
Apr 16, 2013, 3:06:48 PM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON planetoplot_v2. fixed small bugs.

File:
1 edited

Legend:

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

    r931 r932  
    508508        mz = findmethod(sz) ; mt = findmethod(st)
    509509        # get number of plots to be done
    510         if mx == "fixed": self.nplotx = sx.size/2
    511         else:             self.nplotx = 1
    512         if my == "fixed": self.nploty = sy.size/2
    513         else:             self.nploty = 1
    514         if mz == "fixed": self.nplotz = sz.size/2
    515         else:             self.nplotz = 1
    516         if mt == "fixed": self.nplott = st.size/2
    517         else:             self.nplott = 1
     510        if mx in ["fixed","comp"]: self.nplotx = sx.size/2
     511        else:                      self.nplotx = 1
     512        if my in ["fixed","comp"]: self.nploty = sy.size/2
     513        else:                      self.nploty = 1
     514        if mz in ["fixed","comp"]: self.nplotz = sz.size/2
     515        else:                      self.nplotz = 1
     516        if mt in ["fixed","comp"]: self.nplott = st.size/2
     517        else:                      self.nplott = 1
    518518        if self.verbose:  print "**** OK. Plots over x,y,z,t -->",self.nplotx,self.nploty,self.nplotz,self.nplott
    519519        # create the list of onerequest() objects
     
    13621362        else:
    13631363            print "!! ERROR !! field would have more than four dimensions ?" ; exit()
     1364        # dirty hack (AS) ref1_dirty_hack
     1365        # waiting for more fundamental modifications. case when self.index_y is a bool array.
     1366        # ... be careful if no point...
     1367        if type(self.index_x[0]) == np.bool_: nx = np.sum(self.index_x) ## gives the size of the True part!
     1368        if type(self.index_y[0]) == np.bool_: ny = np.sum(self.index_y) ## gives the size of the True part!
    13641369        # NB: ... always 4D array but possibly with "size 1" dimensions
    13651370        #     ... if one dimension is missing because 1D 2D or 3D requests, make it appear again
    1366         try:
    1367             self.field = np.reshape(self.field,(nt,nz,ny,nx))
    1368         except:
    1369             # dirty hack (AS) ref1_dirty_hack
    1370             # waiting for more fundamental modifications. case when self.index_y is a bool array.
    1371             # ... be careful if no point...
    1372             nx = np.sum(self.index_x) ## gives the size of the True part!
    1373             ny = np.sum(self.index_y)
    1374             self.field = np.reshape(self.field,(nt,nz,ny,nx))
     1371        self.field = np.reshape(self.field,(nt,nz,ny,nx))
    13751372        if self.verbose: print "**** OK. I got %7.1e values. This took me %6.4f seconds" % (nx*ny*nz*nt,timelib.time() - time0)
    13761373        if self.verbose: print "**** OK. I got var "+self.var+" with shape",self.field.shape
Note: See TracChangeset for help on using the changeset viewer.