[GRASS-user] Multiple labels and r.series

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Tue Nov 11 23:40:09 EST 2008


On Tue, 2008-11-11 at 19:34 -0800, John C. Tull wrote:
> On Nov 11, 2008, at 6:45 PM, Hamish wrote:
> 
> > John wrote:
> >> I am creating a raster map that essentially summarizes the
> >> intersection of a series of labeled rasters that each have
> >> values of either 1 or null (presence/absence data). I am
> >> using r.series like this to perform the summation across the
> >> rasters that are all named with a prefix of presence_:
> >>
> >> r.series input="`g.mlist rast
> >> pattern='presence_*' sep=,`"
> >> output=presence_sum method=sum --o
> >>
> >> Can anyone think of a way to achieve this summation of
> >> intersections in a way that will also allow for each cell to
> >> have a label that concatenates all labels for the respective
> >> raster maps that are present at that cell? E.g., let's
> >> say three of the rasters are present at a particular cell,
> >> and the labels for those rasters are 'raster1',
> >> 'raster4', and 'raster7'. I would like the
> >> final map to have a label of 'raster1, raster4,
> >> raster7'.
> >>
> >> Any and all suggestions are greatly appreciated.
> >
> >
> > the trick here is to r.reclass 0/1 absence/presence maps to be 0/2^n
> > before running the sum.  So you then get a sum like 13, which would  
> > mean
> > the 8+2+1 maps were all present, or if the sum was 5 you'd know the  
> > 1+4
> > maps were present for that cell, and not others.
> >
> >
> > see also r.bitpattern and r.mapcalc bitwise operators.  (sorry I don't
> > know the proper name/wikipedia link for this technique, I'm not a  
> > computer
> > scientist)
> >
> >
> > Hamish

That was my general idea... (well, more or less). But I did not think of
r.bitmap as a possibility. Maybe there is away to do reverse-r.bitmap
and "code"(=assign to) pixels with various values which will correspond
to different categories-combinations(of maps).

This is how the MODIS Quality Layers work more or less, right?

Regards, Nikos




More information about the grass-user mailing list