I have a raster that has three pixel values=0,1,2. I want all pixels of value 2 to be 1. The raster is in tif format, 32 bit signed type. Below is my arcpy script-
inRaster1="path address/input.tif" arcpy.CheckOutExtension("Spatial") #Reclassifying outReclass=Reclassify(inRaster1, "Value", RemapValue([[0,0],[1,1],[2,1]])) print "Reclassification is complete" outReclass.save("address path/output.tif") print "Saved. Check" arcpy.CheckInExtension("Spatial")
However, I get the 9999 Error and I do not know how to fix it! So instead, I used the Con tool as below and saved the output.
outCon = Con(inRaster1==2, 1, inRaster1) print "Reclassification is complete"
BUt the pixel values do no change i.e. the saved raster still has pixel values=0,1,2 instead of 0 & 1. And this was completed with no errors. I then modified the code line to
And this time all values were reclassified to 1 i.e. even the pixels with value 0.
What is going wrong with the Reclassify() and why is Con() not reclassifying 2.How do i reclassify pixel value=2 to 1