[GRASS-user] r.watershed hangs

Charles Ehlschlaeger c.ehlschlaeger at insightbb.com
Sun Oct 22 22:18:41 EDT 2006

I think the problem occurs with "threshhold=3" You are telling the software
to create exterior watershed basins only 3 grid cells in size. I can't
remember off the top of my head whether that will potentially cause stack
overflow problems or maybe I forgot to include a check to see whether an
array memory allocation returned a null pointer.

The solution is to include a more realistic threshold size. Ask yourself
"what is the smallest watershed basin you want to consider?" If the answer
is 10,000m^2, and grid cells are 10x10m, then threshold should be set to

Sincerely, chuck

-----Original Message-----
From: grassuser-bounces at grass.itc.it [mailto:grassuser-bounces at grass.itc.it]
On Behalf Of Hamish
Sent: Sunday, October 22, 2006 8:03 PM
To: Hardeep Singh Rai
Cc: grassuser at grass.itc.it
Subject: Re: [GRASS-user] r.watershed hangs

Hardeep Singh Rai wrote:
> I was doing watershed analysis for spearfish dataset
> (spearfish_grass60data-0.1.tar.gz), and on giving command:
> r.watershed elevation=elevation.dem threshhold=3 basin=raiBasin
> accumulation=raiAccu it starts processing of 5 steps. After about 20
> minutes, it completes all and throw message: "cloing maps", but do
> nothing; prompt never comes. I used it with option -m and without it.
> With both cases, "top" commands show ram or sed running with 99 usage
> of CPU. Even I waited for 12 hours, but it fail to finish. I am using
> GRASS 6.0.1 on Ubuntu.
> Please suggest some solution.

It's a known bug (#3112). It gets stuck trying to make a huge set of
colormap rules for the new map. If you cancel (^C) you might find the
map was created anyway (???).

Try running with a smaller region (g.region)

I don't think it's a hard bug to fix, but no one has done it.

r.watershed bug reports:


another work-around: try the r.terraflow module. It is much more
advanced and can make watershed maps.


grassuser mailing list
grassuser at grass.itc.it

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.9/490 - Release Date: 10/20/2006

More information about the grass-user mailing list