I made this pretty simple tool with the code below and all through last night it ran error free on every run. Now since this morning I am getting a RuntimeError: 999998: Unexpected Error. The error occurs on line 15:
I have no idea why it isn't working all of the sudden. I can see it writing the raster file in the given location, but it gets deleted immediately and than the RuntimeError happens. I can't really find any solution and have tried different paths, names, setting it as a variable, etc.
Does anyone know what to do?
from arcpy.sa import *
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'D:\Documents\LocalReliefModel'
DEM_org = r'D:\Documents\LocalReliefModel\TestRaster\GH_Toterfout.tif'
# Low pass filter -> Smoothed DEM (focal statistics)
outFocalStat = arcpy.sa.FocalStatistics(DEM_org, NbrRectangle(50, 50, "CELL"), 'MEAN')
# Subtract smoothed DEM from the original DEM -> Difference model (Minus function)
outMinus = arcpy.sa.Minus(outFocalStat, DEM_org)
# Calculate the zero meters contours for the Difference model ->
# set of the break lines between the positive and negative features (convex and concave features; Contour function)
outCont_save = r'D:\Documents\LocalReliefModel\TestRaster\ZeroCont.tif'
outCont = arcpy.sa.Contour(outMinus, outCont_save, 100)
# Extract the real elevation of the cells from the original DEM, which intersects with the break lines ->
# simplified elevation raster (Extract by Mask function)
outMask = arcpy.sa.ExtractByMask(DEM_org, outCont)
# Convert the simplified elevation raster to the point features (only nonzero cells) ->
# elevation points (Raster to Point function)
outRastToPoint_save = r'D:\Documents\LocalReliefModel\TestRaster\RastToPoint'
outRastToPoint = arcpy.RasterToPoint_conversion(outMask, outRastToPoint_save)
Maybe because your outFocalStat is a raster object rather than a path.
also you a using arcpy.sa explicitly so theres no need for from arcpy.sa import *
one last guess might be not having