Solved! Go to Solution.
I have a table with multiple min and a max numbers for multiple points. I would like to use "Extract by Attribute" to pull the fitting areas from a DEM which corresponds to each area.
rows = arcpy.SearchCursor("areatable.dbf") k = 1 for row in rows: a1min = float(row.getValue("Area1Min")) a1max = float(row.getValue("Area1Max")) where = "VALUE > {0} AND VALUE < {1}".format(a1min, a1max) dem1 = ExtractByAttributes(Raster("dem"), where) dem1.save("dema{}".format(k)) # save as grids dema1, dema2 del row, rows
dem = Raster("dem1") dem1 = Con(dem > a1min and dem < a1max, dem)
I have a table with multiple min and a max numbers for multiple points. I would like to use "Extract by Attribute" to pull the fitting areas from a DEM which corresponds to each area.
rows = arcpy.SearchCursor("areatable.dbf") k = 1 for row in rows: a1min = float(row.getValue("Area1Min")) a1max = float(row.getValue("Area1Max")) where = "VALUE > {0} AND VALUE < {1}".format(a1min, a1max) dem1 = ExtractByAttributes(Raster("dem"), where) dem1.save("dema{}".format(k)) # save as grids dema1, dema2 del row, rows
dem = Raster("dem1") dem1 = Con(dem > a1min and dem < a1max, dem)
The Extract by attribute tool however created more questions than it answered.
where = "VALUE > " + str(a1min) + " AND VALUE < " + str(a1max) where = "VALUE > {0} AND VALUE < {1}".format(a1min, a1max)
VALUE > 5000 AND VALUE < 6000
The tool turns out a raster with no "values". While they can be displayed, they are incredibly large files and can not be converted to a shape file due to not having any data attached.
dem1 = SetNull(IsNull(ExtractByAttributes(Raster("dem"), where)),1)