GRASS logo


r.flowaccumulation - Calculates flow accumulation from a flow direction raster map using the Memory-Efficient Flow Accumulation (MEFA) parallel algorithm by Cho (2023).


raster, hydrology, accumulation


r.flowaccumulation --help
r.flowaccumulation input=name format=string output=name [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


input=name [required]
Name of input direction raster map
format=string [required]
Format of input direction raster map
Options: auto, degree, 45degree, power2
Default: auto
auto: auto-detect direction format
degree: degrees CCW from East
45degree: degrees CCW from East divided by 45 (e.g. r.watershed)
power2: powers of 2 CW from East (e.g., r.terraflow, ArcGIS)
output=name [required]
Name for output flow accumulation raster map

Table of contents


r.flowaccumulation calculates flow accumulation from a flow direction raster map using the Memory-Efficient Flow Accumulation (MEFA) parallel algorithm by Cho (2023).


Unlike r.watershed, but just like r.accumulate, r.flowaccumulation does not require elevation data to calculate flow accumulation. Instead, this module only uses a flow direction raster map to trace and accumulate the amount of flow draining through and including each cell.

r.flowaccumulation supports parallel computation of flow accumulation using OpenMP while r.accumulate does not. However, for weighted flow accumulation, use r.accumulate.

The module recognizes three different formats of flow directions:


Since the module does not use elevation data (i.e., slope), flow accumulation is calculated by single flow direction (SFD) routing and may not be comparable to the result from multiple flow direction (MFD) routing.


These examples use the North Carolina sample dataset.

Calculate flow accumulation using r.watershed and r.flowaccumulation:

# set computational region
g.region -p raster=elevation

# calculate positive flow accumulation and drainage directions using r.watershed
# for comparison, use -s (SFD)
r.watershed -sa elevation=elevation accumulation=flow_accum drainage=drain_directions

# calculate flow accumulation using r.flowaccumulation
r.flowaccumulation input=drain_directions output=flow_accum_new

# copy color table
r.colors map=flow_accum_new raster=flow_accum

# check difference between flow_accum and flow_accum_new
r.mapcalc expression="flow_accum_diff=if(flow_accum-flow_accum_new, flow_accum-flow_accum_new, null())"

There are slight differences between the two output maps. The yellow and purple cells show the difference raster map (flow_accum_diff). The red arrows and numbers represent drainage directions (drain_directions) and flow accumulation by r.watershed (flow_accum), respectively. Note that some cells close to headwater cells are assigned 1 even though they are located downstream of other cells.

For comparison, these numbers show the new flow accumulation by r.flowaccumulation (flow_accum_new). The same cells are properly accumulated from the headwater cells.


r.accumulate, r.watershed,,


Huidae Cho, July 2023. Memory-Efficient Flow Accumulation Using a Look-Around Approach and Its OpenMP Parallelization. Environmental Modelling & Software 167, 105771. doi:10.1016/j.envsoft.2023.105771.


Huidae Cho, New Mexico State University


Available at: r.flowaccumulation source code (history)

Latest change: Wednesday Nov 08 17:11:07 2023 in commit: 91cec76abcffe4296d5e3f1afb3cea3c1633f8a3

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2023 GRASS Development Team, GRASS GIS 8.3.2dev Reference Manual