def plot(self): """Plot self using first time and level only.""" import vcs, cdms, VCSRegion canvas=vcs.init() # Construct VCS object to generate image cdms.setAutoReshapeMode('off') a, keyargs = VCSRegion.getRegion(self.var, time=None, level=None, other=None) apply(canvas.plot, (a, 'default', 'isofill'), keyargs) # Generate VCS isofill image return gifiate(canvas) # Return GIF image string
def plot(self): """Plot self using first time and level only.""" import vcs, cdms, VCSRegion canvas = vcs.init() # Construct VCS object to generate image cdms.setAutoReshapeMode('off') a, keyargs = VCSRegion.getRegion(self.var, time=None, level=None, other=None) apply(canvas.plot, (a, 'default', 'isofill'), keyargs) # Generate VCS isofill image return gifiate(canvas) # Return GIF image string
def seasonal_average(v, months): "Return the average of self.var over a given list of months numbers (0 based)" import cdms it = -1 order = v.getOrder() for i in range(len(order)): if order[i] == 't': it = i break if it < 0: print "Array is not suitable for jja averaging." return None ar, keyargs = VCSRegion.getRegion(v, level=None, other=None) if it == 0: a = ar[months[0], ...] for k in months[1:]: a = a + ar[k, ...] a = a / (1.0 * len(months)) return a, keyargs