首页 > 解决方案 > 像素化地图matplot到“平滑地图”?

问题描述

渲染带有netcdf信息的地图我有下面的图像,但它是像素化的,是否有一种形式可以像第二张图像一样渲染“平滑地图”?

#Variables netcdf file
lons = ds.variables['longitude'][:]
lats = ds.variables['latitude'][:]
time = ds.variables['time'][:]
data = ds.variables['tc_ch4'][:]

#map Basemap
mp = Basemap(projection = 'merc',
             llcrnrlon = -95.030665,
             llcrnrlat = 5.2,
             urcrnrlon = -72.960931,
             urcrnrlat = 18.961754,
             resolution = 'i')

lon, lat = np.meshgrid(lons, lats)
x, y = mp(lon, lat)

cscheme = mp.pcolor(x, y, np.squeeze(data[1,:,:]), cmap = 'YlOrRd')
cbar = mp.colorbar(cscheme, location = 'right')
mp.drawcoastlines(linewidth=0.3)
mp.drawstates(linewidth=0.1)
mp.drawcountries(linewidth=0.1)
fecha = t[i].strftime('%Y-%m')
plt.title('Columna Total de Metano - kg m**-2')
plt.xlabel('Año-Mes 2003-01')    
plt.show()

使用上面的代码生成的图像

使用Panoply生成的图像

标签: pythonmatplotlibmatplotlib-basemapnetcdf4

解决方案


推荐阅读