[GRASS-user] r.terraflow problem

Dear GRASS users,

I am trying to run r.terraflow in GRASS 6.4.0svn (GIS library revision: 37101 (2009-05-10)) provided as part of the OSGeo4W bundle on WinXP. The command prints some output, which looks normal, and then exits right away without doing anything.

Here is the command and the output I get:

(Thu Jul 29 13:32:43 2010)
r.terraflow --overwrite --verbose elevation=dem@PERMANENT filled=tf_dem direction=tf_fdir swatershed=tf_sink accumulation=tf_fac tci=tf_tci STREAM_DIR=C:/Active_projects/tmp/tf
cell dem header compatible with region header
stats.out: File exists
Elevation stored as FLOAT (4B)
Region size is 13000 x 9200
STREAM temporary files in C:/Active_projects/tmp/tf (THESE
INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF ABNORMAL
TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE DELETE
THESE FILES MANUALLY!)
file stats.out exists - renaming.
(Thu Jul 29 13:32:43 2010) Command finished (0 sec)

Does anyone have any idea what might be going wrong here?

Thank you,

Aleksey

Aleksey Naumov wrote:

Dear GRASS users,

I am trying to run r.terraflow in GRASS 6.4.0svn (GIS library revision:
37101 (2009-05-10)) provided as part of the OSGeo4W bundle on WinXP. The
command prints some output, which looks normal, and then exits right away
without doing anything.

Here is the command and the output I get:

(Thu Jul 29 13:32:43
2010)
r.terraflow --overwrite --verbose elevation=dem@PERMANENT filled=tf_dem
direction=tf_fdir swatershed=tf_sink accumulation=tf_fac tci=tf_tci
STREAM_DIR=C:/Active_projects/tmp/tf
cell dem header compatible with region header
stats.out: File exists
Elevation stored as FLOAT (4B)
Region size is 13000 x 9200

This is 119.6 million cells, too large for wingrass, r.terraflow will
most likely abort because the temporary files become too large (no
large file support in wingrass). Try r.watershed instead.

STREAM temporary files in C:/Active_projects/tmp/tf (THESE
INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF ABNORMAL
TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE DELETE
THESE FILES MANUALLY!)
file stats.out exists - renaming.

Either manually delete the file stats.out first before running
r.terraflow or, as suggested in the other reply, update grass.

Markus M

Aleksey Naumov wrote:

STREAM temporary files in C:/Active_projects/tmp/tf
(THESE INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF
ABNORMAL TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE
DELETE THESE FILES MANUALLY!)

! follow the advice from this message: it can leave very big
files behind in your Temp dir.

if you have lots of RAM, setting the memory option to 75% of your
total physical memory can help keep those files smaller.

Hamish

Markus,

Thank you for your help. At least I figured out why r.terraflow would not run at all - I had both stats.out and stats.out.old sitting on my hard disk from some time before. As I understand now, r.terraflow creates a backup of the runtime statistics file (by default, stats.out.old), and if this backup file already exists, it simply refuses to remove it and bails out. Once I removed the backup file r.terraflow started running.

The more interesting part is getting it to run to completion. It now stops on a failed assertion (see below). Is this assertion related to the temporary file size limitation you mentioned (for wingrass)? The thing is, the temporary file does not get that large, only about 460 MB.

I thought that r.terraflow scales better to larger DEMs than r.watershed, but I’ll try r.watershed next.

As far as updating grass, this version (GRASS 6.4.0svn-7) is the latest available via OSGeo4W. What other options do I have on WinXP (a Cygwin-based install?)?

Thank you,
Aleksey

r.terraflow --overwrite --verbose elevation=dem@PERMANENT filled=tf_dem direction=tf_fdir swatershed=tf_sink accumulation=tf_fac tci=tf_tci STREAM_DIR=C:/Active_projects/tmp/tf stats=C:/Active_projects/tmp/tf/stats.out
MFD flow direction
D8CUT=999999986991104.000000
Memory size: 300.00M (314572800) bytes
Memory manager registering memory in MM_WARN_ON_MEMORY_EXCEEDED mode.
cell dem header compatible with region header
Elevation stored as FLOAT (4B)
Region size is 13000 x 9200
STREAM temporary files in C:/Active_projects/tmp/tf (THESE
INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF ABNORMAL
TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE DELETE
THESE FILES MANUALLY!)
file C:/Active_projects/tmp/tf/stats.out exists - renaming.
reading data from dem to stream
C:/Active_projects/tmp/tf/STREAM_a05968:
Assertion failed: nrows * ncols == str->stream_len(), file
grass2str.h, line 144
This application has requested the Runtime to terminate it
in an unusual way.
Please contact the application’s support team for more
information.
(Fri Jul 30 11:36:59 2010) Command finished (36 sec)

On Fri, Jul 30, 2010 at 2:23 AM, Markus Metz <markus.metz.giswork@googlemail.com> wrote:

Aleksey Naumov wrote:

Dear GRASS users,

I am trying to run r.terraflow in GRASS 6.4.0svn (GIS library revision:
37101 (2009-05-10)) provided as part of the OSGeo4W bundle on WinXP. The
command prints some output, which looks normal, and then exits right away
without doing anything.

Here is the command and the output I get:

