mpl.rcParams['lines.linewidth'] = 1.8 mpl.rcParams['grid.linewidth'] = .25 mpl.rcParams['figure.subplot.wspace'] = 0.05 mpl.rcParams['figure.subplot.hspace'] = 0.05 mpl.rcParams['legend.fontsize'] = 10 mpl.rcParams['legend.framealpha'] = .75 mpl.rcParams['legend.loc'] = 'best' mpl.rcParams['savefig.bbox'] = 'tight' mpl.rcParams['savefig.dpi'] = 100 # Build map objects and get HRRR latitude and longitude grids. latlon = get_hrrr_latlon() lat = latlon['lat'] lon = latlon['lon'] m = draw_HRRR_map() # CONUS mW = draw_centermap(40, -115, (10,10)) # West mU = draw_centermap(39.5, -111.6, (3.2,3.2)) # Utah # Variable constants VARS = {'TMP:2 m':{'cmap':'magma', 'vmax':2.5, 'vmin':0, 'label':'2 m Temperature', 'units':'C'}, 'DPT:2 m':{'cmap':'magma', 'vmax':5, 'vmin':0, 'label':'2 m Dew Point', 'units':'C'}, 'GUST:surface':{'cmap':'magma', 'vmax':3.5,
if not os.path.exists(SAVEDIR): os.makedirs(SAVEDIR) plt.savefig(SAVEDIR + '%s' % Hrefc['valid'].strftime('valid_%Y%m%d-%H%M')) #plt.close() # ============================================================================= if __name__ == '__main__': # Define the fire or event of interest fire = get_fire('Mallard') # Make map m = draw_centermap(fire['latitude'], fire['longitude']) # Date info sDATE = fire['sDATE'] eDATE = sDATE + timedelta(days=2) DATES = range_dates(sDATE, eDATE, HOURS=True) # Generate plots with multiprocessing timer = datetime.now() inputs = [(fire, m, d) for d in DATES] cpus = multiprocessing.cpu_count() p = multiprocessing.Pool(np.minimum(12, cpus)) p.map(make_plot, inputs) p.close()
if variable in ['UVGRD:10 m', 'WIND:10 m']: units = r'm s$\mathregular{^{-1}}$' elif variable == 'REFC:entire': units = 'dBZ' nep = NEP(validDATE, threshold=threshold, variable=variable, radius=radius, fxx=fxx, hours_span=hours_span) # Get the values at the valid time H = get_hrrr_variable(validDATE, variable, fxx=0) m = draw_centermap(40.77, -111.96, size=(2.5, 3.5)) plt.figure(figsize=[10, 5]) cm = cm_prob() m.pcolormesh(nep['lon'], nep['lat'], nep['prob'], cmap=cm['cmap'], vmax=cm['vmax'], vmin=cm['vmin'], latlon=True) cb = plt.colorbar(pad=.02, shrink=.8) m.contour(H['lon'], H['lat'], H['value'] >= threshold,
L[i] = location[i] location = L ''' ## 2) Make map object for each location and store in a dictionary print( 'Make %s Maps (this takes a while if location_dic has a lot of locations)' % len(location)) for name, loc in location.items(): FILE = './saved_map_objects/%s.npy' % name if os.path.exists(FILE): m = np.load(FILE, allow_pickle=True).item() print('loaded %s map from file' % name) else: center = (loc['latitude'], loc['longitude']) m = draw_centermap(center, size=(.3, .3)) # Save the map object for later use np.save(FILE, m) print('saved %s map to file' % name) ## Store map object in location dictionary location[name]['map'] = m ## 3) Create a landuse image for each locations ## Create new figure once a day because landuse ice cover changes on lakes if datetime.utcnow().hour == 0: LU = get_hrrr_variable(datetime.now(), 'VGTYP:surface') LU_cmap = LU_MODIS21() for n, (name, loc) in enumerate(location.items()): print('Generating LandUse map for %s' % name) LU_SAVE = '/uufs/chpc.utah.edu/common/home/u0553130/public_html/oper/HRRR_golf/%s/LandUse.png' % name.replace( ' ', '_')
#single = RMSD(DATE, 'REFC:entire', FORECASTS=range(19)) from BB_maps.my_basemap import draw_HRRR_map, draw_centermap import matplotlib.pyplot as plt import matplotlib as mpl mpl.rcParams['figure.figsize'] = [15,15] mpl.rcParams['figure.titlesize'] = 15 mpl.rcParams['figure.subplot.wspace'] = 0.05 mpl.rcParams['figure.subplot.hspace'] = 0.05 mpl.rcParams['xtick.labelsize'] = 10 mpl.rcParams['ytick.labelsize'] = 10 mpl.rcParams['lines.linewidth'] = 1.8 mpl.rcParams['savefig.bbox'] = 'tight' mpl.rcParams['savefig.dpi'] = 100 m = draw_HRRR_map(area_thresh=5000) mU = draw_centermap(lat=40, lon=-115, size=(10,10)) sDATE = datetime(2018, 7, 13) eDATE = datetime(2018, 8, 13) #SAVEDIR = 'figs/hourly_RMSD/' SAVEDIR = '/uufs/chpc.utah.edu/common/home/u0553130/public_html/PhD/HRRR_RMSE/RMSD_v3' if not os.path.exists(SAVEDIR): os.makedirs(SAVEDIR) for variable in ['TMP:2 m', 'UGRD:10 m', 'VGRD:10 m', 'LTNG:entire', 'REFC:entire', 'WIND:10 m', 'CAPE:surface', 'HGT:500 mb', 'DPT:2 m']: #for variable in ['TMP:2 m']: if variable in ['LTNG:entire', 'APCP:surface', 'WIND:10 m']: # These variables are hourly values and don't have an analysis value FORECASTS = range(1,19) else: # The other variables have an analysis