1

I'm using QGIS 3.10.11 with GRASS 7.8.4, and the default SAGA version that's included with the QGIS standalone 3.10.11 installer from QGIS.com.

I'm having an issue where r.terraflow fails after using a fill-sinks algorithm.

Please try to see if you can replicate this problem in QGIS:

  1. Start with a raster terrain ".tif" DEM, resolution 1x1m
  2. Run r.terraflow on the DEM from step 1 (should not produce any issues)
  3. Export a copy of the TIFF-file from step 1 to ".sdat"
  4. From the processing toolbox, use "Fill sinks (wang & liu)" on the .sdat-file created in step 3. Save the filled DEM to .sdat (do not use "Temporary output") untick the other boxes in the dialog window.
  5. Try now to use "r.terraflow" on the output from step 4. (this fails)
  6. Try to export the output from step 4 to ".tif" (works fine), and the try to use "r.terraflow" on the ".tif" (this fails).

I cannot understand what happens to the raster during the "Fill sinks (wang & liu)" step that makes "r.terraflow" crash.

On a side note, if there is no workaround to this, are there any processing tools in QGIS that calculates a flow accumulation raster using the D8 algorithm? (The raster shoud be processed with "Fill sinks (wang & liu)" beforehand).

2
  • Consider to skip the sink-filling step, see grasswiki.osgeo.org/wiki/…
    – markusN
    Oct 27, 2020 at 13:53
  • 1
    I'd recommend Whitebox Tools (WBT) if you are looking for a D8 Flow Accumulation processing tool in QGIS. Requires a plugin, but many of the tools are faster than the equivalent GRASS or SAGA ones. WBT also has various Fill Sinks and Breach Depressions tools. Apr 19, 2023 at 22:29

1 Answer 1

0

I have encountered the same problem following your instruction, using QGIS Standalone Desktop 3.10.8 with GRASS 7.8.3 - it may not be the exact same situation.

Comparing the logs, I see differences in relatively earlier part of the processes.

Good one (from your Step1 process): It seems r.terraflow had tried to find flat areas then assign direction to them - and moved on to series of processes to build watershed, reassign directions, compute flow accumulations.

------------------------------
COMPUTING FLOW DIRECTIONS
classifying nodata (inner & boundary)
assigning preliminary directions
finding flat areas (plateaus and depressions)
assigning directions on plateaus
generating watersheds and watershed graph
flooding depressions
UnionFind::makeSet: reallocate double 2000
UnionFind::makeSet: reallocate double 4000
UnionFind::makeSet: reallocate double 8000
------------------------------
REASSIGNING DIRECTIONS
finding flat areas (plateaus and depressions)
assigning directions on plateaus
creating flowStream: [AMI_STREAM C:\Users\userr\AppData\Local\Temp\processing_c2e9be7efa814ae296dd152e65854110\grassdata\temp_location\PERMANENT\.tmp/unknown\17652.0/flowStream 0]
compute flow directions done.
------------------------------
COMPUTING FLOW ACCUMULATION
creating sweep stream from fill output stream
sorting sweep stream
sorting sweep output stream
Reading input data...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100

Failed one (Step5): In this case r.terraflow eventually failed to find flat areas on the raster produced by Fill sinks (Wang & Liu) (probably there was none).

------------------------------
COMPUTING FLOW DIRECTIONS
classifying nodata (inner & boundary)
assigning preliminary directions
finding flat areas (plateaus and depressions)
assigning directions on plateaus
Reading input data...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
Assertion failed: width*height*sizeof(gridElement) < getAvailableMemory(), file grid.cpp, line 34
C:\Users\userr\Documents>g.region raster=filled8b5079ebfc5249bab2b3655a4799c8c9
Error:Raster Map <filled8b5079ebfc5249bab2b3655a4799c8c9> is not found.

I honestly don't know any workaround... A tool I would recommend is WhiteBox - GAT. It can read SAGA sdat format and you will find the D8 Flow Accumulation tools in Hydrological Tools / Flow Accumulation group. WhiteBox plugin for QGIS Processing is also available, but I still love this GUI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.