def main(args): start_time = time.time() wrf_procdir = args.wrf_dir save_dir = args.save_dir if wrf_procdir.endswith('/'): ext = '*.nc' else: ext = '/*.nc' files = sorted(glob.glob(wrf_procdir + ext)) # get the model version (3km or 9km) from the filename f0 = files[0] model_ver = f0.split('/')[-1].split('_')[1] # 3km or 9km os.makedirs(save_dir, exist_ok=True) # List of variables to plot plt_vars = ['power160'] kwargs = dict() # kwargs['lease_areas'] = cf.extract_lease_areas() for i, f in enumerate(files): fname = f.split('/')[-1].split('.')[0] splitter = fname.split('/')[-1].split('_') ncfile = xr.open_dataset(f, mask_and_scale=False) for pv in plt_vars: sfile = cf.save_filepath(save_dir, pv, splitter) if pv == 'power160': plt_power(ncfile, model_ver, '160m', sfile, **kwargs) print('') print('Script run time: {} minutes'.format( round(((time.time() - start_time) / 60), 2)))
def main(args): start_time = time.time() wrf_procdir = args.wrf_dir save_dir = args.save_dir if wrf_procdir.endswith('/'): ext = '*.nc' else: ext = '/*.nc' files = sorted(glob.glob(wrf_procdir + ext)) # get the model version (3km or 9km) from the filename f0 = files[0] model_ver = f0.split('/')[-1].split('_')[1] # 3km or 9km os.makedirs(save_dir, exist_ok=True) for i, f in enumerate(files): fname = f.split('/')[-1].split('.')[0] splitter = fname.split('/')[-1].split('_') ncfile = xr.open_dataset(f, mask_and_scale=False) sfile = cf.save_filepath(save_dir, 'tsk', splitter) plt_tsk(ncfile, model_ver, sfile) print('') print('Script run time: {} minutes'.format( round(((time.time() - start_time) / 60), 2)))
def main(args): start_time = time.time() wrf_procdir = args.wrf_dir save_dir = args.save_dir if wrf_procdir.endswith('/'): ext = '*.nc' else: ext = '/*.nc' files = sorted(glob.glob(wrf_procdir + ext)) # get the model version (3km or 9km) from the filename f0 = files[0] model_ver = f0.split('/')[-1].split('_')[1] # 3km or 9km os.makedirs(save_dir, exist_ok=True) kwargs = dict() #kwargs['lease_areas'] = cf.extract_lease_areas() for i, f in enumerate(files): fname = f.split('/')[-1].split('.')[0] splitter = fname.split('/')[-1].split('_') ncfile = xr.open_dataset(f, mask_and_scale=False) sfile = cf.save_filepath(save_dir, 'rain', splitter) # plot hourly and accumulated rainfall (each .nc file contains accumulated precipitation) # plot accumulated rainfall plt_rain(ncfile, model_ver, sfile, 'acc', **kwargs) # plot hourly rainfall if i > 0: fprev = files[i - 1] nc_prev = xr.open_dataset(fprev, mask_and_scale=False) else: nc_prev = None kwargs['ncprev'] = nc_prev plt_rain(ncfile, model_ver, sfile, 'hourly', **kwargs) print('') print('Script run time: {} minutes'.format( round(((time.time() - start_time) / 60), 2)))
def main(args): start_time = time.time() wrf_procdir = args.wrf_dir save_dir = args.save_dir if wrf_procdir.endswith('/'): ext = '*.nc' else: ext = '/*.nc' files = sorted(glob.glob(wrf_procdir + ext)) files = [f for f in files if f.endswith('_M00.nc')] # get the model version (3km or 9km) from the filename f0 = files[0] model_ver = f0.split('/')[-1].split('_')[1] # 3km or 9km os.makedirs(save_dir, exist_ok=True) # List of variables to plot plt_vars = ['ws925'] seabreeze_locations = { 'atlantic_city': { 'lat': 39.4520, 'lon': -74.5670 }, 'ocean_city_md': { 'lat': 38.3083, 'lon': -75.1239 }, 'oyster_creek': { 'lat': 39.817102, 'lon': -74.213449 }, 'sea_isle_city': { 'lat': 39.191604, 'lon': -74.788602 }, 'asbury_park': { 'lat': 40.233804, 'lon': -74.089406 } } kwargs = dict() # kwargs['lease_areas'] = cf.extract_lease_areas() summary = dict(rows=[], locations=seabreeze_locations) kwargs['summary'] = summary kwargs['add_text'] = True for i, f in enumerate(files): fname = f.split('/')[-1].split('.')[0] splitter = fname.split('/')[-1].split('_') ncfile = xr.open_dataset(f, mask_and_scale=False) for pv in plt_vars: sfile = cf.save_filepath(save_dir, pv, splitter) if pv == 'ws925': plt_windsp(ncfile, model_ver, 925, sfile, **kwargs) df_headers = [ 'time', 'location', 'lat', 'lon', 'pressure_mb', 'wrf_lat', 'wrf_lon', 'wind_speed_meterspersec', 'wind_direction' ] df = pd.DataFrame(summary['rows'], columns=df_headers) df.to_csv('{}/seabreeze_summary.csv'.format(save_dir), index=False) print('') print('Script run time: {} minutes'.format( round(((time.time() - start_time) / 60), 2)))