I’m trying to provide the breakdown of fire detection for an area by sorting of confidence levels. The dataset has 12 files (one for each month in a year) with fire records which all have a column called “confidence” with a value between 0 and 100. I have to use a for loop to query the files by 3 different confidence levels.
Group 1: >85% confidence
Group 2: 60-85% confidence
Group 3: <60% confidence
I HAVE TO USE a for
loop to execute this. Any ideas? I started by appending all the files into one list. I’m told that I could use lists to set up lower and upper ranges and SelectLayerByAttribute_management
, and use that in a loop, but don’t know how to do that.
Modified code from radouxjou’s answer is below. But I’m getting the error that “TypeError:’NoneType’ object is not iterable”.
list1 = [];
for month in range(1,13):
inf = "2007" + str(month).zfill(2)+ "_rfe"
list1.append(inf)
lower = [0, 60, 86]
upper = [60, 85, 101]
fcs = arcpy.ListFeatureClasses(inf)
for x in fcs:
for i in range(len(lower)):
arcpy.MakeFeatureLayer_management(x, x[:7] + "_" + str(i+1), """ "CONF" > {} and "CONF" <= {}""".format(lower[i],upper[i]))