Beispiel #1
0
 def save(self,fig,p2p,fname):
     utils.trycreate(p2p)
     fpath = os.path.join(p2p,fname)
     #self.fig.savefig(fpath)
     plt.gcf().savefig(fpath,bbox_inches='tight')
Beispiel #2
0
        if isinstance(y, collections.Sequence) and not isinstance(y, basestring):
            return x
        else:
            return [x]
        
   
    def plot_cross_section(self,var,latA,lonA,latB,lonB):
        xs = CrossSection()
        xs.plot(var,latA,lonA,latB,lonB)

    def save_data(self,data,folder,fname)
        # Ensure file suffix will be .npy
        os.path.splitext(fname)[0]
        # Check for folder and create if necessary
        utils.trycreate(folder)
        # Save in binary
        fpath = os.path.join(folder,fname)
        N.save(fpath,data)
        
        print("Save file {0}.npy to {1}.".format(fname,folder))

    def compute_diff_energy(
            self,ptype,energy,files,times,upper=None,lower=None,
            d_save=1,d_return=1,d_fname='diff_energy_data'):
        """
        This method computes difference kinetic energy (DKE)
        or different total energy (DTE, including temp)
        between WRFout files for a given depth of the 
        atmosphere, at given time intervals