AnsweredAssumed Answered

Map Algebra in Python Using Variable

Question asked by rr1040 on Jun 11, 2013
Latest reply on Jun 25, 2013 by curtvprice
I am trying to move from raster calculator to the python window for my spatial analysis and moving from ERDAS Model Maker altogether.  I am already struggling on only my first task.  Here I am just trying to 'scale' my raster from 0-1

import arcpy from arcpy import env from arcpy.sa import * #Get Max and Min gridMaxResult = arcpy.GetRasterProperties_management("RASTER1", "MAXIMUM") gridMinResult = arcpy.GetRasterProperties_management("RASTER1", "MINIMUM") #Assign output gridMax = gridMaxResult.getOutput(0) gridMin = gridMinResult.getOutput(0)  #Rescale or 'normalize' OutRas = (((Raster("RASTER1") - gridMin) * (1 - 0)) / (gridMax - gridMin)) + 0 OutRas.save("NormalizedRas")

I get:
Runtime error <type 'exceptions.RuntimeError'>: ERROR 000732: Input Raster: Dataset 0 does not exist or is not supported

It is reading the variable correctly (gridMin is equal to 0) but it seems like it doesnt know it is a number.  Any advice would help me with this problem and my syntax going forward.

Thanks

Outcomes