# Interpolating only cells in raster that are adjacent to existing cells with value using ArcGIS Spatial Analyst?

I have raster data of a continuous field. I need to calculate zonal statistics on that data for some polygons (e.g polygons A and B in the image).

It is essential that I have as complete as complete a raster coverage for each polygon as possible but around polygon boundaries I have missing data which I would like to interpolate.

The nature of the data means I cannot reasonably interpolate more than 1 cell from a known value. So for polygon A where data has not been collected I want the raster cells to remain NoData (unless it is within a single-cells distance of a sampled cell).

Is there a raster analysis 'spread' function or similar that will interpolate only cells like the ones in green in the second image i.e. interpolate values only for cells that are adjacent to those that have a value?

You could try the FocalStatistics tool from ArcPy.

import arcpy from arcpy import env from arcpy.sa import * env.workspace= "C:/yourfolder" inRaster="C:/yourfoder/yourfile.tif" arcpy.CheckOutExtension ("Spatial") outCon=Con(IsNull(inRaster), FocalStatistics (inRaster, NbrRectangle (5,5, "CELL"), "MEAN"), inRaster)

Maybe you have to change the (5,5, "CELL")-values to change the Size of your "moving" Rectangle.