[GRASS-user] r.terraflow usage (segfault)

Hi

i'm tring to use "r.terraflow"

following the help page i see :

r.terraflow elev=spearfish filled=spearfish-filled \
     dir=spearfish-mfdir swatershed=spearfish-watershed \
     accumulation=spearfish-accu tci=spearfish-tci

but i can't find any "spearfish" elevation data in the spearfish dataset
so i used elevation.dem insted, but i've a segfault :-/

i tried with different locatiuon too, using:
as data input an elevetion model (230m resolution)
in a wgs84 UTM 33 N location

but i have segfault again....

mybe my knowledge of the r.terraflow application is not so good, and i'm missing something to prepare the input data ?

i tried the same step having the same results
on a grass64 svn builded from source on different platforms
(ubuntu 8.04 32 bit , osx 10.5)

thanks for any help!

regards,

Massimo Di Stefano.
Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com

On Thu, Nov 13, 2008 at 7:23 PM, Massimo Di Stefano
<massimodisasha@yahoo.it> wrote:

Hi

i'm tring to use "r.terraflow"

following the help page i see :

r.terraflow elev=spearfish filled=spearfish-filled \
   dir=spearfish-mfdir swatershed=spearfish-watershed \
   accumulation=spearfish-accu tci=spearfish-tci

but i can't find any "spearfish" elevation data in the spearfish dataset
so i used elevation.dem insted,

I have fixed the nonsense example to

r.terraflow elev=elevation.10m filled=elevation10m.filled \
    dir=elevation10m.mfdir swatershed=elevation10m.watershed \
    accumulation=elevation10m.accu tci=elevation10m.tci

but i've a segfault :-/

Me, too.

This hack seems to cure the problem:
Index: main.cc

--- main.cc (revision 34205)
+++ main.cc (working copy)
@@ -211,7 +211,13 @@
   struct Cell_head cell_hd;
   if (G_get_cellhd (cellname, mapset, &cell_hd) < 0)
     G_fatal_error(_("Cannot read header of [%s]"), cellname);
-
+
+ /* get the current region and dimensions */
+ region = (struct Cell_head*)malloc(sizeof(struct Cell_head));
+ assert(region);
+ if (G_get_set_window(region) == -1) {
+ G_fatal_error("r.terraflow: error getting current region");
+ }
   /* check compatibility with module region */
   if (!((region->ew_res == cell_hd.ew_res)
                && (region->ns_res == cell_hd.ns_res))) {

but I dunno much about C++.

Markus

Markus Neteler wrote:

On Thu, Nov 13, 2008 at 7:23 PM, Massimo Di Stefano
<massimodisasha@yahoo.it> wrote:
> Hi
>
> i'm tring to use "r.terraflow"
>
> following the help page i see :
>
> r.terraflow elev=spearfish filled=spearfish-filled \
> dir=spearfish-mfdir swatershed=spearfish-watershed \
> accumulation=spearfish-accu tci=spearfish-tci
>
>
> but i can't find any "spearfish" elevation data in the spearfish dataset
> so i used elevation.dem insted,

I have fixed the nonsense example to

r.terraflow elev=elevation.10m filled=elevation10m.filled \
    dir=elevation10m.mfdir swatershed=elevation10m.watershed \
    accumulation=elevation10m.accu tci=elevation10m.tci

> but i've a segfault :-/

Me, too.

This was introduced by r34198, which was back-ported in r34205.

This hack seems to cure the problem:

region is being allocated, but not until after that point.

Fixed in r34285.

--
Glynn Clements <glynn@gclements.plus.com>

On Fri, Nov 14, 2008 at 1:36 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

On Thu, Nov 13, 2008 at 7:23 PM, Massimo Di Stefano
<massimodisasha@yahoo.it> wrote:
> Hi
>
> i'm tring to use "r.terraflow"
>
> following the help page i see :
>
> r.terraflow elev=spearfish filled=spearfish-filled \
> dir=spearfish-mfdir swatershed=spearfish-watershed \
> accumulation=spearfish-accu tci=spearfish-tci
>
>
> but i can't find any "spearfish" elevation data in the spearfish dataset
> so i used elevation.dem insted,

I have fixed the nonsense example to

r.terraflow elev=elevation.10m filled=elevation10m.filled \
    dir=elevation10m.mfdir swatershed=elevation10m.watershed \
    accumulation=elevation10m.accu tci=elevation10m.tci

> but i've a segfault :-/

Me, too.

This was introduced by r34198, which was back-ported in r34205.

This hack seems to cure the problem:

region is being allocated, but not until after that point.

Fixed in r34285.

backported to 6.4.svn.

Markus