import scipy.interpolate as il #for griddata
# meshgrid of coords in this tile
gridX, gridY = np.meshgrid(xi[c*tcols:(c+1)*tcols], yi[r*trows:(r+1)*trows][::-1])
## Creating the DEM in this tile
zi = il.griddata((coordsT[0], coordsT[1]), coordsT[2], (gridX, gridY),method='linear',fill_value = nodata) # fill_value to prevent NaN at polygon outline
最后我用了scipy.interpolate-函数名为griddata。这使用一个meshgrid来获取网格中的坐标,由于meshgrid的内存限制,我不得不将其平铺。在
线性插值似乎正是我想要的。参见https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html上的说明
相关问题 更多 >
编程相关推荐