停止光栅重新采样光栅数据

2024-10-04 01:33:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用光栅绘制一个光栅,但不知何故,我认为这些数据正在被重新采样

创建的地图不显示数据中的详细信息。请看这里: python plot

…与原始数据(使用GIS绘制)相比: topo data

知道如何阻止rasterio插值/重新采样数据吗

这是我的密码:

import rasterio 
from rasterio.plot import show
import matplotlib.pyplot as plt

topo = rasterio.open('../topo_raster/nz100dem2ihs21.tif')
nz_mask_file  = '../gis_data/NZ_mask.shp'
nzmask  = gpd.read_file(nz_mask_file)

fig= plt.figure(dpi=300. )
ax = plt.axes( projection=ccrs.epsg(27200))

show(topo.read(1,masked=True), ax=ax,transform=topo.transform,interpolation='none',zorder=1,cmap='gist_gray')
nzmask.plot(ax=ax,facecolor="white", edgecolor='black', lw=linewidths_rr,zorder=0.5)

plt.savefig('../newzealand.png')
plt.clf()

Tags: 数据importdataplot光栅show绘制plt