AnsweredAssumed Answered

Run raster calculation on multiple lists of rasters

Question asked by Caleb1987 on Aug 30, 2012
Latest reply on Sep 10, 2014 by GSCUser85
So I'm having a little trouble here...This is part of a larger script and I can get everything to work up until this point.

I have an equation I need to throw in the Raster Calculator:

((DEM - MIN) / (MAX - MIN) * 100)

I need to perform this equation 6 times (I have 6 DEMs, 6 Mins, and 6 Maxes numbered in ascending order in the gdb).  What I was hoping to do was set up an equation where I can do something like this:

# List 3 raster types for input for raster calculator demlist = arcpy.ListRasters('DEM_ext*') minlist = arcpy.ListRasters('ZonalMin*') maxlist = arcpy.ListRasters('ZonalMax*')

From this list I would then like to use this equation in the raster calculator:

# Starting from the first raster of each type and iterate through to the sixth [0] - [5]  # Start at index [0]    expression = ((demlist[0] - minlist[0]) / (maxlist[0] - minlist[0])* 100)  # Then go to [1] and so on... outrast = outpath + os.sep + 'Relative_elv' + str(index)  # index here is a variable to represent a raster in the list RasterCalculator(expression, outrast)  # index += 1 

I would like this to iterate through and perform this same calculation on all 6 rasters (DEM, MIN, MAX).  I have been trying to figure out a way but I am at a loss as to how to do this? What would be a good way to initiate a loop to go through and perform this calculation?  Thanks.

This is what each list of rasters looks like: