Skip To Content

How Nibble works

Available with Spatial Analyst license.

The Nibble tool allows selected areas of a raster to be assigned the value of their nearest neighbor. This is useful for editing areas of a raster where the data is known to be erroneous.

First, the algorithm determines all areas from the mask raster with the value NoData. The corresponding areas on the input raster will be nibbled. Second, an internal Euclidean allocation is performed to allocate values to the masked cells based on Euclidean distance.

The value of the cells from the input raster that correspond to the cells of NoData from the mask raster are nibbled and replaced by the value of the nearest neighbor according to Euclidean distance.

In the following example, Nibble was applied to the specified input and mask rasters. The operation will only be applied to the input cells that correspond to the NoData values in the mask raster. Those locations will receive the value of the cell that is identified as the closest from the input raster that is outside the defined mask. With the default option of the Use NoData values if they are the nearest neighbor parameter as checked (in Python, ALL_VALUES as the value for the nibble_values parameter), it is possible for NoData cells in the input raster to nibble into the area defined by the mask raster.

Nibble illustration with default parameters
OutRas = Nibble(InRas1, Mask_Ras, ALL_VALUES)

In the following example, the mask was created by applying a condition on the input raster that set all values of 7 to NoData. Instead of using the default, the Nibble NoData cells parameter is checked (in Python, PROCESS_NODATA for the nibble_nodata parameter), specifying that NoData cells in the input raster that are within the mask area can be nibbled into valid cells values in the output.

Nibble illustration with Nibble NoData cells parameter changed from default
OutRas = Nibble(InRas1, Mask_Ras, ALL_VALUES, PROCESS_NODATA)

Related topics