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.
Thanks for the help,
Chris
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
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@virgin.net>
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.
Thanks,
My region size is 34429x30856, so that is the problem. I could have *sworn* I ran terraflow on this dem before. Anyhow, increasing the limit causes a file size limit error. If I carve this DEM into quarters, for example, will that solve the problem? What will that mean for accumulations at the boundaries?
Thanks,
Chris
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
Christopher Fonnesbeck wrote:
> 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.
My region size is 34429x30856, so that is the problem. I could have
*sworn* I ran terraflow on this dem before. Anyhow, increasing the
limit causes a file size limit error.
Right; at that size, you could just about get away with two bytes per
cell, but not four bytes per cell. Have you tried r.terraflow.short
(which uses 16-bit shorts instead of 32-bit floats)?
If I carve this DEM into quarters, for example, will that solve the
problem?
With a quarter-size map, you could have 8 bytes per cell, which should
be enough.
What will that mean for accumulations at the boundaries?
I have no idea. I'm just a programmer; I don't understand what most of
GRASS actually does, just how it does it 
--
Glynn Clements <glynn.clements@virgin.net>