# 土地類型 from netCDF4 import Dataset import matplotlib.pyplot as plt from matplotlib.cm import get_cmap from mpl_toolkits.basemap import Basemap from landuse_colormap import *
from wrf import to_np, getvar, smooth2d, get_basemap, latlon_coords
# Convert the lats and lons to x and y. Make sure you convert the lats and # lons to numpy arrays via to_np, or basemap crashes with an undefined # RuntimeError. x, y = bm(to_np(lons), to_np(lats))
cm,labels = LU_MODIS21() im = plt.pcolormesh(x,y,to_np(LU_INDEX),cmap=cm,vmax=len(labels)+1,vmin=1) cbar = plt.colorbar(orientation='vertical',shrink=.98,pad=.02) cbar.set_ticks(np.arange(1.5,len(labels)+1)) cbar.ax.set_yticklabels(labels) plt.title('MODIS Land Use Categories') plt.savefig('1.png',bbox_inches='tight',dpi=300)
三、網(wǎng)格嵌套
3.1 結(jié)果
3.2 主程序
from salem import geogrid_simulator import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt