colors3=[(35/255,35/255,35/255),(66/255,21/255,21/255),(126/255,1/255,1/255),(186/255,0/255,0/255),(255/255,45/255,0/255), (255/255,155/255,0/255),(253/255,255/255,2/255), (192/255,255/255,63/255), (96/255,255/255,159/255),(0,249/255,255/255),(0,151/255,255/255),(0/255, 59/255, 255/255), (0/255, 0/255, 190/255),(239/255, 239/255, 239/255), (210/255, 210/255, 210/255),(167/255, 167/255, 167/255),(135/255, 135/255, 135/255), (110/255, 110/255, 110/255), (89/255, 89/255, 89/255),(65/255,65/255,65/255)] cmap3 = ListedColormap(colors3) newcmap3 = ListedColormap(cmap3(np.linspace(0, 1, 20))) # Create the figure and plot background on different axes clevs_sat = np.arange(-70,35,5) # cmap = plt.get_cmap('gist_ncar') # newcmap = ListedColormap(cmap(np.linspace(0.15, 0.9, 30))) time = data_dbz['bref'].metpy.time data_crs = data_dbz['bref'].metpy.time crs = ccrs.Mercator() for i in range(2): fig, axarr = plt.subplots(nrows=1, ncols=2, figsize=(25, 10), constrained_layout=False, subplot_kw={'projection': crs}) # Set height padding for plots fig.set_constrained_layout_pads(w_pad=0., h_pad=10, hspace=0., wspace=0.) axlist = axarr.flatten() for ax in axlist: plot_background(ax) # Upper left plot cf1 = axlist[0].contourf(dbz.longitude, dbz.latitude, dbz.metpy.loc[{'time': time[i]}], clevs_dbz, cmap=newcmap2, transform=ccrs.PlateCarree()) #ccf1= axlist[0].contour(gust.longitude, gust.latitude, gust.metpy.loc[{'time': time[i]}]*3.6, #clevs_gust, colors='darkviolet', transform=ccrs.PlateCarree()) #axlist[0].clabel(ccf1, fontsize=10, inline=1, inline_spacing=1, fmt='%i', rightside_up=True) axlist[0].set_title('850 hPa Reflectivity', fontsize=16) cb1= fig.colorbar(cf1, ax=axlist[0], orientation='vertical', ticks=(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70), shrink=0.90, fraction=0.1, pad=0) cb1.set_label('dBZ', size='x-large') cf2 = axlist[1].contourf(clbt.longitude, clbt.latitude, clbt.metpy.loc[{'time': time[i]}]-273.15, clevs_sat, cmap=newcmap3, transform=ccrs.PlateCarree()) #ccf2= axlist[1].contour(gust.longitude, gust.latitude, gust.metpy.loc[{'time': time[i]}]*3.6, #clevs_gust, colors='black', transform=ccrs.PlateCarree()) #axlist[0].clabel(ccf2, fontsize=10, inline=1, inline_spacing=1, fmt='%i', rightside_up=True) axlist[1].set_title('Synthetic MSG SEVIRI Image at 10.8 μm', fontsize=16) cb2= fig.colorbar(cf2, ax=axlist[1], orientation='vertical',ticks=(-70,-60,-50,-40,-30,-20,-10,0,10,20,30), shrink=0.90, fraction=0.1, pad=0) cb2.set_label('°C', size='x-large') # Set figure title plt.gcf().text(0.125, 0.94, 'Model: ICON-D2 0.02° | ' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC | ') + data_dbz['time'][i].dt.strftime('Valid: %d.%m.%Y %H:%M UTC').values,fontsize=20) #plt.gcf().text(0.55, 0.09, 'Note: Updraft helicity is vertically averaged between 500 and 6000 m AGL.', fontsize=10) # Display the plot time2 = str(i*1+1) base_filename='icond2_comp2_' suffix='.jpeg' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="jpeg", bbox_inches='tight', dpi=85) plt.close(fig)cape = data_sfc['cape'].where(data_sfc['cape']<50,np.nan) for i in range(16): time = data_sfc['u10'].metpy.time data_crs = data_sfc['u10'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs_qv = np.arange(50, 600, 50) clevs_cape= np.arange(100,3000,200) cmap = ctables.colortables.get_colortable('rainbow') mxcape = ax.contourf(data_ml.longitude, data_ml.latitude, srh3km.metpy.loc[{'time': time[i]}], clevs_qv, cmap='plasma_r', transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', ticks=(50,100,150,200,250,300,350,400,450,500,550), shrink=0.7, aspect=30, pad=0.025) #cb.set_label('kg kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, cape.metpy.loc[{'time': time[i]}], clevs_cape, colors='black', linestyles='dotted', linewidths=2.5, transform=data_crs) plt.clabel(maxcapes, fmt='%d', fontsize=16, rightside_up=True) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('0-3 km SRH (shaded, m²/s²) & CAPE (dotted lines, J/kg)\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.18, 'Data: ECMWF HRES', fontsize=12) plt.gcf().text(0.125, 0.20, 'Note: SRH is calculated for a right-moving supercell.', fontsize=14) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_srh_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")for i in range(16): time = data_sfc['u10'].metpy.time data_crs = data_sfc['u10'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs_qv = np.arange(0, 325, 25) cmap = ctables.colortables.get_colortable('rainbow') mxcape = ax.contourf(data_ml.longitude, data_ml.latitude, srh1km.metpy.loc[{'time': time[i]}], clevs_qv, cmap='plasma_r', transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', shrink=0.7, aspect=30, pad=0.025) #cb.set_label('kg kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, srh500m.metpy.loc[{'time': time[i]}], [50,100,150,200], colors='black', linestyles='dotted', linewidths=2.5, transform=data_crs) plt.clabel(maxcapes, fmt='%d', fontsize=16, rightside_up=True) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('0-1 km SRH (shaded, m²/s²) & 0-500 m SRH (dotted lines, m²/s²)\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.18, 'Data: ECMWF HRES', fontsize=12) plt.gcf().text(0.125, 0.20, 'Note: SRH is calculated for a right-moving supercell.', fontsize=14) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_srh1_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")for i in range(16): time = data_sfc['u10'].metpy.time data_crs = data_sfc['cape'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs_qv = np.arange(-100, 3800, 300) # cmap = plt.get_cmap('gist_ncar') # newcmap = ListedColormap(cmap(np.linspace(0.15, 0.9, 30))) colors=[(1,1,1),(0.0, 0.9254901960784314, 0.9254901960784314), (0.00392156862745098, 0.6274509803921569, 0.9647058823529412), (0.0, 0.0, 0.9647058823529412), (0.0, 1.0, 0.0), (0.0, 0.7843137254901961, 0.0), (0.0, 0.5647058823529412, 0.0), (1.0, 1.0, 0.0), (0.9058823529411765, 0.7529411764705882, 0.0), (1.0, 0.5647058823529412, 0.0), (1.0, 0.16078431372, 0.16078431372), (0.7529411764705882, 0.0, 0.0), (0.59765625, 0.0, 0.0), (1.0, 0.0, 1.0), (0.6, 0.3333333333333333, 0.788235294117647), (0.27,0,0.4)] cmap1 = ListedColormap(colors) newcmap = ListedColormap(cmap1(np.linspace(0, 1, 17))) mxcape = ax.contourf(data_ml.longitude, data_ml.latitude, cape.metpy.loc[{'time': time[i]}], clevs_qv, cmap=newcmap, transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', ticks=(200,500,800,1100,1400,1700,2000,2300,2600,2900,3200,3500), shrink=0.7, aspect=30, pad=0.025) #cb.set_label('kg kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) #maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, cape.metpy.loc[{'time': time[i]}], #[200], colors='black', linestyles='dotted', linewidths=2, transform=data_crs) #plt.clabel(maxcapes, fmt='%d', fontsize=14) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #ulls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vlls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='blue', transform=data_crs, length=8) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #umls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vmls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='red', transform=data_crs, length=8) wind_slice = (slice(None, None, 3), slice(None, None, 3)) ax.barbs(x[wind_slice[0]], y[wind_slice[1]], udls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, vdls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, pivot='middle', color='red',transform=data_crs, length=8, zorder=5) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('CAPE (shaded, J/kg) & 0-6 km shear vector (kts)\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.20, 'Data: ECMWF HRES', fontsize=12) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_capeshear_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")for i in range(16): time = data_sfc['u10'].metpy.time data_crs = data_sfc['u10'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs_qv = np.arange(-100, 3800, 300) # cmap = plt.get_cmap('gist_ncar') # newcmap = ListedColormap(cmap(np.linspace(0.15, 0.9, 30))) colors=[(1,1,1),(0.0, 0.9254901960784314, 0.9254901960784314), (0.00392156862745098, 0.6274509803921569, 0.9647058823529412), (0.0, 0.0, 0.9647058823529412), (0.0, 1.0, 0.0), (0.0, 0.7843137254901961, 0.0), (0.0, 0.5647058823529412, 0.0), (1.0, 1.0, 0.0), (0.9058823529411765, 0.7529411764705882, 0.0), (1.0, 0.5647058823529412, 0.0), (1.0, 0.16078431372, 0.16078431372), (0.7529411764705882, 0.0, 0.0), (0.59765625, 0.0, 0.0), (1.0, 0.0, 1.0), (0.6, 0.3333333333333333, 0.788235294117647), (0.27,0,0.4)] cmap1 = ListedColormap(colors) newcmap = ListedColormap(cmap1(np.linspace(0, 1, 17))) mxcape = ax.contourf(data_ml.longitude, data_ml.latitude, cape.metpy.loc[{'time': time[i]}], clevs_qv, cmap=newcmap, transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', ticks=(200,500,800,1100,1400,1700,2000,2300,2600,2900,3200,3500), shrink=0.7, aspect=30, pad=0.025) #cb.set_label('kg kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) #maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, cape.metpy.loc[{'time': time[i]}], #[200], colors='black', linestyles='dotted', linewidths=2, transform=data_crs) #plt.clabel(maxcapes, fmt='%d', fontsize=14) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #ulls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vlls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='blue', transform=data_crs, length=8) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #umls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vmls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='red', transform=data_crs, length=8) wind_slice = (slice(None, None, 3), slice(None, None, 3)) ax.barbs(x[wind_slice[0]], y[wind_slice[1]], umls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, vmls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, pivot='middle', color='red',transform=data_crs, length=8, zorder=5) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('CAPE (shaded, J/kg) & 0-3 km shear vector (kts)\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.20, 'Data: ECMWF HRES', fontsize=12) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_capeshear3_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")for i in range(16): time = data_sfc['u10'].metpy.time data_crs = data_sfc['u10'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs_qv = np.arange(-100, 3800, 300) # cmap = plt.get_cmap('gist_ncar') # newcmap = ListedColormap(cmap(np.linspace(0.15, 0.9, 30))) colors=[(1,1,1),(0.0, 0.9254901960784314, 0.9254901960784314), (0.00392156862745098, 0.6274509803921569, 0.9647058823529412), (0.0, 0.0, 0.9647058823529412), (0.0, 1.0, 0.0), (0.0, 0.7843137254901961, 0.0), (0.0, 0.5647058823529412, 0.0), (1.0, 1.0, 0.0), (0.9058823529411765, 0.7529411764705882, 0.0), (1.0, 0.5647058823529412, 0.0), (1.0, 0.16078431372, 0.16078431372), (0.7529411764705882, 0.0, 0.0), (0.59765625, 0.0, 0.0), (1.0, 0.0, 1.0), (0.6, 0.3333333333333333, 0.788235294117647), (0.27,0,0.4)] cmap1 = ListedColormap(colors) newcmap = ListedColormap(cmap1(np.linspace(0, 1, 17))) mxcape = ax.contourf(data_ml.longitude, data_ml.latitude, cape.metpy.loc[{'time': time[i]}], clevs_qv, cmap=newcmap, transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', ticks=(200,500,800,1100,1400,1700,2000,2300,2600,2900,3200,3500), shrink=0.7, aspect=30, pad=0.025) #cb.set_label('kg kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) #maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, cape.metpy.loc[{'time': time[i]}], #[200], colors='black', linestyles='dotted', linewidths=2, transform=data_crs) #plt.clabel(maxcapes, fmt='%d', fontsize=14) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #ulls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vlls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='blue', transform=data_crs, length=8) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #umls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vmls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='red', transform=data_crs, length=8) wind_slice = (slice(None, None, 3), slice(None, None, 3)) ax.barbs(x[wind_slice[0]], y[wind_slice[1]], ulls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, vlls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, pivot='middle', color='red',transform=data_crs, length=8, zorder=5) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('CAPE (shaded, J/kg) & 0-1 km shear vector (kts)\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.20, 'Data: ECMWF HRES', fontsize=12) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_capeshear1_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")# for i in range(16): time = data_sfc['u10'].metpy.time data_crs = data_sfc['u10'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs_qv = np.arange(0, 3750, 250) # cmap = plt.get_cmap('gist_ncar') # newcmap = ListedColormap(cmap(np.linspace(0.15, 0.9, 30))) colors=[(1,1,1),(0.0, 0.9254901960784314, 0.9254901960784314), (0.00392156862745098, 0.6274509803921569, 0.9647058823529412), (0.0, 0.0, 0.9647058823529412), (0.0, 1.0, 0.0), (0.0, 0.7843137254901961, 0.0), (0.0, 0.5647058823529412, 0.0), (1.0, 1.0, 0.0), (0.9058823529411765, 0.7529411764705882, 0.0), (1.0, 0.5647058823529412, 0.0), (1.0, 0.16078431372, 0.16078431372), (0.7529411764705882, 0.0, 0.0), (0.59765625, 0.0, 0.0), (1.0, 0.0, 1.0), (0.6, 0.3333333333333333, 0.788235294117647), (0.27,0,0.4)] cmap1 = ListedColormap(colors) newcmap = ListedColormap(cmap1(np.linspace(0, 1, 16))) mxcape = ax.contourf(data_ml.longitude, data_ml.latitude, wmaxshear.metpy.loc[{'time': time[i]}], clevs_qv, cmap=newcmap, transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', shrink=0.7, aspect=30, pad=0.025) #cb.set_label('kg kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) #maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, wmaxshear.metpy.loc[{'time': time[i]}], #[1000], colors='black', linestyles='dotted', linewidths=2, transform=data_crs) #plt.clabel(maxcapes, fmt='%d', fontsize=14) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #ulls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vlls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='blue', transform=data_crs, length=8) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #umls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vmls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='red', transform=data_crs, length=8) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('WMAXSHEAR (m²/s²)\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.20, 'Data: ECMWF HRES', fontsize=12) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_wmaxshear_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")for i in range(16): time = data_sfc['cape'].metpy.time data_crs = data_sfc['cape'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs_qv = np.arange(0, 9.5, 0.5) cmap = plt.get_cmap('CMRmap_r') newcmap = ListedColormap(cmap(np.linspace(0, 0.9, 20))) mxcape = ax.contourf(data_sfc.longitude, data_sfc.latitude, ehi3.metpy.loc[{'time': time[i]}], clevs_qv, cmap=newcmap, transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', shrink=0.7, aspect=30, pad=0.025) #cb.set_label('kg kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) cb.set_ticks([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) #maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, ehi1.metpy.loc[{'time': time[i]}], #levels=[1, 3, 5, 7, 9], colors='black', linestyles='dotted', linewidths=2, transform=data_crs) #plt.clabel(maxcapes, fmt='%d', fontsize=14) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #ulls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vlls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='blue', transform=data_crs, length=8) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #umls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vmls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='red', transform=data_crs, length=8) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('0-3 km EHI\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.18, 'Data: ECMWF HRES', fontsize=12) plt.gcf().text(0.125, 0.20, 'Note: EHI is calculated as follows (CAPE x SRH)/(16 x 10⁴).', fontsize=14) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_ehi_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")for i in range(16): time = data_sfc['cape'].metpy.time data_crs = data_sfc['cin'].metpy.cartopy_crs fig = plt.figure(1, figsize=(18, 18)) ax = fig.add_subplot(111, projection=ccrs.Mercator()) ax.set_extent([1, 10, 47, 52]) clevs = np.arange(950, 1050, 1) clevs_cin = np.arange(0,500, 50) cmap = plt.get_cmap('gist_ncar') newcmap = ListedColormap(cmap(np.linspace(0.15, 0.8, 30))) cin_smooth = mpcalc.smooth_n_point(cin.metpy.loc[{'time': time[i]}]) mslp_smooth = mpcalc.smooth_n_point(mslp.metpy.loc[{'time': time[i]}]) mxcape = ax.contourf(data_sfc.longitude, data_sfc.latitude, cin.metpy.loc[{'time': time[i]}], clevs_cin, cmap=newcmap, transform=data_crs) cb = plt.colorbar(mxcape, orientation='vertical', shrink=0.7, aspect=30, pad=0.025) #cb.set_label('J kg⁻¹', fontsize=18) cb.ax.tick_params(labelsize=16) maxcapes = ax.contour(data_ml.longitude, data_ml.latitude, mslp_smooth, clevs, colors='black', linestyles='solid', linewidths=2, transform=data_crs) plt.clabel(maxcapes, fmt='%d', fontsize=14) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #ulls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vlls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='blue', transform=data_crs, length=8) #wind_slice = (slice(None, None, 4), slice(None, None, 4)) #ax.barbs(x[wind_slice[0]], y[wind_slice[1]], #umls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #vmls.metpy.loc[{'time': time[i]}].values[wind_slice[0], wind_slice[1]]*1.94384, #pivot='tip', color='red', transform=data_crs, length=8) gl = ax.gridlines(draw_labels=True,linewidth=0.5, color='gray', alpha=0.5, linestyle='--') gl.xlabels_top = False gl.ylabels_right = False gl.xlabel_style = {'size': 12, 'color': 'black'} gl.ylabel_style = {'size': 12, 'color': 'black'} gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER ax.add_feature(cfeature.COASTLINE.with_scale('10m'), LineWidth=3) ax.add_feature(cfeature.BORDERS.with_scale('10m'),LineWidth=3) plt.title('CIN (shaded, J/kg) & MSLP (black lines, hPa)\n' + timeinit.strftime('Init: %d.%m.%Y %H:%M UTC ') + time[i].dt.strftime(' Valid: %d.%m.%Y %H:%M UTC').item(), fontsize=18) plt.gcf().text(0.125, 0.20, 'Data: ECMWF HRES', fontsize=12) #plt.gcf().text(0.125, 0.20, 'Note: EHI is calculated as follows (CAPE x SRH)/(16 x 10⁴).', fontsize=14) #time2 = time[i].dt.strftime('%Y%m%d%H%M').item() time2 = str(i*3+3) base_filename='ecmwf_mslpcin_' suffix='.png' latest='latest' my_file = base_filename+time2+suffix print(my_file) plt.savefig(my_file, format="png", bbox_inches='tight', dpi=75) plt.close("all")