1

I have two global rasters and would like to expand one so that it matches the extent of the second by filling in NoData values with values taken from or averaged from nearby pixels. I have been using this expression in Raster Calculator in ArcGIS Pro:

Con(IsNull("fill_raster.tif")&"extent_raster.tif"==1, Int(FocalStatistics("fill_raster.tif", NbrCircle(15, "CELL"), "MEAN")), "fill_raster.tif")

This has been working to fill most of the small areas of NoData, but there are still larger or more isolated regions where there are no cells in the "fill_raster" with values, so using the circular neighborhood at a specified size does not reach them. In the image below, I am trying to fill the green areas with data from the grayscale raster, but some of these green areas had no cells with data within the circular neighborhood and remain NoData in the grayscale raster even after applying the focal statistics expression.

Is there a way to specify that the values should come from the nearest cells with data instead of any cells within the specified neighborhood size?

I am trying to fill the green areas with data from the grayscale raster, but some of these green areas had no cells with data within the circular neighborhood and so remain NoData in the grayscale raster even after applying the focal statistics expression.

2
  • You can use cost allocation to assign values on the border of grey to no data cells. Smooth result by focal statistics after.
    – FelixIP
    Commented Mar 30, 2021 at 0:10
  • @FelixIP The areas outside of the gray are already NoData and I'm trying to assign the areas within the green extent values. I'm not sure I understand how assigning the bordering values to NoData will help?
    – Sabine
    Commented Mar 30, 2021 at 2:08

1 Answer 1

1

I'll first remove bits of terrain and will try to fill gaps:

enter image description here

enter image description here

Convert your green to integer of 1.

Define cost distance:

Expand_sa("GREEN", "../COST", "1", "1")

Find cells on the border, convert to points:

RasterCalculator_sa('"COST" * "ERASED"', "..BOUNDARY")
RasterToPoint_conversion("BOUNDARY","../boundary_points")

Allocate missing areas to nearest point on the boundary, open it's table and transfer values from boundary points:

CostAllocation_sa("boundary_points", "COST", "../ALLOCATION", "", "", "OBJECTID")
MakeTableView_management("ALLOCATION", "ALLOCATION_View")
JoinField_management("ALLOCATION_View", "Value", "boundary_points", "OBJECTID", fields="grid_code")

Fill missing areas:

Lookup_3d("ALLOCATION", "grid_code", ".../LOOKUP")
RasterCalculator_sa('Con(IsNull("ERASED"),"LOOKUP","ERASED")', "../COMBO")

OUTPUT:

enter image description here

Smooth what I called Lookup before merging with original.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.