[GRASSLIST:254] Re: r.statistics/r.mapcalc returns nan values

Martin Rutzinger Martin.Rutzinger at uibk.ac.at
Mon Mar 20 08:50:55 EST 2006


hi list!

i think i found the bug causing nan values. to repeat the problem: i generate a
raster layer with r.statistics e.g. stddev with a base map (objects) and a
cover map. if the base map contains objects which have the size of a single
pixel the stddev is of course 'nan' (because it's calculated by neighbours).
r.statistics normally returns a raster layer containing the stddev as lable for
each category. if the output layer of r.stats contains such an object (single
pixel with 'nan' value) it fails for all (!) objects to switch the label values
to cat values using: r.mapcalc raster2=@raster1

because i don't need the information for single pixel objects i can remove them
with by filtering before calculating the stddev.

anyway, this happens may be to more people using r.statistics?!

greetings
martin



>i tried r.nulls and r.mapcalc "erg=if(isnull(rast1),0,rast1)" which should be
>the same. but that did not help.

>i'll keep searching
>m

Zitat von Hamish <hamish_nospam at yahoo.com>:

> > i tried to reclass the null values in the cover map to 0 - but this
> > did not help.
>
> no help with the bug, but did you try r.null?
>
>
> Hamish
>


Zitat von Martin Rutzinger <Martin.Rutzinger at uibk.ac.at>:

> hi list!
>
> i use r.statistics to calculate the stddev for areas in my base layer (input
> is
> cover layer). r.statistics returns an output raster containing ids as cat
> value
> and the stddev for each area as lables.
>
> r.statistics base=areas_rast cover=input_rast method=stddev
> output=stddev_area
>
> if i try to convert the lables to cat all "areas" are empty (="nan" values).
>
> r.mapcalc "final_rast=@stddev_area"
>
> my cover map contains some regions with null values but they are not covered
> by
> an area of the base layer. if i zoom in so that there are no null values
> within
> my region. it works fine.
>
> i tried to reclass the null values in the cover map to 0 - but this did not
> help.
>
> had anybody similar problems with r.statistics/r.mapcalc - any suggestions?
> thanks for discussing and helping
> martin
>
>
>




More information about the grass-user mailing list