I'm trying to save a raster after calculation in numpy array. Here is what I wrote:
rasterSM = arcpy.NumPyArrayToRaster(SM, lowerLeft, cellSize, value_to_nodata=nodata)
rasterSM2 = arcpy.DefineProjection_management(rasterSM, spatial_ref)
rasterSM2.save(SMOutputName)
But the error message says that 'Result' object has no attribute 'save', then out to save a raster from Numpy array?
1 Answer 1
I believe the problem is that you are trying to save a non-raster object rasterSM2
. Instead, try:
rasterSM.save(SMOutputName)
Once that is complete, then define the projection using:
arcpy.DefineProjection_management(SMOutputName, spatial_ref)
answered Jan 2, 2016 at 5:03
lang-py
SMOutputName
look like?rasterSM2
. Instead, tryrasterSM.save(SMOutputName)
. Once that is complete then define the projection usingarcpy.DefineProjection_management(SMOutputName, spatial_ref)