1

In ArcGIS 10.1 I'm trying to normalize a section of a DEM (digital elevation model) from original values to values ranging from 0 to 100. First I clipped the raster DEM with an irregulary shaped polygon. Now I'm tying to change all the values to a range of 0 to 100 for further analysis.

I'm using the Raster calculator tool with this equation:

("DEM" - min("DEM")) * 100 / (max("DEM") - min("DEM")) + 0 

I keep getting TypeError: 'Raster' object not iterable. This is the log I get:

   ERROR 000539: Error running expression: rcexec() 
    Traceback (most recent call last):
      File "<expression>", line 1, in <module>
      File "<string>", line 5, in rcexec
    TypeError: 'Raster' object is not iterable

I also tried running the command on the unclipped raster, unsuccessfully.

5

The builtin python min() and max() functions operate only on python iterables (i.e lists, tuples, etc.) and return the smallest/largest item in the iterable. They do not return the minimum/maximum value of a Raster object which is why a TypeError was raised.

You need to use the Raster.minimum and Raster.maximum properties.

For example:

("dem" -"dem".minimum) * 100 / ("dem".maximum - "dem".minimum) + 0 

Note: This will work as long as you have already calculated statistics for the raster, otherwise it will fail as "raster".minimum will return None.

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.