I'm trying to automate the setup of some flood depth/hazard maps. The user specifies a folder containing depth grids generated by a hydraulic model (.asc format) and some background mapping (geotiff format). I've got the mapping to import correctly using code similar to that below. But the code does not work for the ASCII datasets.
depthgrid = "<userspecifiedfolder>\\maximumdepthgrid.asc"
arcpy.mapping.AddLayer(df, depthgrid)
Upon running the code I get the error: "AssertionError"
Conversion from ASCII to another filetype is not really an option as I need the files in this ASCII format for various other tasks too and would prefer not to double up on data.
Example ASCII data:
ncols 2068
nrows 1522
xllcorner 516810.000
yllcorner 466168.000
cellsize 1.000
NODATA_value -999.
-999.0000 -999.0000 -999.0000 -999.0000 -999.0000 -999.0000 ...
more data ...