예제 #1
0
파일: main.py 프로젝트: nishadhka/WEM
    def get_wrfout(self, wrf_sd=0, wrf_nc=0, dom=0, path_only=0):
        """Returns the WRFOut instance, given arguments:
        
        Optional inputs:
        wrf_sd      :   subdirectory for wrf file
        wrf_nc      :   filename for wrf file
        dom         :   domain for wrf file
        path_only   :   only return absolute path
        """
        # Check configuration to see if wrfout files should be
        # sought inside subdirectories.
        descend = getattr(self.C, 'wrf_folders_descend', 1)

        if wrf_sd and wrf_nc:
            wrfpath = os.path.join(self.C.wrfout_root, wrf_sd, wrf_nc)
        elif wrf_sd:
            wrfdir = os.path.join(self.C.wrfout_root, wrf_sd)
            # print wrfdir
            wrfpath = utils.wrfout_files_in(wrfdir,
                                            dom=dom,
                                            unambiguous=1,
                                            descend=descend)
        else:
            wrfdir = os.path.join(self.C.wrfout_root)
            wrfpath = utils.wrfout_files_in(wrfdir,
                                            dom=dom,
                                            unambiguous=1,
                                            descend=descend)

        if path_only:
            return wrfpath
        else:
            return WRFOut(wrfpath)
예제 #2
0
# Create lists of all fig, ax, cb objects
figs = {}
axes = {}
cbs = {}

ensnames = ['c00'] + ['p{0:02d}'.format(n) for n in range(1,11)]

#for rundate in ('25','27','29'):
plot_all = 1
if plot_all:
    # for rundate in ['25','27','29']:
    for rundate in ['27','29']:
        # print("Computing for {0} November".format(rundate))
        foldername = '201111' + rundate + '00'
        runfolder = os.path.join(rootdir,foldername)
        path_to_wrfouts = utils.wrfout_files_in(runfolder,dom=1)
    
        itime = (2011,11,int(rundate),0,0,0)
        ftime = (2011,12,2,12,0,0)
        times = p.generate_times(itime,ftime,6*3600)
        
        path_to_plots = os.path.join(outdir,foldername)
        # for time in times:
        #pdb.set_trace()
        # Produce .npy data files with DKE data
        # print("Compute_diff_energy...")
        wrfouts = ['/uufs/chpc.utah.edu/common/home/horel-group2/lawson2/201111{0}00/{1}/wrfout_d01_2011-11-{2}_00:00:00_PLEV'.format(rundate,e,rundate)
                    for e in ensnames]
        clvs = 0
        plotfname = 'deltaDKE'
        # p.compute_diff_energy('sum_z','kinetic',path_to_wrfouts,times,upper=500,
예제 #3
0
# Create lists of all fig, ax, cb objects
figs = {}
axes = {}
cbs = {}

ensnames = ['c00'] + ['p{0:02d}'.format(n) for n in range(1, 11)]

#for rundate in ('25','27','29'):
plot_all = 1
if plot_all:
    # for rundate in ['25','27','29']:
    for rundate in ['27', '29']:
        # print("Computing for {0} November".format(rundate))
        foldername = '201111' + rundate + '00'
        runfolder = os.path.join(rootdir, foldername)
        path_to_wrfouts = utils.wrfout_files_in(runfolder, dom=1)

        itime = (2011, 11, int(rundate), 0, 0, 0)
        ftime = (2011, 12, 2, 12, 0, 0)
        times = p.generate_times(itime, ftime, 6 * 3600)

        path_to_plots = os.path.join(outdir, foldername)
        # for time in times:
        #pdb.set_trace()
        # Produce .npy data files with DKE data
        # print("Compute_diff_energy...")
        wrfouts = [
            '/uufs/chpc.utah.edu/common/home/horel-group2/lawson2/201111{0}00/{1}/wrfout_d01_2011-11-{2}_00:00:00_PLEV'
            .format(rundate, e, rundate) for e in ensnames
        ]
        clvs = 0
예제 #4
0
elif experiment == 'ICBC':
    picklefolder = os.path.join(wrfout_root, case, IC)
    p.C.output_root = os.path.join(output_root, case, IC)
    sensitivity = ens_names
    #fpath = os.path.join(config.wrfout_root,case,IC,)
    #path_to_wrfouts = p.wrfout_files_in(fpath,dom=1)

elif experiment == 'MXMP':
    picklefolder = os.path.join(wrfout_root, case, IC, ens)
    outpath = os.path.join(output_root, case, IC, ens)
    sensitivity = MPs
    path_to_wrfouts = []
    for mp in MPs:
        fpath = os.path.join(wrfout_root, case, IC, ens, MP)
        path_to_wrfouts.append(utils.wrfout_files_in(fpath, dom=1)[0])
else:
    print("Typo!")
    raise Exception

pfname = 'DTE_' + experiment

if compute:
    p.compute_diff_energy('sum_z',
                          'total',
                          path_to_wrfouts,
                          times,
                          d_save=picklefolder,
                          d_return=0,
                          d_fname=pfname)
예제 #5
0
파일: DKE.py 프로젝트: johnrobertlawson/WEM
elif experiment=='ICBC':
    picklefolder = os.path.join(wrfout_root,case,IC)
    p.C.output_root = os.path.join(output_root,case,IC)
    sensitivity=ens_names
    #fpath = os.path.join(config.wrfout_root,case,IC,)
    #path_to_wrfouts = p.wrfout_files_in(fpath,dom=1)

elif experiment=='MXMP':
    picklefolder = os.path.join(wrfout_root,case,IC,ens)
    outpath = os.path.join(output_root,case,IC,ens)
    sensitivity = MPs
    path_to_wrfouts = []
    for mp in MPs:
        fpath = os.path.join(wrfout_root,case,IC,ens,MP)
        path_to_wrfouts.append(utils.wrfout_files_in(fpath,dom=1)[0])
else:
    print("Typo!")
    raise Exception
    
pfname = 'DTE_' + experiment

if compute:
    p.compute_diff_energy('sum_z','total',path_to_wrfouts,times,
                          d_save=picklefolder, d_return=0,d_fname=pfname)

if plot_2D:
    # Contour fixed at these values
    V = list(range(250,5250,250))
    VV = [100,] + V
    ofname = pfname + '_2D'