NbrWedge
汇总
用于定义楔形邻域,将通过以地图单位或像元数指定半径和两个角度来创建该邻域。


讨论
使用楔形邻域对象的工具包括: 块统计 、 焦点统计 、 点统计 、 点密度分析 和 地形位置指数 。
许可:
如果您拥有 Image Analyst 扩展模块许可,也可以使用该类,但仅限于 焦点统计 工具。
楔形由 radius 、 startAngle 、 endAngle 和 units 进行指定。 楔形按逆时针方向从起始角延伸到终止角。 角度将以算术角度(从正 x 轴逆时针方向)为单位进行指定。 也可使用负角度。
半径以像元或地图单位为单位,并沿垂直于 x 轴或 y 轴的方向进行测量。 当以地图单位指定半径时,会将其转换为以像元为单位的半径。 所得的以像元为单位的半径会生成一个区域,该区域能够近似地表示出使用原始的地图单位为半径时计算的区域。 楔形包围的任何像元中心都将包含在邻域的处理中。
语法
NbrWedge({radius}, {startAngle}, {endAngle}, {units})
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
radius (可选) |
The radius is the distance from the corner of the wedge to the outer limit of the wedge. The radius is an integer or floating-point value. (默认值为 3) |
Double |
|
startAngle (可选) |
The The start angle is measured counterclockwise from the positive x-axis (3:00 on a clock) to the closest edge of the wedge. (默认值为 0) |
Double |
|
endAngle (可选) |
The The end angle is measured counterclockwise from the positive x-axis (3:00 on a clock) to the outer edge of the wedge. (默认值为 90) |
Double |
|
units (可选) |
Defines the units of the neighborhood.
(默认值为 CELL) |
String |
属性
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
radius (读取和写入) |
|
Double |
|
startAngle (读取和写入) |
按逆时针方向测量起始角(x 轴正向(3 点钟方向)到最近的楔形边)。 |
Double |
|
endAngle (读取和写入) |
按逆时针方向测量 |
Double |
|
units (读取和写入) |
定义邻域单位。
|
String |
代码示例
演示如何创建 NbrWedge 类以及如何在 Python 窗口的 BlockStatistics 工具中使用该类。
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outNbrWedge = BlockStatistics("block", NbrWedge(5, 10.5, 40, "MAP"))
outNbrWedge.save("C:/sapyexamples/output/blstatsnbrw2")
使用 NbrWedge 类执行 BlockStatistics 工具。
# Name: NbrWedge_Ex_02.py
# Description: Uses the NbrWedge object to run BlockStatistics tool
# 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 = "block"
# Create the Neighborhood Object
radius = 5
startAngle = 5
endAngle = 10
myNbrWedge = NbrWedge(radius, startAngle, endAngle, "")
# Run BlockStatistics
outBlkStats = BlockStatistics(inRaster, myNbrWedge, "MINIMUM", "DATA")
# Save the output
outBlkStats.save("C:/sapyexamples/output/blkst_wedge4")