2

Using ArcGIS 10.1 and arcpy, is there a way to reclassify all values of a raster file to the same value (leaving NoData Values as "NoData")? Lets assume that I have no way of knowing what the actual (i.e original) values are, so defining a RemapRange from a very small to a very large number would be rather inelegant.

Basically, i'm missing a third option in the arcpy.Reclassify() tool. "missing values" can left alone (= "DATA") or turned into NoData (= "NODATA"), but not reclassified to a certain value.

1 Answer 1

4

So you want to convert all values to the same constant value and NoData should remain NoData. Instead of Reclassify, use the Con tool with your input raster as 'Input conditional raster', and the constant value as 'Input true raster or constant value'.

E.g.:

import arcpy
cst = 5                    # your constant value
outCon = Con(r"C:\data\intput.tif", cst)
outCon.save(r"C:\data\output.tif")
2
  • Thanks so much for you answer! Didn't now this tool, it serves exactly my purpouse. I'd vote up, but lack the reputation.
    – Ratnanil
    Commented Nov 27, 2014 at 11:26
  • Glad I could help. This tool is a classic one, try from time to time to take a few minutes to open the Toolbox and have a look at some tools' description, you might find other useful stuff.
    – GISGe
    Commented Nov 27, 2014 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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