def draw_rh(m, lons, lats, model, dsize, background, location, lat, lon, RUNDATE, VALIDDATE, fxx, alpha, half_box, barb_thin, level='2 m'): """ Relative Humidity, calculated for levels != '2 m' """ if level == '2 m': H = get_hrrr_variable(RUNDATE, 'RH:%s' % level, model=model, fxx=fxx, outDIR='/uufs/chpc.utah.edu/common/home/u0553130/temp/', verbose=False, value_only=True) else: # Must compute the RH from TMP and DPT H_DPT = get_hrrr_variable(RUNDATE, 'DPT:%s' % level, model=model, fxx=fxx, outDIR='/uufs/chpc.utah.edu/common/home/u0553130/temp/', verbose=False, value_only=True) H_TMP = get_hrrr_variable(RUNDATE, 'TMP:%s' % level, model=model, fxx=fxx, outDIR='/uufs/chpc.utah.edu/common/home/u0553130/temp/', verbose=False, value_only=True) H = {'value':Tempdwpt_to_RH(H_TMP['value']-273.15, H_DPT['value']-273.15)} m.pcolormesh(lons, lats, H['value'], cmap="RdYlGn", vmin=0, vmax=100, zorder=2, latlon=True) cbT = plt.colorbar(orientation='horizontal', pad=pad, shrink=shrink) cbT.set_label('%s Relative Humidity (%%)' % level)
def draw_vpd(m, lons, lats, model, dsize, background, location, lat, lon, RUNDATE, VALIDDATE, fxx, alpha, half_box, barb_thin, level='2 m', Fill=False, Crossover=False): """ Vapor Pressure Deficit: calculated from Temperature and Relative Humidity """ if level == '2 m': H_RH = get_hrrr_variable(RUNDATE, 'RH:%s' % level, model=model, fxx=fxx, outDIR='/uufs/chpc.utah.edu/common/home/u0553130/temp/', verbose=False, value_only=True) H_TMP = get_hrrr_variable(RUNDATE, 'TMP:%s' % level, model=model, fxx=fxx, outDIR='/uufs/chpc.utah.edu/common/home/u0553130/temp/', verbose=False, value_only=True) else: # Must compute the RH from TMP and DPT H_DPT = get_hrrr_variable(RUNDATE, 'DPT:%s' % level, model=model, fxx=fxx, outDIR='/uufs/chpc.utah.edu/common/home/u0553130/temp/', verbose=False, value_only=True) H_TMP = get_hrrr_variable(RUNDATE, 'TMP:%s' % level, model=model, fxx=fxx, outDIR='/uufs/chpc.utah.edu/common/home/u0553130/temp/', verbose=False, value_only=True) H_RH = {'value':Tempdwpt_to_RH(H_TMP['value']-273.15, H_DPT['value']-273.15)} if Fill: H_VPD = {'value': vapor_pressure_deficit(H_TMP['value']-273.15, H_RH['value'])} m.pcolormesh(lons, lats, H_VPD['value'], cmap="magma_r", vmin=0, vmax=70, zorder=2, latlon=True) cbT = plt.colorbar(orientation='horizontal', pad=pad, shrink=shrink) cbT.set_label('%s Vapor Pressure Deficit (hPa)' % level) if Crossover: difference = H_RH['value']-(H_TMP['value']-273.15) m.contour(lons, lats, difference, colors='white', linewidths=1.2, levels=[0], zorder=10, latlon=True)
press = np.column_stack([press, b['pres'][fxx]]) temps = np.column_stack([temps, b['temp'][fxx]]) dwpts = np.column_stack([dwpts, b['dwpt'][fxx]]) except: # It looks like the variable hasn't been created yet, so create it. heights = np.array(b['hght'][fxx]) press = np.array(b['pres'][fxx]) temps = np.array(b['temp'][fxx]) dwpts = np.array(b['dwpt'][fxx]) print 'Got it: f%02d' % (fxx), DATE DATE += timedelta(hours=1) # Derive a few more variables thetas = TempPress_to_PotTemp(temps, press) RHs = Tempdwpt_to_RH(temps, dwpts) # Calculate difference between potental temperture of columns and surface theta sfcThetas = thetas[0] diffThetas = thetas - sfcThetas # Because the contour funciton doesn't like dates, need to convert dates # to some other happy x axis number. Then the x axis dates can be formatted. x = matplotlib.dates.date2num(date_list) x2D = x * np.ones_like(heights) # === Begin Plots === #============================================================================== # Plot: Potential Temperature #==============================================================================