numhours = len(hourindex) date_list = [base + timedelta(hours=z) for z in range(0, numhours)] dstr = np.vectorize(datetime_to_str) xlabel = dstr(date_list[24:]) # Make Plot plt.figure(1, figsize=[20,14]) plt.suptitle(st_name+", June 18 00z - June 19 07z, 2015, Model Version=lake303",fontsize=20) plt.subplot(3,1,1) plt.title(station+' Potential Temperature and Wind Direction',fontsize=15) ax = plt.pcolormesh(x2D,PH,wind_calcs.wind_uv_to_dir(UU,VV), cmap=plt.get_cmap('hsv')) # dates, plt.ylim([np.min(PH),3500]) plt.xlim([24,np.max(x)]) plt.xticks(xticks,xlabel) cbar = plt.colorbar(ticks= np.arange(0,361,45),pad=0.01) cbar.set_ticklabels(['N','NE','E','SE','S','SW','W','NW','N']) cbar.set_label('Wind Direction') CS = plt.contour(x2D,PH,TH, colors=.2, levels=np.arange(int(np.min(TH)),int(np.max(TH)),1), widths=.25) plt.clabel(CS, inline=1, fontsize=9,fmt='%1.0f') plt.ylabel('Geopotential Height (m)') plt.xlabel('Hour')
obs_temp = obs['temperature'] # calculate the U and V components from wind speed obs_u, obs_v = wind_calcs.wind_spddir_to_uv(obs_spd, obs_dir) # Get the WRF timeseries data wrf_dir = '/uufs/chpc.utah.edu/common/home/horel-group4/model/bblaylock/WRF3.7_lake299_ember/WRFV3/test/em_real/' wrf_name = 'lake299' wrf_temp = WRF_timeseries.get_ts_data(wrf_dir + station + '.d02.TS', 't') - 273.15 wrf_u = WRF_timeseries.get_ts_data(wrf_dir + station + '.d02.TS', 'u') wrf_v = WRF_timeseries.get_ts_data(wrf_dir + station + '.d02.TS', 'v') wrf_time = WRF_timeseries.get_ts_data(wrf_dir + station + '.d02.TS', 'ts_hour') # calculate the wind speed and direction from u and v wrf_spd = wind_calcs.wind_uv_to_spd(wrf_u, wrf_v) wrf_dir = wind_calcs.wind_uv_to_dir(wrf_u, wrf_v) # convert wrf_time to datetime wrf_dates = np.array([]) for i in wrf_time: wrf_dates = np.append(wrf_dates, start_date + timedelta(hours=i)) # Get the WRF timeseries data for a second series wrf_dir2 = '/uufs/chpc.utah.edu/common/home/horel-group4/model/bblaylock/WRF3.7_lake303_ember/WRFV3/test/em_real/' wrf_name2 = 'lake303' wrf_temp2 = WRF_timeseries.get_ts_data(wrf_dir2 + station + '.d02.TS', 't') - 273.15 wrf_u2 = WRF_timeseries.get_ts_data(wrf_dir2 + station + '.d02.TS', 'u') wrf_v2 = WRF_timeseries.get_ts_data(wrf_dir2 + station + '.d02.TS', 'v') wrf_time2 = WRF_timeseries.get_ts_data(wrf_dir2 + station + '.d02.TS', 'ts_hour') # calculate the wind speed and direction from u and v
obs_spd = obs['wind speed'] obs_dir = obs['wind direction'] obs_temp = obs['temperature'] # calculate the U and V components from wind speed obs_u, obs_v = wind_calcs.wind_spddir_to_uv(obs_spd,obs_dir) # Get the WRF timeseries data wrf_dir = '/uufs/chpc.utah.edu/common/home/horel-group4/model/bblaylock/WRF3.7_lake299_ember/WRFV3/test/em_real/' wrf_name='lake299' wrf_temp = WRF_timeseries.get_ts_data(wrf_dir+station+'.d02.TS','t')-273.15 wrf_u = WRF_timeseries.get_ts_data(wrf_dir+station+'.d02.TS','u') wrf_v = WRF_timeseries.get_ts_data(wrf_dir+station+'.d02.TS','v') wrf_time = WRF_timeseries.get_ts_data(wrf_dir+station+'.d02.TS','ts_hour') # calculate the wind speed and direction from u and v wrf_spd = wind_calcs.wind_uv_to_spd(wrf_u,wrf_v) wrf_dir = wind_calcs.wind_uv_to_dir(wrf_u,wrf_v) # convert wrf_time to datetime wrf_dates = np.array([]) for i in wrf_time: wrf_dates = np.append(wrf_dates,start_date+timedelta(hours=i)) # Get the WRF timeseries data for a second series wrf_dir2 = '/uufs/chpc.utah.edu/common/home/horel-group4/model/bblaylock/WRF3.7_lake303_ember/WRFV3/test/em_real/' wrf_name2='lake303' wrf_temp2 = WRF_timeseries.get_ts_data(wrf_dir2+station+'.d02.TS','t')-273.15 wrf_u2 = WRF_timeseries.get_ts_data(wrf_dir2+station+'.d02.TS','u') wrf_v2 = WRF_timeseries.get_ts_data(wrf_dir2+station+'.d02.TS','v') wrf_time2 = WRF_timeseries.get_ts_data(wrf_dir2+station+'.d02.TS','ts_hour') # calculate the wind speed and direction from u and v wrf_spd2 = wind_calcs.wind_uv_to_spd(wrf_u2,wrf_v2)