(Thu Jul 29 13:32:43
2010)
r.terraflow --overwrite --verbose elevation=dem@PERMANENT filled=tf_dem
direction=tf_fdir swatershed=tf_sink accumulation=tf_fac tci=tf_tci
STREAM_DIR=C:/Active_projects/tmp/tf
cell dem header compatible with region header
stats.out: File exists
Elevation stored as FLOAT (4B)
Region size is 13000 x 9200

This is 119.6 million cells, too large for wingrass, r.terraflow will
most likely abort because the temporary files become too large (no
large file support in wingrass). Try r.watershed instead.

STREAM temporary files in C:/Active_projects/tmp/tf (THESE
INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF ABNORMAL
TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE DELETE
THESE FILES MANUALLY!)
file stats.out exists - renaming.

Either manually delete the file stats.out first before running
r.terraflow or, as suggested in the other reply, update grass.

Markus M

Aleksey Naumovwrote:

Thank you for your help. At least I figured out why r.terraflow would not
run at all - I had both stats.out and stats.out.old sitting on my hard disk
from some time before. As I understand now, r.terraflow creates a backup of
the runtime statistics file (by default, stats.out.old), and if this backup
file already exists, it simply refuses to remove it and bails out.

It should say why it bails out, maybe file a ticket in trac?

I thought that r.terraflow scales better to larger DEMs than r.watershed,
but I'll try r.watershed next.

It's more or less on par now when using the disk swap mode of
r.watershed. In theory, r.terraflow should scale better with very
little memory and very large files, e.g. billions of cells and less
than 512 MB memory (untested, speculating, similar speed with 2GB and
500 million cells). The temporary files of r.watershed are much
smaller than those of r.terraflow, this can make a crucial difference
without large file support.

As far as updating grass, this version (GRASS 6.4.0svn-7) is the latest
available via OSGeo4W.

The error mentioned below has been fixed recently (2 weeks ago), maybe
the OSGeo4W version is older.

What other options do I have on WinXP (a Cygwin-based

install?)?

Get a nightly built installer from here

http://josef.fsv.cvut.cz/wingrass/grass64/

or compile yourself the latest svn snapshot from source.

Assertion failed: nrows * ncols == str->stream_len(), file
grass2str.h, line 144

That one was fixed two weeks ago.

Markus M

Markus Metz wrote:

Aleksey Naumov wrote:
> Dear GRASS users,
>
> I am trying to run r.terraflow in GRASS 6.4.0svn (GIS library revision:
> 37101 (2009-05-10)) provided as part of the OSGeo4W bundle on WinXP. The
> command prints some output, which looks normal, and then exits right
> away
> without doing anything.
>
> Here is the command and the output I get:
>
> (Thu Jul 29 13:32:43
> 2010)
> r.terraflow --overwrite --verbose elevation=dem@PERMANENT filled=tf_dem
> direction=tf_fdir swatershed=tf_sink accumulation=tf_fac tci=tf_tci
> STREAM_DIR=C:/Active_projects/tmp/tf
> cell dem header compatible with region header
> stats.out: File exists
> Elevation stored as FLOAT (4B)
> Region size is 13000 x 9200

This is 119.6 million cells, too large for wingrass, r.terraflow will
most likely abort because the temporary files become too large (no
large file support in wingrass). Try r.watershed instead.

> STREAM temporary files in C:/Active_projects/tmp/tf (THESE
> INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF ABNORMAL
> TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE DELETE
> THESE FILES MANUALLY!)
> file stats.out exists - renaming.

Either manually delete the file stats.out first before running
r.terraflow or, as suggested in the other reply, update grass.

Markus M

Markus Metz wrote:

I thought that r.terraflow scales better to larger DEMs than r.watershed,
but I'll try r.watershed next.

It's more or less on par now when using the disk swap mode of
r.watershed.

Oops, only in grass7. In grass64, r.watershed in disk swap mode is
still a bit slower than r.terraflow.

Markus M

Markus Metz wrote:

Aleksey Naumov wrote:
> Dear GRASS users,
>
> I am trying to run r.terraflow in GRASS 6.4.0svn (GIS library revision:
> 37101 (2009-05-10)) provided as part of the OSGeo4W bundle on WinXP. The
> command prints some output, which looks normal, and then exits right
> away
> without doing anything.
>
> Here is the command and the output I get:
>
> (Thu Jul 29 13:32:43
> 2010)
> r.terraflow --overwrite --verbose elevation=dem@PERMANENT filled=tf_dem
> direction=tf_fdir swatershed=tf_sink accumulation=tf_fac tci=tf_tci
> STREAM_DIR=C:/Active_projects/tmp/tf
> cell dem header compatible with region header
> stats.out: File exists
> Elevation stored as FLOAT (4B)
> Region size is 13000 x 9200

This is 119.6 million cells, too large for wingrass, r.terraflow will
most likely abort because the temporary files become too large (no
large file support in wingrass). Try r.watershed instead.

> STREAM temporary files in C:/Active_projects/tmp/tf (THESE
> INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF ABNORMAL
> TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE DELETE
> THESE FILES MANUALLY!)
> file stats.out exists - renaming.

Either manually delete the file stats.out first before running
r.terraflow or, as suggested in the other reply, update grass.

Markus M



> As far as updating grass, this version (GRASS 6.4.0svn-7) is the latest available via OSGeo4W. What other options do I have on WinXP (a Cygwin-based install?)?



http://grass.osgeo.org/grass64/binary/mswindows/

* SVN nightly builds by Martin Landa, CTU in Prague