当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python ArcGIS flow_direction用法及代码示例


本文简要介绍 python 语言中 arcgis.raster.functions.gbl.flow_direction 的用法。

用法:

arcgis.raster.functions.gbl.flow_direction(input_surface_raster, force_flow='NORMAL', flow_direction_type='D8', generate_out_drop_raster=False)

返回:

应用函数的输出栅格

flow_direction.png

flow_direction 任务创建从每个像元到其最陡下坡邻居的流向栅格。

此任务支持三种流建模算法。它们是 D8、多流向 (MFD) 和 D-Infinity (DINF)。

D8流建模算法

D8 流动方法模拟从每个单元到其最陡下坡相邻单元的流动方向。

以 D8 流向类型运行的FlowDirection 任务的输出是一个整数栅格,其值范围为 1-255。从中心开始的每个方向的值如下:

flow_D8.gif

例如,如果最陡下降的方向在当前处理单元的左侧,则其流向将编码为 16。

以下是使用 D8 流法的其他注意事项:

  • If a cell is lower than its eight neighbors, that cell is given the value of its lowest neighbor, and flow is defined toward this cell. If multiple neighbors have the lowest value, the cell is still given this value, but flow is defined with one of the two methods explained below. This is used to filter out one-cell sinks, which are considered noise.

  • If a cell has the same change in z-value in multiple directions and that cell is part of a sink, the flow direction is referred to as undefined. In such cases, the value for that cell in the output flow direction raster will be the sum of those directions. For example, if the change in z-value is the same both to the right (flow direction = 1) and down (flow direction = 4), the flow direction for that cell is 5.

  • If a cell has the same change in z-value in multiple directions and is not part of a sink, the flow directions is assigned with a lookup table defining the most likely direction. See Greenlee (1987).

  • The output drop raster is calculated as the difference in z-value divided by the path length between the cell centers, expressed in percentages. For adjacent cells, this is analogous to the percent slop between cells. Across a flat area, the distance becomes the distance to the nearest cell of lower elevation. The result is a map of percent rise in the path of steepest descent from each cell.

  • When calculating a drop raster in flat areas, the distance to diagonally adjacent cells (1.41421 * cell size) is approximated by 1.5 * cell size for improved performance.

  • With the forceFlow parameter set to the default value False, a cell at the edge of the surface raster will flow towards the inner cell with the steepest z-value. If the drop is less than or equal to zero, the cell will flow out of the surface raster.

MFD 流动建模算法

秦等人说明的 MFD 算法。 (2007),分区从一个单元格流向所有下坡邻居。 flow-partition index 是根据当地地形条件通过自适应方法创建的,用于确定流向所有下坡邻居的流量比例。

将 MFD 流向输出添加到Map时,它仅显示 D8 流向。由于 MFD 流向可能具有与每个单元相关的多个值(每个值对应于流到每个下坡邻居的流量比例),因此不容易可视化。但是,MFD 流向输出栅格是 FlowAccumulation 任务识别的输入,该任务将利用 MFD 流向对从每个像元到所有下坡邻居的流量进行比例和累积。

DINF流建模算法

Tarboton (1997) 说明的 DINF 流动方法将流动方向确定为在以感兴趣单元为中心的 3x3 单元窗口中形成的八个三角形面上的最陡向下坡度。流向输出是一个浮点栅格,表示为从 0(正东)到 360(也是正东)逆时针方向的单个角度(以度为单位)。

Parameter

Description

input_surface_raster

必需的。表示连续表面的输入栅格。

force_flow

可选字符串。指定边单元是始终向外流动还是遵循正常流动规则。

选择列表:[‘NORMAL’, ‘FORCE’]

默认值为“正常”。

flow_direction_type

可选字符串。指定要使用的流向类型。

选择列表:[‘D8’、‘MFD’、‘DINF’]

  • D8 用于 D8 流向类型。这是默认设置。

  • MFD 用于多流向类型。

  • DINF 用于D-Infinity 类型。

默认值为“D8”。

generate_out_drop_raster

可选布尔值,确定是否应生成out_drop_raster。将此参数设置为 True,以便生成 out_drop_raster。如果设置为 true,则输出将是一个命名元组,其名称值为 output_flow_direction_service 和 output_drop_service。

例子:

# Usage Example: To add an image to an existing image collection.
flow_direction_output =  flow_direction(input_surface_raster=in_raster,
                                        force_flow="NORMAL",
                                        flow_direction_type="D8",
                                        generate_out_drop_raster=True)

out_var = flow_direction_output.save()

out_var.output_flow_direction_service  # gives you the output flow direction imagery layer item

out_var.output_drop_service # gives you the output drop raster imagery layer item

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.raster.functions.gbl.flow_direction。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。