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")