[GRASS-dev] r.statistics limitation to CELL

Markus Neteler neteler at itc.it
Sun Jun 3 07:03:02 EDT 2007


On Sun, Jun 03, 2007 at 03:58:40AM +0100, Glynn Clements wrote:
> Markus Neteler wrote:
> > Glynn Clements wrote:
> > > 2. r.statistics uses r.stats to calculate the statistics, and r.stats
> > > reads its inputs as CELL.
> > 
> > In this case, r.statistics could also accept an FCELL map
> > without complaining? Currently I need extra steps to round
> > elevation to a CELL map before running r.statistics.
> 
> You should be able to simply remove the check at
> raster/r.statistics/main.c:83:
> 
>     if( G_raster_map_is_fp(covermap->answer, mapset) != 0 )
>         G_fatal_error (_("This module currently only works for integer (CELL) maps"));
> 
> Or you might want to replace the error with a warning that the result
> is inaccurate.

If so, the latter. Currently I have to round() the elevation map
before running r.statistics - so results are inaccurate anyway
but the procedure requires more extra work.

The master question is: is it possible to conditionalize calls in
r3.stats to make it working for 2D maps. The new implementation from
Soeren sounds promising and along the lines of your suggestion to
rewrite r.stats from scratch.

Markus




More information about the grass-dev mailing list