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 32 33 34 35 36 37 38 39 40 41 42
| fig = plt.figure(figsize=(15, 12))
ax1 = fig.add_subplot(1,2,1, projection=ccrs.PlateCarree())
ax1.set_extent([100,160,-10,40])
ax1.coastlines() ax1.add_feature(cfeature.LAND)
ax1.set_xticks(np.arange(100,170,10), crs=ccrs.PlateCarree()) ax1.set_yticks(np.arange(-10,50,10), crs=ccrs.PlateCarree()) ax1.xaxis.set_major_formatter(cticker.LongitudeFormatter()) ax1.yaxis.set_major_formatter(cticker.LatitudeFormatter())
ax1.plot(lon,lat,linewidth=2) s1 = ax1.scatter(lon,lat,c=pressure,s=(level+1)*13,cmap='Reds_r',vmax=1050,vmin=900,alpha=1) fig.colorbar(s1,ax=ax1,fraction=0.04)
ax2 = fig.add_subplot(1,2,2, projection=ccrs.PlateCarree())
ax2.set_extent([100,160,-10,40])
ax2.coastlines() ax2.add_feature(cfeature.LAND)
ax2.set_xticks(np.arange(100,170,10), crs=ccrs.PlateCarree()) ax2.set_yticks(np.arange(-10,50,10), crs=ccrs.PlateCarree()) ax2.xaxis.set_major_formatter(cticker.LongitudeFormatter()) ax2.yaxis.set_major_formatter(cticker.LatitudeFormatter())
points = np.array([lon, lat]).T.reshape(-1, 1, 2) segments = np.concatenate([points[:-1], points[1:]], axis=1)
norm = plt.Normalize(0, 80)
lc = LineCollection(segments, cmap='jet', norm=norm,transform=ccrs.PlateCarree()) lc.set_array(dat.WND[:-1])
line = ax2.add_collection(lc) fig.colorbar(lc,ax=ax2,fraction=0.04) plt.show()
|