Hi, thankfully found this thread unfortunately not before wasting a lot of time
I ran the hillshade tool and then exported the code to a notebook which failed on the save method as shown
AttributeError Traceback (most recent call last)
In [56]:
Line 25: out_raster.save(r"C:\Users\hack\AppData\Local\Temp\ArcGISProTemp24040\Untitled\Default.gdb\HillSha_dem_98
AttributeError: 'Result' object has no attribute 'save
Looked at the ESRI sample code for the Hillshade tool and that also shows the .save method
Found an ESRI video which also encourages the use of the save method on raster output
https://mediaspace.esri.com/media/t/1_dekwby9u
Anyway finally got this working
import arcpy
arcpy.ImportToolbox(r"C:\Program Files\ArcGIS\Pro\Resources\ArcToolBox\toolboxes\Spatial Analyst Tools.tbx")
arcpy.env.extent = "1262500 5002500 1263000 5003000"
out_raster = arcpy.sa.HillShade(
in_raster="dem_8m",
azimuth=315,
altitude=45,
model_shadows="NO_SHADOWS",
z_factor=1
)
#the type being returned by this function is a result object SO need to cast the raster to the raster type
Raster(out_raster).save(r"C:\Users\hack\AppData\Local\Temp\ArcGISProTemp24040\Untitled\Default.gdb\HillShade_dem")
arcpy.Delete_management(Raster(out_raster), '')
Hopefully helps someone