Errors r.terraflow

Hello everybody! I just started using QGIS for university and I’m trying to extract a river network through the flow accumulation of a catchment. r.terraflow produces this error, can anybody help me? Thank you very much!!

QGIS version: 3.38.3-Grenoble
QGIS code revision: 37f9e6efee
Qt version: 5.15.13
Python version: 3.12.6
GDAL version: 3.9.2
GEOS version: 3.12.2-CAPI-1.18.2
PROJ version: Rel. 9.4.0, March 1st, 2024
PDAL version: 2.6.3 (git-version: b5523a)
GRASS version: 8.4.0
Algorithm started at: 2025-03-26T11:18:17
Algorithm ‘r.terraflow’ starting…
Input parameters:
{ ‘-s’ : True, ‘GRASS_RASTER_FORMAT_META’ : ‘’, ‘GRASS_RASTER_FORMAT_OPT’ : ‘’, ‘GRASS_REGION_CELLSIZE_PARAMETER’ : 0, ‘GRASS_REGION_PARAMETER’ : None, ‘accumulation’ : ‘TEMPORARY_OUTPUT’, ‘d8cut’ : None, ‘direction’ : ‘TEMPORARY_OUTPUT’, ‘elevation’ : ‘C:/Users/carlo/OneDrive - ETH Zurich/Documenti/Assistenz/Watershed modelling/Kleine Emme/Elev.asc’, ‘filled’ : ‘TEMPORARY_OUTPUT’, ‘memory’ : 300, ‘stats’ : ‘TEMPORARY_OUTPUT’, ‘swatershed’ : ‘TEMPORARY_OUTPUT’, ‘tci’ : ‘TEMPORARY_OUTPUT’ }

g.proj -c wkt=“C:/Users/carlo/AppData/Local/Temp/processing_xQKbvb/583b2723692a44bcafe5143912e747b1/crs.prj”
r.in.gdal input=“C:\Users\carlo\OneDrive - ETH Zurich\Documenti\Assistenz\Watershed modelling\Kleine Emme\Elev.asc” band=1 output=“rast_67e3d469a49543” --overwrite -o
g.region n=218087.5 s=169987.5 e=672587.5 w=619987.5 res=100.0
r.terraflow elevation=rast_67e3d469a49543 -s memory=300 filled=filled2b45a33d15084a7db28305726ed0485d direction=direction2b45a33d15084a7db28305726ed0485d swatershed=swatershed2b45a33d15084a7db28305726ed0485d accumulation=accumulation2b45a33d15084a7db28305726ed0485d tci=tci2b45a33d15084a7db28305726ed0485d stats=“C:/Users/carlo/AppData/Local/Temp/processing_xQKbvb/e96539c438634e03a8046b3cd2fe83e8/stats.txt” --overwrite
g.region raster=filled2b45a33d15084a7db28305726ed0485d
r.out.gdal -t -m input=“filled2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\909082c89bcb46eeae1192a4a6f6d271\filled.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
g.region raster=direction2b45a33d15084a7db28305726ed0485d
r.out.gdal -t -m input=“direction2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\e8de7bee922e425b828981d9da804b6e\direction.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
g.region raster=swatershed2b45a33d15084a7db28305726ed0485d
r.out.gdal -t -m input=“swatershed2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\768c864f36fe44b3b0f829bf812789d4\swatershed.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
g.region raster=accumulation2b45a33d15084a7db28305726ed0485d
r.out.gdal -t -m input=“accumulation2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\ea0f118704184accbe86b59762ffe877\accumulation.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
g.region raster=tci2b45a33d15084a7db28305726ed0485d
r.out.gdal -t -m input=“tci2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\a2e1939662d34f5c9a587bbc8da7b2ef\tci.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
WARNING: Concurrent mapset locking is not supported on Windows
C:\Users\carlo\Documents>chcp 1252 1>NUL
C:\Users\carlo\Documents>g.proj -c wkt=“C:/Users/carlo/AppData/Local/Temp/processing_xQKbvb/583b2723692a44bcafe5143912e747b1/crs.prj”
Default region was updated to the new projection, but if you have multiple mapsets g.region -d should be run in each to update the region from the default
Projection information updated
C:\Users\carlo\Documents>r.in.gdal input=“C:\Users\carlo\OneDrive - ETH Zurich\Documenti\Assistenz\Watershed modelling\Kleine Emme\Elev.asc” band=1 output=“rast_67e3d469a49543” --overwrite -o
No projection information available
Over-riding projection check
Importing raster map <rast_67e3d469a49543>…
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
C:\Users\carlo\Documents>g.region n=218087.5 s=169987.5 e=672587.5 w=619987.5 res=100.0
C:\Users\carlo\Documents>r.terraflow elevation=rast_67e3d469a49543 -s memory=300 filled=filled2b45a33d15084a7db28305726ed0485d direction=direction2b45a33d15084a7db28305726ed0485d swatershed=swatershed2b45a33d15084a7db28305726ed0485d accumulation=accumulation2b45a33d15084a7db28305726ed0485d tci=tci2b45a33d15084a7db28305726ed0485d stats=“C:/Users/carlo/AppData/Local/Temp/processing_xQKbvb/e96539c438634e03a8046b3cd2fe83e8/stats.txt” --overwrite
SFD (D8) flow direction
D8CUT=999999986991104.000000
Memory size: 300.00M (314572800) bytes

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

