Nibble (Raster Analysis)

Title  Nibble (Raster Analysis)

Summary

Replaces cells of a raster corresponding to a mask with the values of the nearest neighbors.


Illustration

Nibble tool illustration Nibble tool illustration

Usage


Syntax

Parameter Explanation
inputRaster

The input raster that will be nibbled.

The raster can be either integer or floating point type.

inputMaskRaster

The raster used as the mask.

The cells that are NoData define the cells that will be nibbled, or replaced, by the value of the closest nearest neighbour.

outputName

The name of the output nibble raster service.

The default name is based on the tool name and the input layer name. If the layer already exists, you will be prompted to provide another name.

nibbleValues (Optional)

Defines if NoData values in the input raster are allowed to nibble into the area defined by the mask raster.

  • Checked—Specifies that the nearest neighbor value will be used whether it is NoData or another data value in the input raster. NoData values in the input raster are free to nibble into areas defined in the mask if they are the nearest neighbor. This is the default.
  • Unchecked—Specifies that only data values are free to nibble into areas defined in the mask raster. NoData values in the input raster are not allowed to nibble into areas defined in the mask raster even if they are the nearest neighbor.
nibbleNodata (Optional)

Defines if NoData cells in the input raster that are within the mask will remain NoData in the output raster.

  • Unchecked—Specifies that NoData cells in the input raster and within the mask will remain NoData in the output. This is the default.
  • Checked—Specifies that NoData cells in the input raster and within the mask can be nibbled into valid output cell values.
inputZoneRaster (Optional)

The input zone raster. For each zone, input cells that are within the mask will be replaced only by the nearest cell values within that same zone.

A zone is all the cells in a raster that have the same value, whether or not they are contiguous. The input zone layer defines the shape, values, and locations of the zones. The zone raster can be either integer or floating point type.

Code Samples

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
arcpy.Nibble_ra(
    "https://MyPortal.esri.com/server/rest/services/Hosted/in_raster/ImageServer",
    "https://MyPortal.esri.com/server/rest/services/Hosted/in_mask/ImageServer",
    "outnibbled1")

                    

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 within defines zones.
#
# Requirements: ArcGIS Image Server

# Import system modules
import arcpy

# Set local variables
inputLayer      = "https://MyPortal.esri.com/server/rest/services/Hosted/inras/ImageServer"
inputMaskLayer  = "https://MyPortal.esri.com/server/rest/services/Hosted/inmask/ImageServer"
outputName      = "outnibbled2"
nibbleValuesOpt = "DATA_ONLY"
nibbleNodataOpt = "PROCESS_NODATA"
inputZoneLayer  = "https://MyPortal.esri.com/server/rest/services/Hosted/inzones/ImageServer"

arcpy.Nibble_ra(inputLayer, inputMaskLayer, outputName, nibbleValuesOpt, 
                nibbleNodataOpt, inputZoneLayer)
                    

Tags

Credits

Use limitations