Flow Accumulation (Spatial Analyst)
Summary
Creates a raster of accumulated flow into each cell. A weight factor can optionally be applied.
Illustration
|  | 
|   Flow_Acc = FlowAccumulation(Flow_Dir) | 
Usage
- 
The result of Flow Accumulation is a raster of accumulated flow to each cell, as determined by accumulating the weight for all cells that flow into each downslope cell. 
- 
Cells of undefined flow direction will only receive flow; they will not contribute to any downstream flow. A cell is considered to have an undefined flow direction if its value in the flow direction raster is anything other than 1, 2, 4, 8, 16, 32, 64, or 128. 
- 
The accumulated flow is based on the number of cells flowing into each cell in the output raster. The current processing cell is not considered in this accumulation. 
- 
Output cells with a high flow accumulation are areas of concentrated flow and can be used to identify stream channels. 
- 
Output cells with a flow accumulation of zero are local topographic highs and can be used to identify ridges. 
- 
If the input flow direction raster is not created with the Flow Direction tool, there is a chance that the defined flow could loop. If the flow direction does loop, Flow Accumulation will go into an infinite loop and never finish. 
- The Flow Accumulation tool does not honour the Compression environment setting. The output raster will always be uncompressed. 
Syntax
| Parameter | Explanation | Data Type | 
| in_flow_direction_raster | The input raster that shows the direction of flow out of each cell. The flow direction raster can be created using the Flow Direction tool. | Raster Layer | 
| in_weight_raster (Optional) | An optional input raster for applying a weight to each cell. If no weight raster is specified, a default weight of 1 will be applied to each cell. For each cell in the output raster, the result will be the number of cells that flow into it. | Raster Layer | 
| data_type (Optional) | The output accumulation raster can be integer or floating point type. 
 | String | 
Return Value
| Name | Explanation | Data Type | 
| out_accumulation_raster | The output raster that shows the accumulated flow to each cell. | Raster | 
Code Sample
This example creates a raster of accumulated flow into each cell of an input flow direction GRID raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outFlowAccumulation = FlowAccumulation("flowdir")
outFlowAccumulation.save("C:/sapyexamples/output/outflowacc01")
This example creates a raster of accumulated flow into each cell of an input flow direction IMG raster.
# Name: FlowAccumulation_Ex_02.py
# Description: Creates a raster of accumulated flow to each cell.
# 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
inFlowDirRaster = "flowdir"
inWeightRaster = ""
dataType = "INTEGER"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute FlowDirection
outFlowAccumulation = FlowAccumulation(inFlowDirRaster, inWeightRaster, dataType)
# Save the output 
outFlowAccumulation.save("C:/sapyexamples/output/outflowacc02.img")