I have a DEM raster (High: 53441, Low: -3444, unit: cms) with negative values, and I want to make all values 100 or less to be 100.

enter image description here

I've tried Raster Calculator, and also python. I've got the same unexpected result: (High: 22881, Low: 8842)

enter image description here

This is my code in python:

inRaster  = Raster('ns_dem_int')
outRaster = Con(inRaster, 100, inRaster, "Value <= 100")

I've run the code -and the Raster Calculator- several time (with some variations) but I've always end up with those numbers as results Any ideas on what could be wrong here?


Dont squeeze your brains anymore!

Finally, I realized that everything I did was correct. The problem was with ArcGIS. The display of the resulting raster in the Table of Contents was wrong. For some reason that I don't know, it was showing the wrong Max and min values. Lesson learned: when in doubt, always double check your outputs/results by more than one way. This issue is resolved. Thanks to all who read this question, and learn from this too (it costed me a long & frustrating day of work!) If this helped you solving your problem, please share that.


The first parameter to Con can be a conditional raster instead of an input raster.

Try outRaster = Con(inRaster <= 100, 100, inRaster) instead.

  • Thanks for your comment. That I've tried before, didn't work. Any other idea? – Delonix R. Feb 25 '16 at 13:00
  • I dont' know if this is relevant: Values in raster are numeric-long type. – Delonix R. Feb 25 '16 at 13:00
  • Rephrase: That I've tried before, exactly the same unexpected results. – Delonix R. Feb 25 '16 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.