<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Markus,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Not sure I fully understand the objective, but did you consider:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
r.stats -c input=A_map,B_map</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://grass.osgeo.org/grass76/manuals/r.stats.html" id="LPlnk584393">https://grass.osgeo.org/grass76/manuals/r.stats.html</a></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
(for overall counts)<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
or <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://grass.osgeo.org/grass76/manuals/r.resamp.stats.html" id="LPlnk418508">https://grass.osgeo.org/grass76/manuals/r.resamp.stats.html</a></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
(for counts/diversity within each pixel).</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Stefan<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Fra:</b> grass-dev <grass-dev-bounces@lists.osgeo.org> på vegne av Markus Neteler <neteler@osgeo.org><br>
<b>Sendt:</b> mandag 11. februar 2019 20.54<br>
<b>Til:</b> Nikos Alexandris<br>
<b>Kopi:</b> GRASS-GIS development mailing list<br>
<b>Emne:</b> Re: [GRASS-dev] No 'count' method for r.statistics</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi,<br>
<br>
On Fri, Aug 3, 2018 at 10:13 AM Nikos Alexandris<br>
<nik@nikosalexandris.net> wrote:<br>
> * Markus Metz <markus.metz.giswork@gmail.com> [2018-08-01 20:33:33 +0200]:<br>
> >On Wed, Aug 1, 2018 at 11:59 AM, Nikos Alexandris <nik@nikosalexandris.net><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>
grass-dev@lists.osgeo.org<br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a></div>
</span></font></div>
</body>
</html>