<div dir="ltr"><br><br>On Mon, Feb 11, 2019 at 9:17 PM Stefan Blumentrath <<a href="mailto:Stefan.Blumentrath@nina.no">Stefan.Blumentrath@nina.no</a>> wrote:<br>><br>> Hi Markus,<br>><br>><br>> Not sure I fully understand the objective, but did you consider:<br>><br>> r.stats -c input=A_map,B_map<br>> <a href="https://grass.osgeo.org/grass76/manuals/r.stats.html">https://grass.osgeo.org/grass76/manuals/r.stats.html</a><br>> (for overall counts)<br><div><br></div><div>I agree, this seems to be the easiest way. The region and resolution should first be set to match the high-res raster.</div><div><br></div><div>Markus M</div><div><br></div><div>></div>> or<br>> <a href="https://grass.osgeo.org/grass76/manuals/r.resamp.stats.html">https://grass.osgeo.org/grass76/manuals/r.resamp.stats.html</a><br>> (for counts/diversity within each pixel).<br>><br>> Cheers<br>> Stefan<br>> ________________________________<br>> Fra: grass-dev <<a href="mailto:grass-dev-bounces@lists.osgeo.org">grass-dev-bounces@lists.osgeo.org</a>> på vegne av Markus Neteler <<a href="mailto:neteler@osgeo.org">neteler@osgeo.org</a>><br>> Sendt: mandag 11. februar 2019 20.54<br>> Til: Nikos Alexandris<br>> Kopi: GRASS-GIS development mailing list<br>> Emne: Re: [GRASS-dev] No 'count' method for r.statistics<br>>  <br>> Hi,<br>><br>> On Fri, Aug 3, 2018 at 10:13 AM Nikos Alexandris<br>> <<a href="mailto:nik@nikosalexandris.net">nik@nikosalexandris.net</a>> wrote:<br>> > * Markus Metz <<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>> [2018-08-01 20:33:33 +0200]:<br>> > >On Wed, Aug 1, 2018 at 11:59 AM, Nikos Alexandris <<a href="mailto:nik@nikosalexandris.net">nik@nikosalexandris.net</a>><br>> > >wrote:<br>> > >><br>> > >> `r.statistics` which was/is meant for categorical raster maps, does not<br>> > >> provide for a 'count' method.<br>> > >><br>> > >> `r.stats.zonal`, on the other hand, which is meant for floating point<br>> > >> raster maps, does so.<br>> > >><br>> > >> This is rather unexpected. 'Count'ing pixels should rather derive 'CELL'<br>> > >> maps and not 'FCELL'.<br>> > >><br>> > >> At the moment, I require an extra mapcalc using the int() function.<br>> > >><br>> > >> Any comments?<br>> > ><br>> > >Counting pixels can produce a result that is too large for CELL (32 bit<br>> > >integer), therefore storing the count as DCELL is a bit safer because it<br>> > >can exactly store integers larger than the 32 bit maximum.<br>> > ><br>> > >In short, use r.stats.zonal rather than r.statistics.<br>> > ><br>> > >Markus M<br>> ><br>> > I understand it now.<br>> ><br>> > If integrating this extra "int()" conversion, in `r.stats.zonal`, is not<br>> > a smart/wanted thing to do, maybe we should add an explanation in the<br>> > `r.statistics` manual. Why 'count' is missing and why `r.stats.zonal` should<br>> > be used.<br>> ><br>> > I can offer a patch for the manual if you agree.<br>><br>> No need to ask, it would be great :-)<br>><br>> > My guess is that the development team has future plans regarding all r.stat*<br>> > modules, to merge and simplify as much as possible.<br>><br>> Suggestions may be discussed here.<br>><br>> A related question from a (remote) colleague:<br>><br>> They have two Land Cover raster files at different resolutions, one at<br>> 5 m x 5 m and the other at 30m x 30 m with both 9 identical<br>> categories.<br>> They want to count the number of pixels of a category of the first map<br>> that fall within each pixel of the second.<br>> How to do that in an elegant way?<br>><br>> thanks<br>> Markus<br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a></div>