I have a raster with gaps in it and want to fill the gaps with the mean of the surrounding cells using focal statistics. I found the code to achieve this here Fill in NoData gaps in raster using ArcGIS for Desktop?
I then want to take the output from the focal statistics and repeat about 15 times in order to expand the raster.
I have managed to get it to work somewhat but it stops after about 3 iterations
arcpy.env.workspace= r'C:\Users\Environmental\Tides\Analysis\Analysis.gdb' arcpy.env.overwriteOutput = True Waves = arcpy.sa.Con(arcpy.sa.IsNull("M2_reproj.tif"),arcpy.sa.FocalStatistics("M2_reproj.tif",arcpy.sa.NbrCircle(1),'MEAN'), "M2_reproj.tif") Waves.save("C:\Users\Environmental\Tides\Analysis\Waves.tif") seq = [1,2,3,4,5,6,7,8,9,10,11,12,13,14] for num in seq: Waves = arcpy.sa.Con(arcpy.sa.IsNull("Waves"),arcpy.sa.FocalStatistics("Waves",arcpy.sa.NbrCircle(1),'MEAN'), "Waves") Waves.save("C:\Users\jtwh3\TOM_GIS\Environmental\Tides\Analysis\Waves.tif")