Flow Accumulation (Spatial Analyst)

Available with Spatial Analyst license.

Summary

Creates a raster of accumulated flow into each cell. A weight factor can optionally be applied.

Learn more about how Flow Accumulation works

Illustration

D8 Flow Accumulation 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.

  • The Flow Accumulation tool supports three flow modeling algorithms while computing accumulated flow. These are D8, Multiple Flow Direction (MFD) and D-Infinity (DINF) flow methods.

  • 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 contains a loop, Flow Accumulation will go into an endless cycle and never finish.

    Input flow direction can be created using the D8, Multiple Flow Direction (MFD) or D-Infinity (DINF) methods. The type of input flow direction raster between these three influences how the Flow Accumulation tool partitions and accumulates flow in each cell. Use the Input flow direction type to specify which method was used when the flow direction raster was created.

  • Cells of undefined flow direction will only receive flow; they will not contribute to any downstream flow.

    For an input D8 flow direction raster, 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.

    For an input D-Infinity flow direction raster, a cell is considered to have an undefined flow direction if its value in the flow direction raster is -1.

  • The accumulated flow is based on the number of total or a fraction 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.

  • The Flow Accumulation tool does not honour the Compression environment setting. The output raster will always be uncompressed.

  • This tool supports parallel processing. If your computer has multiple processors or processors with multiple cores, better performance may be achieved, particularly on larger datasets. The Parallel processing with Spatial Analyst help topic has more details on this capability and how to configure it.

    When using parallel processing, temporary data will be written to manage the data chunks being processed. The default temp folder location will be on your local C drive. You can control the location of this folder by setting up a system environment variable named TempFolders and specifying the path to a folder to use (for example, E:\RasterCache). If you have admin privileges on your machine, you can also use a registry key (for example, [HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro\Raster]).

    By default, this tool will use 50 percent of the available cores. If the input data is smaller than 5,000 by 5,000 cells in size, fewer cores may be used. You can control the number of cores the tool uses with the Parallel processing factor environment.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Syntax

FlowAccumulation(in_flow_direction_raster, {in_weight_raster}, {data_type}, {flow_direction_type})
ParameterExplanationData 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.

The flow direction raster can be created using D8, Multiple Flow Direction (MFD) and D-Infinity methods. Use the flow_direction_type parameter to specify which method was used when the flow direction raster was created.

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, floating point, or double type.

  • FLOATThe output raster will be floating point type. This is the default.
  • INTEGERThe output raster will be integer type.
  • DOUBLEThe output raster will be double type.
String
flow_direction_type
(Optional)

The input flow direction raster can be of type D8, Multi Flow Direction (MFD) or D-Infinity (DINF).

  • D8The input flow direction raster is of type D8. This is the default.
  • MFDThe input flow direction raster is of type Multi Flow Direction (MFD).
  • DINFThe input flow direction raster is of type D-Infinity (DINF).
String

Return Value

NameExplanationData Type
out_accumulation_raster

The output raster that shows the accumulated flow to each cell.

Raster

Code sample

FlowAccumulation example 1 (Python window)

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")
FlowAccumulation example 2 (stand-alone script)

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"

# Execute FlowDirection
outFlowAccumulation = FlowAccumulation(inFlowDirRaster, inWeightRaster, dataType)

# Save the output 
outFlowAccumulation.save("C:/sapyexamples/output/outflowacc02.img")

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics