我从以下代码中得到一个ZeroDivisionError
:
#stacking the array into a complex array allows np.unique to choose
#truely unique points. We also keep a handle on the unique indices
#to allow us to index `self` in the same order.
unique_points,index = np.unique(xdata[mask]+1j*ydata[mask],
return_index=True)
#Now we break it into the data structure we need.
points = np.column_stack((unique_points.real,unique_points.imag))
xx1,xx2 = self.meta['rcm_xx1'],self.meta['rcm_xx2']
yy1 = self.meta['rcm_yy2']
gx = np.arange(xx1,xx2+dx,dx)
gy = np.arange(-yy1,yy1+dy,dy)
GX,GY = np.meshgrid(gx,gy)
xi = np.column_stack((GX.ravel(),GY.ravel()))
gdata = griddata(points,self[mask][index],xi,method='linear',
fill_value=np.nan)
这里,xdata
,ydata
和{dtype=np.float32
的2D{mask
是具有相同形状和dtype=bool
的2dndarray
。这里有一个链接给那些想阅读^{
最初,xdata
和{
不管怎样,如果我使用“nearest”方法,代码“有效”(没有例外)。在
目前没有回答
相关问题 更多 >
编程相关推荐