摘要 用最邻近点的值替换掩膜范围内的栅格像元的值。插图
用法 · 包含 NoData 的输入栅格中的像元将被一点点地除去。要一点点地除去 NoData,首先将其转换为其他值。语法 Nibble (in_raster, in_mask_raster, {nibble_values})
代码实例 Nibble 示例 1(Python 窗口) 此例使用由输入栅格的最邻近点确定的值来替换由输入掩膜所识别的像元。import arcpyfrom arcpy import envfrom arcpy.sa import *env.workspace = 'C:/sapyexamples/data'nibbleOut = Nibble('land', 'snow', 'DATA_ONLY')nibbleOut.save('C:/sapyexamples/output/nibbleout') Nibble 示例 2(独立脚本) 此例使用由输入栅格的最邻近点确定的值来替换由输入掩膜所识别的像元。# 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 modulesimport arcpyfrom arcpy import envfrom arcpy.sa import *# Set environment settingsenv.workspace = 'C:/sapyexamples/data'# Set local variablesinRaster = 'land'inMask = 'snow'# Check out the ArcGIS Spatial Analyst extension licensearcpy.CheckOutExtension('Spatial')# Execute NibblenibbleOut = Nibble(inRaster, inMask, 'ALL_VALUES')# Save the outputnibbleOut.save('C:/sapyexamples/output/outnibble')环境 像元大小, 当前工作空间, 掩膜, 输出坐标系, 范围, 临时工作空间, 捕捉栅格