[prev in list] [next in list] [prev in thread] [next in thread] 

List:       grass-user
Subject:    Re: [GRASS-user] Indentify cell with maximum value per category of a cover map
From:       Moritz Lennert <mlennert () club ! worldonline ! be>
Date:       2017-05-17 11:07:36
Message-ID: cd824c9d-22c4-4e5f-f1c9-8cadaddd2c26 () club ! worldonline ! be
[Download RAW message or body]

On 17/05/17 12:07, Johannes Radinger wrote:
> Hi,
>
> I'd like to identify the cell of maximum flow accumulation for each
> subbasin.
>
> For example, I have a cover raster map representing all my subbasins
> (each subbasin has its own cat value). Additionally, I have a flow
> accumulation map. Now, I'd like to get a map with cells that are
> actually those with the largest flow accumulation per subbasin (all
> other cell should be NULL). I guess, using r.stats.zonal/r.statistics I
> can identify the maximum flow accumulation value for each subbasin, but
> this doesn't provide me a map with the corresponding cells!? Is there a
> straight forward way to do that in GRASS with e.g. the mapcalc? Or do I
> need to loop over each subbasin?

Somthing like this might work:

r.stats.zonal cover=bassins base=accumulation output=maxval
r.mapcalc maxpixels = "if(accumulation < maxval+epsilon && accumulation 
 > maxval - epsilon, 1, null())

The use of an epsilon value is to avoid difficulties of determining 
floating point number equalities.

Moritz
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic