I am trying to use this solution to clean up small holes in my rasters. It uses focal statistics on the no data cells to replace them with a local average. The raster have a small number of unique values so using MEAN in focal statistics increases the number of values and gives dodgy results (I want a hole in a section where value = 100 to be 100 and not 98.9). The shouldn't be a problem because I can use MAJORITY in focal statistics.
What is stange though is that this python code takes 9 minutes to run:
filled = sa.Con(sa.IsNull(in_raster),sa.FocalStatistics(in_raster,
sa.NbrCircle(50, "CELL"),'MEAN'), in_raster)
still a little slow but manageable.
Then this code took 4 hours and 26 minutes to run (on the exact same in_raster):
filled = sa.Con(sa.IsNull(in_raster),sa.FocalStatistics(in_raster,
sa.NbrCircle(50, "CELL"),'MAJORITY'), in_raster
The only difference is mean vs Majority. Could anyone explain to me why there is such a difference in performance and if there is anything I can do about it?
I have a slightly laborious work-around of reclassifying the output to return to my small set of unique values, but I'd like to understand what seems like a simple solution is unworkably slow