Nibble (Spatial Analyst)
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.
Syntax
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 in_raster are allowed to nibble into the area defined by the in_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. | Raster |
Code Sample
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")
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 # Author: ESRI # 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")