我是pyhton的新手, 我在显示自己裁剪的NC地图时遇到了问题
latbounds = [ -11 , 10 ]
lonbounds = [ 90 , 145]
lats = nc.variables['latitude'][:]
lons = nc.variables['longitude'][:]
latli = np.argmin( np.abs( lats - latbounds[0] ) )
latui = np.argmin( np.abs( lats - latbounds[1] ) )
lonli = np.argmin( np.abs( lons - lonbounds[0] ) )
lonui = np.argmin( np.abs( lons - lonbounds[1] ) )
temp=nc.variables['t2m'][1,latli:latui,lonli:lonui]-274
t_units = nc.variables['t2m'].units
nc.close()
然后获取底图
fig=plt.figure(figsize=(12, 8) )
m=Basemap(projection='mill',lat_ts=10,llcrnrlon=90, \
urcrnrlon=145,llcrnrlat=-11,urcrnrlat=10, \resolution='c')
Lon, Lat = np.meshgrid(latli:latui,lonli:lonui)
x, y = m(Lon, Lat)
m.pcolormesh(x,y,temp,shading='flat',cmap=plt.cm.hsv)
m.drawcoastlines(linewidth=0.1)
m.fillcontinents(color='black')
m.drawmapboundary()
m.drawparallels(np.arange(-11, 10, 5), labels=[1, 0, 0, 0], linewidth=0.1, color='k', fontsize=10)
m.drawmeridians(np.arange(90, 146, 20), labels=[0, 0, 0, 1], linewidth=0.1, color='k', fontsize=10)
我认为我在np.meshgrid上的错误,但是我不知道如何解决。