AnsweredAssumed Answered

arcpy.NumpyToRaster fails with error two or three dimensional NumPy array is required

Question asked by friedcc on Oct 31, 2019
Latest reply on Nov 7, 2019 by friedcc

The following code:

 

arcpy.AddMessage("shape of zOutput {} ".format(zOutput.shape))
arcpy.AddMessage("no of dimensions of zOutput {}".format(zOutput.ndim))
# Convert array to a geodatabase raster
myRaster = arcpy.NumPyArrayToRaster(zOutput, arcpy.Point(xmin,ymin), cellsize, cellsize, -999999)

 

produces the following output. As you can see the numpy array IS two dimensional. Yet NumPyArrayToRaster fails.

 

 

 

shape of zOutput (375, 524)
no of dimensions of zOutput 2
...
ValueError: Argument in_array: A two or three dimensional NumPy array is required.

 

 

 

Is this a bug in NumPyToRaster?  Is there some other way to export a numpy array to a raster?

  

Outcomes