很抱歉这个简单的问题,但我是Python新手,我需要同样的帮助。在
我的数据是点格式的:X,Y,Z。其中X和Y是坐标,Z是值。在
我的问题是:创建一个0.5 m x 0.5 m(或1 x 1 m)的光栅(在TIF或ASCII中),其中每个像素的值是Z的平均值。如果我在像素i中没有点,则该值需要为NAN。在
我真的很高兴能帮助我学习和实现一些代码
提前谢谢你的帮助,我真的很需要。在
我试着研究并编写代码:from osgeo import gdal, osr, ogr
import math, numpy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as ml
import matplotlib.delaunay
tiff = 'test.tif'
gridSize = 0.5
# my area boundary
xmax, xmin = 640000.06, 636999.83
ymax, ymin = 6070000.3, 6066999.86
# number of row and columns
nx = int(math.ceil(abs(xmax - xmin)/gridSize))
ny = int(math.ceil(abs(ymax - ymin)/gridSize))
# Plot the points
plt.scatter(x,y,c=z)
plt.axis([xmin, xma