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"


outReclass=Reclassify(inRaster1, "Value", RemapValue([[0,0],[1,1],[2,1]]))
print "Reclassification is complete"

outReclass.save("address path/output.tif")
print "Saved. Check"


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

closed as off-topic by PolyGeo Sep 16 '18 at 6:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    In= arcpy.Raster(path) and try again. – FelixIP Aug 19 '18 at 23:45
  • Yes this worked! Thank you @FelixIP. But I do not understand the logic.Could you explain? – tg110 Aug 20 '18 at 2:54
  • ArcGIS is inconsistent with it. Do any raster calculation, go to results window and copy as python snippet. You'll see Raster() around raster name in mxd. I guess there it is something to do with a difference between raster name and raster object. – FelixIP Aug 20 '18 at 3:00