예제 #1
0
sf = dict(dpi=150) # print properties
folder = '/home/me/Research/Dynamical Downscaling/figures/' # figure directory

if __name__ == '__main__':
  
  # load WRF data
  domains = [1]; ndom = len(domains) # WRF domain
  way2, = openWRF(exp='2way-ctrl',years=[1983],months=[3], domains=domains)
  grell3, = openWRF(exp='grell3-ctrl',years=[1981],months=[2], domains=domains) 
  ctrl1, = openWRF(exp='ctrl-1',years=[1985],months=[5], domains=domains)
  ensA, = openWRF(exp='ens-A-ctrl',years=[1985],months=[5], domains=domains)
  WRF = (ctrl1, grell3, )
  # load CFSR data
  CFSR = openCFSRclim()
  # load NARR data 
  NARR = openNARRclim() # just load whole climatology
#  print NARR
  
  ## compute data
  data = []; lon = []; lat=[]  # list of data and coordinate fields to be plotted 
  # compute average WRF precip
  for exp in WRF:
    nrec = exp.time.values[-1]+1
    ndays = exp.xtime(time=nrec-1).get() /24/60 # xtime is in minutes, need days    
    dailyrain = exp.rain(time=nrec-1).get().squeeze() / ndays
    data.append(dailyrain)
    lon.append(exp.lon.get()); lat.append(exp.lat.get())
  # compute annual/seasonal mean for NARR and CFSR
  months = [31.,28.25,31.,30.,31.,30.,31.,31.,30.,31.,30.,31.]; days = 0.
#  rng = [0,1,2,9,10,11]
  rng = range(12)
예제 #2
0
 exps = []; axtitles = []
 for exp,prd in zip(explist,period): 
   ext = exp; axt = ''
   if isinstance(exp,str):
     if exp[0].isupper():
       if exp == 'GPCC': ext = (openGPCCclim(resolution=resolution,period=prd),); axt = 'GPCC Observations' # ,period=prd
       elif exp == 'CRU': ext = (openCRUclim(period=prd),); axt = 'CRU Observations' 
       elif exp[0:5] == 'PRISM': # all PRISM derivatives
         if exp == 'PRISM': prismfile = 'prism_clim.nc'
         elif exp == 'PRISM-10km': prismfile = 'prism_10km.nc'
         if len(vars) ==1 and vars[0] == 'rain': 
           ext = (openGPCCclim(resolution='0.25'), openPRISMclim(filename=prismfile)); axt = 'PRISM (and GPCC)'
         else: ext = (openCRUclim(period='1979-2009'), openPRISMclim(filename=prismfile)); axt = 'PRISM (and CRU)'
         # ext = (openPRISMclim(),)          
       elif exp == 'CFSR': ext = (openCFSRclim(period=prd),); axt = 'CFSR Reanalysis' 
       elif exp == 'NARR': ext = (openNARRclim(),); axt = 'NARR Reanalysis'
       else: # all other uppercase names are CESM runs  
         ext = (openCESMclim(exp=exp, period=prd),)
         axt = CESMtitle.get(exp,exp)
     else: # WRF runs are all in lower case
       ext = openWRFclim(exp=exp, period=prd, domains=dom)
       axt = WRFtitle.get(exp,exp)
   exps.append(ext); axtitles.append(axt)  
 print exps[-1][-1]
 # count experiment tuples (layers per panel)
 nexps = []; nlen = len(exps)
 for n in xrange(nlen):
   if not isinstance(exps[n],(tuple,list)): # should not be necessary
     exps[n] = (exps[n],)
   nexps.append(len(exps[n])) # layer counter for each panel
 
예제 #3
0
                      years=[1981],
                      months=[2],
                      domains=domains)
    ctrl1, = openWRF(exp='ctrl-1', years=[1985], months=[5], domains=domains)
    ensA, = openWRF(exp='ens-A-ctrl',
                    years=[1985],
                    months=[5],
                    domains=domains)
    WRF = (
        ctrl1,
        grell3,
    )
    # load CFSR data
    CFSR = openCFSRclim()
    # load NARR data
    NARR = openNARRclim()  # just load whole climatology
    #  print NARR

    ## compute data
    data = []
    lon = []
    lat = []  # list of data and coordinate fields to be plotted
    # compute average WRF precip
    for exp in WRF:
        nrec = exp.time.values[-1] + 1
        ndays = exp.xtime(time=nrec -
                          1).get() / 24 / 60  # xtime is in minutes, need days
        dailyrain = exp.rain(time=nrec - 1).get().squeeze() / ndays
        data.append(dailyrain)
        lon.append(exp.lon.get())
        lat.append(exp.lat.get())
예제 #4
0
                 if exp == 'PRISM': prismfile = 'prism_clim.nc'
                 elif exp == 'PRISM-10km': prismfile = 'prism_10km.nc'
                 if len(vars) == 1 and vars[0] == 'rain':
                     ext = (openGPCCclim(resolution='0.25'),
                            openPRISMclim(filename=prismfile))
                     axt = 'PRISM (and GPCC)'
                 else:
                     ext = (openCRUclim(period='1979-2009'),
                            openPRISMclim(filename=prismfile))
                     axt = 'PRISM (and CRU)'
                 # ext = (openPRISMclim(),)
             elif exp == 'CFSR':
                 ext = (openCFSRclim(period=prd), )
                 axt = 'CFSR Reanalysis'
             elif exp == 'NARR':
                 ext = (openNARRclim(), )
                 axt = 'NARR Reanalysis'
             else:  # all other uppercase names are CESM runs
                 ext = (openCESMclim(exp=exp, period=prd), )
                 axt = CESMtitle.get(exp, exp)
         else:  # WRF runs are all in lower case
             ext = openWRFclim(exp=exp, period=prd, domains=dom)
             axt = WRFtitle.get(exp, exp)
     exps.append(ext)
     axtitles.append(axt)
 print exps[-1][-1]
 # count experiment tuples (layers per panel)
 nexps = []
 nlen = len(exps)
 for n in xrange(nlen):
     if not isinstance(exps[n], (tuple, list)):  # should not be necessary