[GRASSLIST:2545] Re: terraflow dimension_type overflow

Glynn Clements glynn.clements at virgin.net
Tue Feb 10 14:51:14 EST 2004


Christopher Fonnesbeck wrote:

> I am trying to run terraflow on a 30000x30000 DEM, but am running into 
> a dimension_type overflow error. I do not see this error documented; 
> does anyone know how I can work around it to get my analysis done? 
> Surely it is not a size problem, as terraflow is designed for massive 
> grids.

"dimension_type" is an alias for "short", so it's likely to be limited
to ±32767. The definition is at the top of types.h.

The error to which you are referring appears to come from the
following in main.cc:

  int nr = G_window_rows();
  int nc = G_window_cols();
  if ((nr > dimension_type_max) || (nc > dimension_type_max)) {
    G_fatal_error("[nrows=%d, ncols=%d] dimension_type overflow -- change dimension_type and recompile\n", nr, nc);
  } else {
    nrows = (dimension_type)nr;
    ncols = (dimension_type)nc;
  }

That suggests that your region is larger than 30000x30000 (note that
it's the current region settings which are relevant, not the actual
resolution of the DEM). Either that, or your "short" type is unusually
small.

If you need to handle larger grids, change the definition to:

	typedef int dimension_type; /* represent dimension of the grid */
	static const dimension_type dimension_type_max=INT_MAX;

and re-compile.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list