1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| def contour_map(fig,img_extent,spec1,spec2): fig.set_extent(img_extent, crs=ccrs.PlateCarree()) fig.add_feature(cfeature.COASTLINE.with_scale('50m')) fig.add_feature(cfeature.LAKES, alpha=0.5) fig.set_xticks(np.arange(leftlon,rightlon+spec1,spec1), crs=ccrs.PlateCarree()) fig.set_yticks(np.arange(lowerlat,upperlat+spec2,spec2), crs=ccrs.PlateCarree()) lon_formatter = cticker.LongitudeFormatter() lat_formatter = cticker.LatitudeFormatter() fig.xaxis.set_major_formatter(lon_formatter) fig.yaxis.set_major_formatter(lat_formatter)
vmin = 10 vmax = 34 interval = 2 boundaries = np.arange(vmin, vmax + interval, interval) norm = BoundaryNorm(boundaries, plt.get_cmap('jet').N, clip=True)
leftlon, rightlon, lowerlat, upperlat = (0,360,0,90) img_extent = [leftlon, rightlon, lowerlat, upperlat] proj = ccrs.PlateCarree(central_longitude=150)
fig1 = plt.figure(figsize=(12,8)) f1_ax1 = fig1.add_axes([0.1, 0.1, 0.8, 0.4],projection = proj) contour_map(f1_ax1,img_extent,60,30) c1 = f1_ax1.pcolormesh(lon,lat,wbgt_mean.mean('time'),norm=norm, transform=ccrs.PlateCarree(),cmap=cmaps.WhiteBlueGreenYellowRed,zorder=0) f1_ax1.add_feature(cfeature.OCEAN.with_scale('50m'),facecolor='white',zorder=1)
cbar1 = fig1.colorbar(c1,cax=fig1.add_axes([0.35, 0.05, 0.3, 0.025]),orientation='horizontal',format='%d',) cbar1.set_label('unit: °C',fontsize=14)
|