[GRASS-dev] Re: [GRASS-user] barin option in r.flow module
Glynn Clements
glynn at gclements.plus.com
Sat Dec 20 23:56:01 EST 2008
Markus Neteler wrote:
> >> Hello everybody,
> >> I have got some troubles using r.flow with this option..it stays forever
> >> at the:
> >> Reading input files: elevation...
> >> , barrier
> >> If I remove the barin option, all is fine.
> >> I am using the DEM from spearfish with GRASS 6.2.3 and latest 6.4svn.
> >>
> > This is how replicate using Spearfish dataset:
> > g.region rast=elevation.10m
> > v.to.rast input=streams at PERMANENT output=streamsTest use=val type=line layer=1 value=1 rows=4096 --overwrite
> > r.null map=streamsTest null=0
> > r.report units=me map=streamsTest | grep "no data"
> > r.flow elevin=elevation.10m barin=streamsTest skip=37 bound=9432 flout=testvector lgout=testraster
>
> I can reproduce the crash (one typo fixed in above example):
>
>
> (gdb) r elevin=elevation.10m barin=streamTest skip=37 bound=9432 flout=testvector lgout=testraster
> Reading input files: barrier
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 47222862720544 (LWP 24952)]
> 0x00000000004050b8 in read_input_files () at io.c:121
> 121 put(ds, row, col, -1);
Initialisation of ds is conditional upon parm.dsout, which isn't set.
This should fix the immediate problem:
--- raster/r.flow/io.c (revision 34960)
+++ raster/r.flow/io.c (working copy)
@@ -117,7 +117,7 @@
G_get_d_raster_row(fd, barc, row);
for (col = 0; col < region.cols; col++) {
BM_set(bitbar, col, row, (barc[col] != 0));
- if (barc[col] != 0)
+ if (parm.dsout && barc[col] != 0)
put(ds, row, col, -1);
}
}
but I don't know if there are similar cases. If the two are intimately
related, then main() will need e.g.:
if (parm.barin && !parm.dsout)
G_fatal_error(_("barin= requires dsout="));
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list