Show Navigation | Hide Navigation
You are here:
Extensions > Spatial Analyst > Spatial Analyst functional reference > Generalization (Spatial Analyst)

Nibble

Release 9.2
Last modified January 3, 2008
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Generalization (Spatial Analyst)"


Related Topics

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

Learn more about how Nibble works


Illustration

Nibble illustration

Usage tips

Command line syntax
An overview of the Command Line window
Nibble_sa <in_raster> <in_mask_raster> <out_raster> {ALL_VALUES | DATA_ONLY}

Parameter Explanation Data Type
<in_raster>

Input raster.

Composite Geodataset
<in_mask_raster>

The raster used as the mask. Cells with NoData as their value will be nibbled in the in_raster.

Composite Geodataset
<out_raster>

The raster to be created.

Raster Dataset
{ALL_VALUES | DATA_ONLY}

Keywords defining if NoData values in the in_raster are allowed to nibble into the area defined by the in_mask_raster.

  • ALL  — Specifies that the nearest neighbor value will be used whether it is NoData or another data value in the in_raster. NoData values in the in_raster are free to nibble into areas defined in the in_mask_raster if they are the nearest neighbor.
  • DATAONLY  — Specifies that only data values are free to nibble into areas defined in the in_mask_raster. NoData values in the in_raster are not allowed to nibble into areas defined in the in_mask_raster even if they are the nearest neighbor.

Boolean
Data types for geoprocessing tool parameters


Command line example

Nibble_sa C:/data/ras_1 C:/data/mask_1 C:/data/final_1 ALL_VALUES

Scripting syntax
About getting started with writing geoprocessing scripts
Nibble_sa (in_raster, in_mask_raster, out_raster, nibble_values)

Parameter Explanation Data Type
in_raster (Required)

Input raster.

Composite Geodataset
in_mask_raster (Required)

The raster used as the mask. Cells with NoData as their value will be nibbled in the in_raster.

Composite Geodataset
out_raster (Required)

The raster to be created.

Raster Dataset
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.

  • ALL  — Specifies that the nearest neighbor value will be used whether it is NoData or another data value in the in_raster. NoData values in the in_raster are free to nibble into areas defined in the in_mask_raster if they are the nearest neighbor.
  • DATAONLY  — Specifies that only data values are free to nibble into areas defined in the in_mask_raster. NoData values in the in_raster are not allowed to nibble into areas defined in the in_mask_raster even if they are the nearest neighbor.

Boolean

Data types for geoprocessing tool parameters


Script example

# Nibble_sample.py
# Description:
#   Replaces cells of a raster corresponding to a mask, with the
#   values of the nearest neighbors.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005

# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

try:
    # Set local variables
    outRaster = "C:/data/final_1"
    inRaster = "C:/data/ras_1"
    maskRaster = "C:/data/mask_1"

    # Check out Spatial Analyst extension license
    gp.CheckOutExtension("Spatial")	

    # Process: Majority Filter...
    gp.Nibble_sa(filter, maskRaster, outRaster, "ALL_VALUES")

except:
    # If an error occurred while running a tool, then print the messages.
    print gp.GetMessages()

Map Algebra syntax
Nibble(<in_grid>, <mask_grid>, {ALL | DATAONLY})

Parameter Explanation
<in_grid> The name of a raster.
<mask_grid> The name of a raster used as the mask.
Cells with NoData as their value will be nibbled in the <in_grid>.
{ALL | DATAONLY} Keywords defining if NoData values in the <in_grid> are allowed to nibble into the area defined by the <mask_grid>.
  • ALL  — A keyword that specifies that the nearest neighbor value will be used whether it is NoData or another data value in the <in_grid>. NoData values in the <in_grid> are free to nibble into areas defined in the <mask_grid> if they are the nearest neighbor.
  • DATAONLY  — A keyword that specifies that only data values are free to nibble into areas defined in the <mask_grid>. NoData values in the <in_grid> are not allowed to nibble into areas defined in the <mask_grid> even if they are the nearest neighbor.

Map Algebra example

nibble(inputgrid, maskgrid)

ArcObjects syntax
IGeneralizeOp::Nibble (raster As IGeoDataset, maskRaster As IGeoDataset, useNoData As Boolean) As IGeoDataset

Parameter Explanation
raster The name of a raster.
maskRaster The name of a raster used as the mask.
Cells with NoData as their value will be nibbled in the first input raster.
useNoData Boolean defining if NoData values in the raster are allowed to nibble into the area defined by the maskRaster.
If True, the nearest neighbor value will be used whether it is NoData or another data value in the first input raster.
NoData values in the first input raster are free to nibble into areas defined in the maskRaster if they are the nearest neighbor.
If False, only data values are free to nibble into areas defined in the maskRaster.
NoData values in the first input raster are not allowed to nibble into areas defined in the maskRaster even if they are the nearest neighbor.

ArcObjects example

' Create the GeneralizeOp object
Dim pGeneralizeOp As IGeneralizeOp
Set pGeneralizeOp = New RasterGeneralizeOp

' Create the input raster object
Dim pInputDataset As IGeoDataset

' Calls function to open the input raster dataset from disk
Set pInputDataset = OpenRasterDataset ("D:\SpatialData", "inputraster")

' Create the input mask raster object
Dim pMaskDataset As IGeoDataset

' Calls function to open the mask raster dataset from disk
Set pMaskDataset = OpenRasterDataset ("D:\SpatialData", "maskraster")

' Create the output dataset object
Dim pOutputDataset As IGeoDataset

' Calls the method
Set pOutputDataset = pGeneralizeOp.Nibble (pInputDataset, pMaskDataset)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.