plot_kld_5min[np.logical_not(radar_mask)] = np.nan plot_kld_diff[np.logical_not(radar_mask)] = np.nan #Axes limits #my_axes = [icoldelta*(icol-1)+hmargin+hoffset,irowdelta*(irow-1)+vmargin+voffset,irowdelta-2*hmargin,icoldelta-2*vmargin] ax = axs[ irow, icol] #plt.axes( my_axes , facecolor=None , projection=ccrs.PlateCarree() ) #The pcolor ncolors = 12 smin = -60 smax = 60 delta = (smax - smin) / ncolors #p=ax.pcolor(lon , lat , np.transpose( np.squeeze( plot_kld_5min ) ) , # transform=ccrs.PlateCarree(),vmin=smin , vmax=smax ,cmap=cpf.cmap_discretize('YlGn',21) ) my_map = cpf.cmap_discretize('coolwarm', 11) p = ax.contourf(lon, lat, np.transpose(np.squeeze(plot_kld_diff)), transform=ccrs.PlateCarree(), vmin=smin, vmax=smax, cmap=my_map) #m = plt.cm.ScalarMappable(cmap=my_map) #m.set_array(np.transpose(plot_kld_diff)) #m.set_clim(smin,smax) #cb=plt.colorbar(m,ax=ax,shrink=0.9,boundaries=np.arange(smin,smax+delta,delta)) ax.set_extent(axesrange, ccrs.PlateCarree()) gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
fig = plt.figure(1, figsize=[6.5, 5]) ax = fig.add_subplot(111, projection=ccrs.PlateCarree()) #The pcolor smin = np.nanmin(my_data['topo']) smax = np.nanmax(my_data['topo']) p = ax.pcolor(lon, lat, topo, transform=ccrs.PlateCarree(), vmin=smin, vmax=smax, cmap=cpf.cmap_discretize('copper_r', 41)) ax.set_extent(axesrange, ccrs.PlateCarree()) topo[topo > 1.2] = np.nan #Colorbar cb = plt.colorbar(p, ax=ax, orientation='vertical', shrink=0.9) cb.ax.tick_params(labelsize=10) p = ax.pcolor(lon, lat, topo, transform=ccrs.PlateCarree(), vmin=-1.0, vmax=10.0, cmap=cpf.cmap_discretize('Blues_r', 10)) ax.set_extent(axesrange, ccrs.PlateCarree())
# for key in skew : for var in plot_variables : if var in ctl_dict['var_list'] : #Plot moments. my_skew=skew[var] #my_skew[ my_skew > 100 ] = np.nan #There are som inf values in the reflectivity field. my_skew[ my_skew == undef ] = np.nan print('Skew for Var ',var,' ',(np.nanmin(my_skew)),np.nanmax(my_skew)) date=ctime.strftime("%Y%m%d%H%M%S") cpf.set_default() #Restore defaults my_map=cpf.cmap_discretize('RdBu_r',10) cpf.figconf['figpath']=plotbasedir cpf.figconf['figsize']=(12,10) cpf.figconf['titlefontsize']=20 cpf.figconf['labelfontsize']=12 cpf.figconf['pcolor']=True cpf.figconf['shadedmin']=-1.5 if var == 'w' : cpf.figconf['shadedmax']=1.5 else : cpf.figconf['shadedmax']=1.5 cpf.figconf['shadedcolormap']=my_map cpf.figconf['colorbar']=False cpf.figconf['colorbarfontsize']=15 cpf.figconf['axessize']=[0.1,0.1,0.8,0.8] cpf.figconf['contour']=True
ctl=ctl_dict, records=np.array([0, 1])) lat = np.squeeze(tmp[:, :, 1]) lon = np.squeeze(tmp[:, :, 0]) #========================================================= # READ'N PLOT #========================================================= import matplotlib import matplotlib.pyplot as plt import matplotlib.ticker as mticker from matplotlib import patches ncolors = 10 my_map = cpf.cmap_discretize('Blues', ncolors) tmp_lon = lon[90, :] levels = ctl_dict['vlevels'] tick_levels = [1000, 850, 700, 500, 300] levels_str = list() levels = np.delete(levels, 4, axis=0) levels[3] = 850.0 titles = ['(a)', '(b)', '(c)', '(d)', '(e)', '(f)', '(g)', '(h)', '(i)'] #Get the level string list. levels_str = [] for ilev in tick_levels: levels_str.append(str(int(ilev)))
#ax=plt.subplot(121,projection=ccrs.PlateCarree()) ax1 = axs[0, 0] #plt.axes([0.05, 0.075, 0.44, 1.0],projection=ccrs.PlateCarree()) #ax = fig.add_subplot(111, projection=ccrs.PlateCarree()) #The pcolor smin = np.nanmin(my_data['topo']) smax = np.nanmax(my_data['topo']) p = ax1.pcolor(lon, lat, topo, transform=ccrs.PlateCarree(), vmin=smin, vmax=smax, cmap=cpf.cmap_discretize('copper_r', 41)) topo[topo > 1.2] = np.nan #Colorbar p = ax1.pcolor(lon, lat, topo, transform=ccrs.PlateCarree(), vmin=-1.0, vmax=10.0, cmap=cpf.cmap_discretize('Blues_r', 10)) gl = ax1.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, linewidth=1.0, color='k', alpha=0.5,
xtick = [134.5, 135, 135.5, 136, 136.5, 137] ytick = [34, 34.5, 35, 35.5] axesrange = [134.97, 136.09, 34.36, 35.30] titles = [ '(a) - 5MIN ', '(b) - 2MIN ', '(c) - 1MIN ', '(d) - 30SEC ', '(e) - 5MIN-4D ', '(f) - 1MIN-4D ' ] for iexp, my_exp in enumerate(exps): varsh = plot_kld_mean[:, :, iexp] varc = plot_dbz_mean[:, :, iexp] if iexp == 0: my_map = cpf.cmap_discretize('Blues', 10) smin = 0 smax = 5.0 else: my_map = cpf.cmap_discretize('Spectral', 10) smin = -50.0 smax = 50.0 ax = axs[irow, icol] #Axes limits #my_axes = [icoldelta*(icol-1)+hmargin+hoffset,irowdelta*(irow-1)+vmargin+voffset,irowdelta-2*hmargin,icoldelta-2*vmargin] #ax = plt.axes( my_axes , facecolor=None , projection=ccrs.PlateCarree() ) #The pcolor