There are several questions about conditional reclassification on the Stack Exchange, but I haven't been able to find exactly what I need...
In my workspace, I have a list of raster layers (8 bit unsigned integer) that have values from 0-255. I am attempting to use conditional statements within the raster calculator to create a binary (0 and 1) layer in which only values between 90-100 are reclassified to 1 and the remaining values are reclassified to 0.
The code snippet I am working with can be seen below
# IMPORT MODULES
import arcpy, os
# SET GEO_PROCESSING ENVIRONMENTS
arcpy.env.workspace = r"C:\Users\BP_Mosaics"
outws = r"C:\Users\90BP_Mosaics"
# CREATE A LIST OF THE MOSAIC RASTER LAYERS
rasterList = arcpy.ListRasters("*", "tif")
# CREATE LOOP TO RECLASSIFY ALL BP MOSAICS INTO 0s and 1s
# CREATE LOOP TO RECLASSIFY ALL BP MOSAICS INTO 0s and 1s
for i in rasterList:
inputRaster = (os.path.join(env.workspace, i))
filename = i[-18:-4] + '_01.tif'
outname = os.path.join(outws, filename)
arcpy.gp.RasterCalculator_sa("Con(((" + inputRaster + ">= 90) & (" + inputRaster + "<= 100)), 1, 0)", outname)
I am not seeing any immediate errors in the code, however something does not seem to be working properly as I receive the following error message...
arcgisscripting.ExecuteError: ERROR 000539: (null)
Failed to execute (RasterCalculator).
Would anyone happen to know what is happening here?