I am aiming to write a tool in Arcpy that merges (mosaic) multiple raster files, fills the nodata cells (via gdal.FillNodata) and applies a hillshade to the raster. It is working fine but I want to optimize my script.
The raster files that are put in to the tool contain nodata cells that the tool fills with GDAL.FillNodata. However the sizes of area's that have these nodata 'gaps' vary a lot from raster to raster, so setting a maximum search distance (maxSearchDist) is quite a hassle. And for optimization purposes I don't want to set an extreme distance.
So my goal is to calculate the maximum cell distance of the biggest area with nodata cells within a set of raster files. And that'd be the input as my maxSearchDist. How would this be achieved? I am looking at raster calculations but I don't know whether to look for my answer in GDAL or Arcpy itself.
In the figure below I tried to visualize what I want to achieve. On the left is the raster file. From this raster I want to calculate which area of nodata cells is the largest and secondly (on the right indicated with the blue arrow) what the maximum distance of nodata cells is within that area.