Using ArcGIS Desktop 10.7, I have 83 rasters that I need to loop through and perform an Extract By Attributes on using Python. Each raster has a range of values that the extracted pixels should be between. What I need to be able to do is insert the upper and lower bounding values from a table into the "where_clause".
I'm not exactly sure how to link the appropriate values to the corresponding raster. Each raster is named after a "Map_ID" and the same "Map_ID" is located in the table. The table only has 3 columns, the Map_ID, upper and lower bounding values. The current python script I have is as follows (the 2 phrases "(Map_ID lower value)" and "(Map_ID upper value)" is what needs to call the values from a table):
# Import system modules import arcpy from arcpy import env from arcpy.sa import * # Set environment settings arcpy.env.workspace = "C:\data\Rast_conversion_Step_1" # set output folder outWorkspace = "C:\data\Rast_conversion_Step_2" # create list of rasters to perform raster math on RasterList = arcpy.ListRasters() for item in RasterList: inSQLClause = "Value >= (Map_ID lower value) and Value <= (Map_ID upper value)" extractRast = ExtractByAttributes(item, inSQLClause) outputRaster = os.path.join(outWorkspace, item) ExtractByAttributes.save(outputRaster)