[GRASS-user] r.stream.segement: DBMI-SQLite driver errors

Markus Metz markus.metz.giswork at gmail.com
Fri Aug 5 06:06:16 PDT 2016


On Fri, Aug 5, 2016 at 10:45 AM, Mira Kattwinkel
<kattwinkel-mira at uni-landau.de> wrote:
> Dear list
>
> When using r.stream.segment with specific combinations of the length and
> skip parameters (skip = 0 and length >5) I get the following error message:
>
> DBMI-SQLite driver error:
> Error in sqlite3_prepare():
> no such column: inf
> DBMI-SQLite driver error:
> Error in sqlite3_prepare():
> no such column: inf
> ERROR: Unable to inset new row: 'insert into streams_sectors_g5 values( 3,
> 3, 1, 3303, 180, 5.00896e-06, 0, 0, null, 51.465, 51.572, -0.106998, -inf )'

the last value to be inserted is gradient = drop / length = -0.106998
/ 0 = -inf. The test for length = 0 is missing, the result should be
null as for stright. This is a bug in r.stream.segment, fixed in
r69092. It is unclear why there can be zero-length sectors at all,
this is probably the real bug. Is the current region correctly aligned
to the input stream raster?
>
>
> When subsequently trying (with the --overwrite flag) other values for length
> and skip that used to work before, I get also an error:
>
> DBMI-SQLite driver error:
> Error in sqlite3_prepare():
> table streams_sectors_g5 already exists
> DBMI-SQLite driver error:
> Error in sqlite3_prepare():
> table streams_sectors_g5 already exists
> ERROR: Unable to create table: 'create table streams_sectors_g5 (cat
> integer, segment integer, sector integer, s_order integer, direction double
> precision, azimuth double precision, length double precision, stright double
> precision, sinusoid double precision, elev_min double precision, elev_max
> double precision, s_drop double precision, gradient double precision)'
>
> Hence, it seems that the table is locked due to the first failure.

The table is created, but the vector has not been created, therefore
the --overwrite flag has no effect and the table needs to be dropped
manually with db.droptable table=streams_sectors_g5

HTH,

Markus M

>
> When calling the same functions from R using execGRASS and --verbose flag,
> the error is even less informative:
>
> Error in execGRASS("r.stream.segment", flags = c("overwrite", "verbose"),  :
>   The command:
> r.stream.segment --overwrite --verbose stream_rast=streams_r direction=dirs
> elevation=dem segments=streams_segments20 sectors=streams_sectors20
> length=10 skip=0
> produced an error (1) during execution:
> All in RAM calculation...
> Reading raster map <streams_r>...
> Reading raster map <dirs>...
>   99
>
> and
>
> Error in execGRASS("r.stream.segment", flags = c("overwrite", "verbose"),  :
>   The command:
> r.stream.segment --overwrite --verbose stream_rast=streams_r direction=dirs
> elevation=dem segments=streams_segments20 sectors=streams_sectors20 length=1
> skip=0
> produced an error (1) during execution:
> All in RAM calculation...
> Reading raster map <streams_r>...
> Reading raster map <dirs>...
>   9
>
>
> Is this an error in my settings or maybe a bug in the r.stream.segment
> function?
> I am using GRASS 7.0.4 and rgrass7 on Linux Mint 17.3.
>
> Thanks for any suggestions,
> Mira
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user


More information about the grass-user mailing list