REASSIGNING DIRECTIONS
finding flat areas (plateaus and depressions)
assigning directions on plateaus
creating flowStream: [AMI_STREAM C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\grassdata\temp_location\PERMANENT.tmp/unknown\19856.0/flowStream 0]
compute flow directions done.
WARNING: Raster map <rast_67e3d469a49543> is of type CELL_TYPE – you should use r.terraflow.short
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
WARNING: Watershed 1 (R=1) not done
Writing to raster map …
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
Writing to raster map …
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
Writing to raster map …
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
ERROR: Rast_make_random_colors: min (1) > max (0)
C:\Users\carlo\Documents>g.region raster=filled2b45a33d15084a7db28305726ed0485d
C:\Users\carlo\Documents>r.out.gdal -t -m input=“filled2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\909082c89bcb46eeae1192a4a6f6d271\filled.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
ERROR 6: filled.tif, band 1: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
Checking GDAL data type and nodata value…
2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100
Using GDAL data type
Exporting raster data to GTiff format…
2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100
r.out.gdal complete. File <C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\909082c89bcb46eeae1192a4a6f6d271\filled.tif> created.
C:\Users\carlo\Documents>g.region raster=direction2b45a33d15084a7db28305726ed0485d
C:\Users\carlo\Documents>r.out.gdal -t -m input=“direction2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\e8de7bee922e425b828981d9da804b6e\direction.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
Checking GDAL data type and nodata value…
2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100
Using GDAL data type
Exporting raster data to GTiff format…
2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100
r.out.gdal complete. File <C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\e8de7bee922e425b828981d9da804b6e\direction.tif> created.
C:\Users\carlo\Documents>g.region raster=swatershed2b45a33d15084a7db28305726ed0485d
C:\Users\carlo\Documents>r.out.gdal -t -m input=“swatershed2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\768c864f36fe44b3b0f829bf812789d4\swatershed.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
Checking GDAL data type and nodata value…
2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100
Using GDAL data type
Exporting raster data to GTiff format…
2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100
r.out.gdal complete. File <C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\768c864f36fe44b3b0f829bf812789d4\swatershed.tif> created.
C:\Users\carlo\Documents>g.region raster=accumulation2b45a33d15084a7db28305726ed0485d
ERROR: Raster map not found
C:\Users\carlo\Documents>r.out.gdal -t -m input=“accumulation2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\ea0f118704184accbe86b59762ffe877\accumulation.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
ERROR: Raster map or group not found
C:\Users\carlo\Documents>g.region raster=tci2b45a33d15084a7db28305726ed0485d
ERROR: Raster map not found
C:\Users\carlo\Documents>r.out.gdal -t -m input=“tci2b45a33d15084a7db28305726ed0485d” output=“C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\a2e1939662d34f5c9a587bbc8da7b2ef\tci.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite
ERROR: Raster map or group not found
C:\Users\carlo\Documents>exit
Premere un tasto per continuare . . .
Execution completed in 6.92 seconds
Results:
filled: C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\909082c89bcb46eeae1192a4a6f6d271\filled.tif
direction: C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\e8de7bee922e425b828981d9da804b6e\direction.tif
swatershed: C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\768c864f36fe44b3b0f829bf812789d4\swatershed.tif
accumulation: C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\ea0f118704184accbe86b59762ffe877\accumulation.tif
tci: C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\a2e1939662d34f5c9a587bbc8da7b2ef\tci.tif
stats: C:\Users\carlo\AppData\Local\Temp\processing_xQKbvb\e96539c438634e03a8046b3cd2fe83e8\stats.txt

Loading resulting layers
The following layers were not correctly generated.
• C:/Users/carlo/AppData/Local/Temp/processing_xQKbvb/ea0f118704184accbe86b59762ffe877/accumulation.tif
You can check the ‘Log Messages Panel’ in QGIS main window to find more information about the execution of the algorithm.

Looks like something is wrong with the sink-watershed raster, if you don’t compute it, does it still fail? It’s hard to debug this without reproducible example.

1 Like

Thank you!! This is the catchment: polybox . I tried without the sink-watershed and I get a slightly different output: 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


