[GRASS-user] r.terraflow crashes

Ken Mankoff mankoff at gmail.com
Sun Jan 3 11:23:14 PST 2016


Hi List,

I'm a grass newbie. I'm trying to route some water through a DEM and think r.terraflow is the right tool. It is crashing. Can someone point out what I'm doing wrong? I have not found much when searching for this problem on google or list archives. I think there are several issues occurring here. I'm having the same problems on grass64 (installs easily on OS X) and grass71 (on a linux machine).


I'm working in the following region:

> g.region -p
> projection: 99 (Stereographic)
> zone:       0
> datum:      wgs84
> ellipsoid:  wgs84
> north:      -657600
> south:      -3349500
> west:       -638000
> east:       864700
> nsres:      150
> ewres:      150
> rows:       17946
> cols:       10018
> cells:      179783028
> 

1) r.mapcalc produces file of 0 size

When I run

> r.mapcalc 'phi = (1000*9.8*bed + 917*9.8*(surf-bed))'

The file has 0 size. I now do the same calculation using nctools and then load the netcdf file, but I'd rather do this in grass if I could. FYI, bed is 589 MB and surf is 190 MB. When I calculate phi with nctools (ncap2 -O -v -s "phi=1E3*9.8*bed+917*9.8*thickness" in.nc phi.nc) the resulting file is 1.4 GB. Clearly the 0 size grass-produced phi is due to overflow int/float/double issues? But a) there is no warning/error and b) wrapping the variables above in float()'s doesn't seem to help. The file still has 0 size if I do a similar but simpler computation:

> r.mapcalc 'phi = (bed + 0.917(surf-bed))'


2) r.terraflow crashes with 'Bad address' error.

> r.terraflow --o --v elevation=phi fill=f direction=d sw=s acc=a tci=tci

The results of that command:

> cell phi header compatible with region header
> Elevation stored as FLOAT (4B)
> WARNING: raster phi is of type CELL_TYPE --you should use r.terraflow.short
> Region size is 17946 x 10018
> STREAM temporary files in /home/user/data/grass/GR/PERMANENT/.tmp/host/26900.0  (THESE INTERMEDIATE STREAMS WILL NOT BE DELETED IN CASE OF ABNORMAL TERMINATION OF THE PROGRAM. TO SAVE SPACE PLEASE DELETE THESE FILES MANUALLY!)
> Memory manager registering memory in MM_WARN_ON_MEMORY_EXCEEDED mode.
> Reading data from <phi> to stream
> </home/user/data/grass/GR/PERMANENT/.tmp/host/26900.0/STREAM_baaaaX>
>  100%
> total elements=179783028, nodata elements=18914292
> largest temporary files:
> FILL: 9.38G (10067849568) [179783028 elements, 56B each]
> FLOW: 11.99G (12869498880) [160868736 elements, 80B each]
> Will need at least 23.97G (25738997760) space available in
> /home/user/data/grass/GR/PERMANENT/.tmp/host/26900.0
> MM warning: limit=314572800B. allocating 156610272B.  limit exceeded by 3706B.
> EMPQUEUEADAPTIVE: starting in-memory pqueue
> EMPQUEUEADAPTIVE: available memory: 297.937MB
> EMPQUEUEADAPTIVE: desired memory: 297.937MB
> sz_stream: 270400 buf_arity: 200 mm_overhead: 8666496 mm_avail: 312409214.
> EMPQUEUEADAPTIVE: memory overhead set to 8.26501MB
> EMPQUEUEADAPTIVE: pqsize set to 37967839
> EMPQUEUEADAPTIVE: starting in-memory pqueue
> EMPQUEUEADAPTIVE: available memory: 297.163MB
> EMPQUEUEADAPTIVE: desired memory: 297.163MB
> sz_stream: 270400 buf_arity: 200 mm_overhead: 8666496 mm_avail: 311597910.
> EMPQUEUEADAPTIVE: memory overhead set to 8.26501MB
> EMPQUEUEADAPTIVE: pqsize set to 37866426
> EMPQUEUEADAPTIVE: starting in-memory pqueue
> EMPQUEUEADAPTIVE: available memory: 296.389MB
> EMPQUEUEADAPTIVE: desired memory: 296.389MB
> sz_stream: 270400 buf_arity: 200 mm_overhead: 8666496 mm_avail: 310786606.
> EMPQUEUEADAPTIVE: memory overhead set to 8.26501MB
> EMPQUEUEADAPTIVE: pqsize set to 37765013
> MM warning: limit=314572800B. allocating 155798940B.  limit exceeded by 3706B.
> rusage/gettimeofday: Bad address
 


Thanks for any help,

  -k.


More information about the grass-user mailing list