I’m a newcomer to python. I’m trying to run a script in python using some arcpy functions (ArcGIS had no joy on arc site), but it returns the object is not iterable message. The script is supposed to to step through moving window filters on a raster image producing an image for each filter size (e.g 3 pixels, 4 pixels etc).
I want to step through moving window sizes until I reach a defined amount in a range (in this case the range is 3 – 10) using a neighborhood filter. So the value 3 in NbrCircle(3, “CELL”) steps through the range with the for and if statement in the script.
Anyone know how I might overcome this problem?
Here’s the part of the script that causes problems:
Variables
radius = 3
it_1 = range(3, 10, 1)
neighborhood = NbrCircle(radius, "CELL")
Execute FocalStatistics
outFocalStatistics1 = FocalStatistics(outSlope, neighborhood, "MEAN"
"")
loop to step through moving window sizes based on variable it_1
for num in radius:
if it_1 > 3:
radius = num + radius
it’s been a while since you posted this. Are you still looking for answers?
If you want to:
start from radius=3; then increase radius to 4, 5, 6…10 to loop through
neighborhood=NbrCircle(radius, “CELL”)
try:
if this is not what you need, let me know how the “radius” number should increase–like an example of first iteration.