AnsweredAssumed Answered

How to use Arcpy.Delete_management to delete rasters?

Question asked by rcostley_WaterInstitute on Feb 21, 2020
Latest reply on Feb 21, 2020 by rcostley_WaterInstitute

Hi! I have this piece of code that loops through a set of tins and creates contours. The piece of code will create a contour from the first tin, but on the next tin in the folder it says that the tin is unsupported. My last line of code calls it to delete a raster which I had working in memory "memory/tempraster", but now I've noticed when I don't put it in memory, It doesn't delete the raster. Can anyone help? Thanks


tin_list = arcpy.ListDatasets("*", "Tin")
if contour_options == self.contourBase[0]:
    for tin in tin_list:
        outcontname =tin+"_cont"
        outcontnamelyr = os.path.basename(os.path.normpath(tin))+"_cont_lyr"
        arcpy.AddMessage("TIN to raster")
        arcpy.TinRaster_3d(tin, "raster","FLOAT", "NATURAL_NEIGHBORS","CELLSIZE %s"%(raster_options))
        contResult = arcpy.Contour_3d( "raster",outcontname,1.0,0.0)
        while contResult.status < 4:
        arcpy.Delete_management("raster", '')