[GRASS-dev] r.statistics limitation to CELL

Glynn Clements glynn at gclements.plus.com
Sat Jun 2 22:58:40 EDT 2007


Markus Neteler wrote:

> > > would it be much work to fix this:
> > > 
> > > GRASS 6.3.cvs (nc_spm_05):~ > r.statistics base=landuse96_28m \
> > >                cover=elevation out=elevstats_avg method=average
> > > ERROR: This module currently only works for integer (CELL) maps
> > > 
> > > Rounding elevation to CELL first isn't a great option.
> > 
> > 1. r.statistics works by reclassing the base map, so the base map
> > can't be FP.
> 
> In this case I meant the cover map "elevation" which is rejected.
> landuse96_28m is a CELL map, elevation FCELL.
> 
> > 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.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list