REASSIGNING DIRECTIONS

finding flat areas (plateaus and depressions)

assigning directions on plateaus

creating flowStream: [AMI_STREAM C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\grassdata\temp_location\PERMANENT.tmp/unknown\25612.0/flowStream 0]

compute flow directions done.

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

WARNING: Watershed 1 (R=1) not done

Writing to raster map …

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

Writing to raster map …

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

Writing to raster map …

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

ERROR: Rast_make_random_colors: min (1) > max (0)

C:\Users\carlo\Documents>g.region raster=filled249551de998e4268b59d2f81133eed21

C:\Users\carlo\Documents>r.out.gdal -t -m input=“filled249551de998e4268b59d2f81133eed21” output=“C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\bb5feec0309442deab430a13a8c148a3\filled.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite

ERROR 6: filled.tif, band 1: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.

Checking GDAL data type and nodata value…

2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100

Using GDAL data type

Exporting raster data to GTiff format…

2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100

r.out.gdal complete. File <C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\bb5feec0309442deab430a13a8c148a3\filled.tif> created.

C:\Users\carlo\Documents>g.region raster=direction249551de998e4268b59d2f81133eed21

C:\Users\carlo\Documents>r.out.gdal -t -m input=“direction249551de998e4268b59d2f81133eed21” output=“C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\531dbc7ae4194c059ad048975c5629d3\direction.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite

Checking GDAL data type and nodata value…

2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100

Using GDAL data type

Exporting raster data to GTiff format…

2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100

r.out.gdal complete. File <C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\531dbc7ae4194c059ad048975c5629d3\direction.tif> created.

C:\Users\carlo\Documents>g.region raster=swatershed249551de998e4268b59d2f81133eed21

C:\Users\carlo\Documents>r.out.gdal -t -m input=“swatershed249551de998e4268b59d2f81133eed21” output=“C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\9a5298fa0ab24230b949544fa8e8af11\swatershed.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite

Checking GDAL data type and nodata value…

2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100

Using GDAL data type

Exporting raster data to GTiff format…

2…5…8…11…14…17…20…23…26…29…32…35…38…41…44…47…50…53…56…59…62…65…68…71…74…77…80…83…86…89…92…95…98…100

r.out.gdal complete. File <C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\9a5298fa0ab24230b949544fa8e8af11\swatershed.tif> created.

C:\Users\carlo\Documents>g.region raster=accumulation249551de998e4268b59d2f81133eed21

ERROR: Raster map not found

C:\Users\carlo\Documents>r.out.gdal -t -m input=“accumulation249551de998e4268b59d2f81133eed21” output=“C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\a33f0decfa9f42b09edf96e3d4b9a5d6\accumulation.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite

ERROR: Raster map or group not found

C:\Users\carlo\Documents>g.region raster=tci249551de998e4268b59d2f81133eed21

ERROR: Raster map not found

C:\Users\carlo\Documents>r.out.gdal -t -m input=“tci249551de998e4268b59d2f81133eed21” output=“C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\81ff75869f134897aba56010c0b795f2\tci.tif” format=“GTiff” createopt=“TFW=YES,COMPRESS=LZW” --overwrite

ERROR: Raster map or group not found

C:\Users\carlo\Documents>exit

Premere un tasto per continuare . . .

Execution completed in 7.59 seconds

Results:

filled: C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\bb5feec0309442deab430a13a8c148a3\filled.tif

direction: C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\531dbc7ae4194c059ad048975c5629d3\direction.tif

swatershed: C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\9a5298fa0ab24230b949544fa8e8af11\swatershed.tif

accumulation: C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\a33f0decfa9f42b09edf96e3d4b9a5d6\accumulation.tif

tci: C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\81ff75869f134897aba56010c0b795f2\tci.tif

stats: [C:\Users\carlo\AppData\Local\Temp\processing_AGcHTO\5d06f94bf5c24336ae82f7dfa1e6e6b5\stats.txt](file:///C:/Users/carlo/AppData/Local/Temp/processing_AGcHTO/5d06f94bf5c24336ae82f7dfa1e6e6b5/stats.txt)

Loading resulting layers

The following layers were not correctly generated.
• C:/Users/carlo/AppData/Local/Temp/processing_AGcHTO/a33f0decfa9f42b09edf96e3d4b9a5d6/accumulation.tif
You can check the ‘Log Messages Panel’ in QGIS main window to find more information about the execution of the algorithm.

It looks like it is still computing it. When I try locally and omit that output, it works. But it looks like there is some problem with that specific output.

So when you omit the sink-watershed you get the accumulation raster? How do you omit it then? Because on mine it doesn’t show…

That’s a QGIS question, if you run it directly from GRASS it works fine.
Alternatively, have you tried r.watershed?