I am attempting to create a catchment of Danube.

So far I have used the r.fill.dir to create a depressionless map and flow directions. Thus, I am now looking to use r.watershed to create stream segments and drainage directions.

I have used the depressionless map as input, chose 100,000 as minimum and 10,000 as maximum values respectively. Additionally, I unchecked every post except stream segments and drainage directions. These have been assigned paths as well.

After running the tool I get this error message;

enter image description here

I tried increasing the maximum memory allowed for the process, but I keep getting the same error message.

Anybody know how to resolve the issue?


First, for the GRASS module r.watershed there is no need to fill depressions. The routing algorithm works fine delineating streams thru real depressions.

Now, in order to answer the memory issue, we need to know the region settings. So please enter at the command prompt g.region -p and post the output.

What are the 10,000 and 100,000 values referring to? (what is minimum and maximum?)

  • projection: 3 (Latitude-Longitude) zone: 0 datum: wgs84 ellipsoid: wgs84 north: 90N south: 90S west: 180W east: 180E nsres: 1 ewres: 1 rows: 180 cols: 360 cells: 64800 the min and max values are from the watershed tool. They represent the minimum size of exterior watershed basin and maximum length of surface flow. – Petter Christensen Apr 12 '18 at 12:34
  • If I understand, you're trying to delineate watersheds for the whole world, working at a resolution 1 degree X 1 degree. So a total of 64800 pixels. And you're setting the min basin size at 10,000. So you'll be dividing the world into about 6 basins total? The malloc error in your post indicates that the process could not allow 1.3 GB of memory. That should not happen with these region settings. What is the resolution of the DEM you are using? (run r.info on the DEM) – Micha Apr 13 '18 at 8:59
  • BTW, the Danube is a large river, but the drainage area is much smaller than 10,000 sq degrees... It's about 800,000 sq km, so about 7 sq degrees. – Micha Apr 13 '18 at 9:11
  • Sorry for the late replies, working on some other projects as well. I am fairly new to QGIS and especially working on watershed calculations. I tried some values I found in an article, but they might not make sence in this case. Should I alter the min- and max values? Additionally, how do I run the command prompt on a DEM? I assume you run it in Grass, but I have never used the program before. – Petter Christensen Apr 14 '18 at 19:21
  • I like to use GRASS on its own, from the command prompt. But that's a matter of personal preference. I think you need to first determine what coordinate system the original DEM is projected in. (I doubt that it is Long/Lat) and what the units are. Then you choose the minimum basin size as the number of pixels that make up your desired basin. And before trying to run r.watershed, you must (like in all GRASS modules) set the region to match your study area. – Micha Apr 15 '18 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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