[GRASS5] r.average and FP maps

Markus Neteler neteler at itc.it
Mon Aug 16 16:20:39 EDT 2004


On Sat, Aug 14, 2004 at 11:04:05PM +0100, Glynn Clements wrote:
> 
> Markus Neteler wrote:
> 
> > > > > > I have tried to average elevations for selected zones
> > > > > > with r.average but wasn't quite successful.
> > [...]
> > > > 
> > > > That's fine. Time is not an issue if it worked... at time it is
> > > > sort of broken.
> > > 
> > > In what sense? r.average seems to work OK for FP maps, apart from the
> > > warning and the fact that the results will contain inaccuracies due to
> > > averaging the quantised values rather than the actual values.
> > 
> > For me it doesn't work (Spearfish 5.7):
> > 
> > g.region rast=elevation.10m -p
> > r.info -t elevation.10m
> > datatype=DCELL
> > 
> > r.average -c base=fields cover=elevation.10m out=fields_elev_mean
> > WARNING: r.stats: cats for elevation.10m sre either missing or have no
> >          explicit labels. Using nsteps=255
> > r.stats:  100%
> > percent complete:  100%
> > 
> > GRASS 5.7.cvs:~ > r.info -r fields_elev_mean
> > min=-2147483648
> > max=-2147483648
> 
> When was the 5.3 code updated? The initial {get,put}_row.c update had
> a couple of bugs which could result in all-null maps. If the 5.3 code
> was updated on Thursday or Friday, try again with the latest version.

In fact, now it seems to work (after a cvs up -dP):

GRASS 5.7.cvs:~ > r.average  base=fields cover=elevation.10m out=fields_elev_mean
WARNING: r.stats: cats for elevation.10m sre either missing or have no
         explicit labels. Using nsteps=255
r.stats:  100%
percent complete:  100%
GRASS 5.7.cvs:~ > r.info -r fields_elev_mean
min=1080.307251
max=1495.240845
 

> Here, the following works with the latest 5.3 and also with a slightly
> older 5.7, with the original spearfish dataset:
> 
> 	r.mapcalc 'elev.float = double(elevation.dem)'
> 	r.average base=fields cover=elev.float output=foo

It also does with current 5.7-CVS:
r.info -r foo
min=1086.906372
max=1502.789185

Very good.
Thanks,

 Markus




More information about the grass-dev mailing list