Available with Spatial Analyst license.
Summary
Replaces cells of a raster corresponding to a mask with the values of the nearest neighbors.
Illustration
Usage
Cells in the input raster containing NoData are not nibbled. To nibble NoData, first convert it to another value.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
Nibble (in_raster, in_mask_raster, {nibble_values})
Parameter | Explanation | Data Type |
in_raster | The input raster that will be nibbled. It must be of integer type. | Raster Layer |
in_mask_raster | The raster used as the mask. It must be of integer type. Cells with NoData as their value will be nibbled in the in_raster. | Raster Layer |
nibble_values (Optional) | Keywords defining if NoData values in the input raster are allowed to nibble into the area defined by the mask raster.
| Boolean |
Return Value
Name | Explanation | Data Type |
out_raster | The output nibbled raster. The identified input cells will be replaced with the values of their nearest neighbors. The output is always of integer type. | Raster |
Code Sample
Nibble example 1 (Python window)
This example replaces cells identified by the mask input with values determined by the nearest neighbors of the input raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
nibbleOut = Nibble("land", "snow", "DATA_ONLY")
nibbleOut.save("C:/sapyexamples/output/nibbleout")
Nibble example 2 (stand-alone script)
This example replaces cells identified by the mask input with values determined by the nearest neighbors of the input raster.
# Name: Nibble_Ex_02.py
# Description: Replaces cells of a raster corresponding to a mask
# with the values of the nearest neighbors.
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inRaster = "land"
inMask = "snow"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute Nibble
nibbleOut = Nibble(inRaster, inMask, "ALL_VALUES")
# Save the output
nibbleOut.save("C:/sapyexamples/output/outnibble")
Environments
Licensing Information
- ArcGIS for Desktop Basic: Requires Spatial Analyst
- ArcGIS for Desktop Standard: Requires Spatial Analyst
- ArcGIS for Desktop Advanced: Requires Spatial Analyst