AnsweredAssumed Answered

TypeError Expecting a raster, but it IS a raster?

Question asked by rgthurau on Feb 16, 2012
Latest reply on Feb 17, 2012 by rgthurau
Hi,
I am trying to use python to run a few consecutive reclassifications, but the script crashes between processes.


import arcpy #import os from arcpy.sa import * from arcpy import env arcpy.CheckOutExtension("Spatial") arcpy.env.overwriteOutput = True  EOSD = "X:\\EOSD_for100" MunRas2 = "X:\\MunRas_East_100" WScom1_rc = "X:\\area_e4buf_comb1_RC.img"#WScom1[0:-4] + "_RC.img" WScom2 = WScom1_rc[0:-4] + "_mun_com.img" WScom2_rc = WScom2[0:-4] + "_RC.img" WScom3 = WScom2_rc[0:-4] + "_eosd_com.img" WScom3_rc = WScom3[0:-4] + "_RC.img"  WScom2 = (Raster(WScom1_rc) + Raster(MunRas2)) WScom2_rc = Reclassify(WScom2, "Value", RemapValue([[0, "NODATA"], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [9, 9], [100, "NODATA"], [101, 1], [102, 2], [103, 7], [104, 4], [105, 5], [106, 6], [109, 9]]))  WScom3 = (Raster(WScom2_rc) + Raster(EOSD)) WScom3_rc = Reclassify(WScom3, "Value", RemapValue([[0, "NODATA"], [1, 1], [2, 2], [3,3], [4, 4], [5,5],[6, 6], [7, 7], [9, 9], [101, 11], [102, 12], [103, 13], [104, 14], [105, 15], [106, 16], [107, 17], [109, 19]]))


So, between WScom2_rc and WScom3, the code crashes with the following error:

    WScom3 = (Raster(WScom2_rc) + Raster(EOSD))
TypeError: expected a raster or layer name

If I comment out the first set of code and run the second, it processes without issue.

Can anyone see something I'm doing wrong?

Thanks

Rich

Outcomes