I have several rasters to iterate through. I want to reclass the cell values to 0-255 with the following equation:
rescaled grid = [(grid - min value from grid) * (max scale value - min scale value) / (max value from
grid - min value from grid)] + min scale value
Searching on the web led to comments that one should use arcpy instead of model builder for iterating with Raster Calculator, instead of using Model Builder. I have never used python/arcpy and have no idea what to write. I have looked around and found results to lead me to something like this:
# Import arcpy module
# Check out any necessary licenses
# Load required toolboxes
# Local variables:
clim20s30s = "C:\\Users\\JPolo\\Documents\\climateTemps\\PRISM_ppt\\clim20s30s"
v_name_sc_tif = "C:\\Users\\JPolo\\Documents\\climateTemps\\PRISM_ppt\\cacl\\%name%sc.tif"
# Process: Iterate Rasters
arcpy.IterateRasters_mb(clim20s30s, "", "", "NOT_RECURSIVE")
# Process: Raster Calculator
arcpy.gp.RasterCalculator_sa("outRaster = ((\"%ppt_192001_bil.tif%\" - min(\"%ppt_192001_bil.tif%\")) * (255 - 0) / (max(\"%ppt_192001_bil.tif%\") - min(\"%ppt_192001_bil.tif%\"))) - 0", v_name_sc_tif)
However, this doesn't work and I don't know what needs to be changed to make it work.