ArcGIS教程:Nibble (Spatial Analyst)

摘要

  用最邻近点的值替换掩膜范围内的栅格像元的值。

插图

  

用法

  · 包含 NoData 的输入栅格中的像元将被一点点地除去。要一点点地除去 NoData,首先将其转换为其他值。

代码实例

  Nibble 示例 1(Python 窗口)

  此例使用由输入栅格的最邻近点确定的值来替换由输入掩膜所识别的像元。

  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 示例 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 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”)

环境

  像元大小, 当前工作空间, 掩膜, 输出坐标系, 范围, 临时工作空间, 捕捉栅格

转载自:https://blog.csdn.net/dsac1/article/details/49361035

You may also like...