I’m working on a script that will automate a stream delineation protocol given a DEM and a culvert layer. I was having difficulty troubleshooting problems with the point to raster conversion tool so I ran the tool in arcmap (successfully) and copied the python snippet from the results. I then closed arcmap to avoid lock problems and tried running the script (shown with my original code commented out) with the snippet. It produced the same error I encountered with my code.
Any advice on what might be causing this error would be greatly appreciated as would any general advice on my code (redundancy, readability, etc.). General troubleshooting tips for this kind of thing would be great as well.
Code:
# Environment Set-Up and parameter initialization
import arcpy
from arcpy import *
from arcpy.sa import *
from arcpy.cartography import *
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension ("Spatial")
#Provide the full filepath for you working geodatabase here. ##DATASET STARTING NAME IS "LIDAR_DEM", MAKE A COPY OF YOUR ORIGINAL AND CALL IT THAT##
WSV = r"C:UsersrdcoopercaroselliRowynProjectsLiDAR_WorkAutomationTestAutomation_try2.gdb"
arcpy.env.workspace = WSV
#Provide the culvert datset here
CulvertFeature= WSV+'/Culverts'
#Get the cell size, pixel type, desired operating extent, and coordinate system of the LiDAR DEM. Set up DEM as Snap Raster for raster calculations
DEM = Raster (WSV+"/LIDAR_DEM")
CellSize = GetRasterProperties_management (WSV+"/LIDAR_DEM", "CELLSIZEX")
ptype = DEM.pixelType
code = {'U1':'1_BIT','U2':'2_BIT','U4':'4_BIT','U8':'8_BIT_UNSIGNED','S8':'8_BIT_SIGNED','U16':'16_BIT_UNSIGNED', 'S16':'16_BIT_SIGNED',
'U32':'32_BIT_UNSIGNED','S32':'32_BIT_SIGNED','F32':'32_BIT_FLOAT','F64':'64_BIT'}
ptype = code[ptype]
arcpy.env.extent = DEM.extent
arcpy.env.snapRaster = WSV+"/LIDAR_DEM"
# Convert Culvert Shapefile to Raster with same cell size as DEM
#CreateRasterDataset_management (WSV, "CulvertRaster", CellSize, ptype, DEM,1)
#PointToRaster_conversion(CulvertFeature,"ELEV",WSV+"/CulvertRaster","MOST_FREQUENT","NONE",CellSize)
#CulRast = Raster (WSV+"/CulvertRaster")
# Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script
# The following inputs are layers or table views: "Culverts"
PointToRaster_conversion("Culverts","ELEV","C:/Users/rdcoopercaroselli/RowynProjects/LiDAR_Work/AutomationTest/Automation_try2.gdb/CulRast","MOST_FREQUENT",
"NONE","C:/Users/rdcoopercaroselli/RowynProjects/LiDAR_Work/AutomationTest/Automation_try2.gdb/LIDAR_DEM")
Error message:
Traceback (most recent call last):
File "C:UsersrdcoopercaroselliRowynProjectsLiDAR_WorkAutomationTestR05_DRAINAGE_DELINEATOR_Backup.py", line 40, in <module>
"NONE","C:/Users/rdcoopercaroselli/RowynProjects/LiDAR_Work/AutomationTest/Automation_try2.gdb/LIDAR_DEM")
File "C:Program Files (x86)ArcGISDesktop10.1arcpyarcpyconversion.py", line 2393, in PointToRaster
raise e
ExecuteError: ERROR 999999: Error executing function.
The table was not found. [CulRast]
The table was not found. [fras_bnd_CulRast]
No spatial reference exists.
Failed to execute (PointToRaster).
This error message alternately appears with and without a long series of
“A column was specified that does not exist.” messages