NumPyArrayToRaster produces unexpected results when passed a view of a NumPy array.
上次发布: August 25, 2014ArcGIS for Desktop
漏洞 ID 编号
NIM072404
已提交
September 7, 2011
上次修改时间
June 5, 2024
适用范围
ArcGIS for Desktop
找到的版本
10.0
操作系统
Windows OS
操作系统版本
XP 64 Bit
修正版本
10.1
状态
Fixed
此漏洞已得到修复。 有关详细信息,请参阅“版本修复”和“其他信息”(如果适用)。
解决办法
z[:,::-1] creates a view of the array. NumPyArrayToRaster requires a NumPy array object.1) Pass np.array(z[:,::-1]) which creates a new copy of the array.ex. grid1=arcpy.NumPyArrayToRaster( np.array(z[:,::-1]),xyOrig,np.abs(dx),np.abs(dy))2) Use the .copy() method to create a new copy of the reorder array.ex. grid1=arcpy.NumPyArrayToRaster(z[::-1,:].copy(),xyOrig,np.abs(dx),np.abs(dy))