<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 again,</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);">
Vero had a feature request in a similar direction for v.rast.stats (count / mode statistics) for categorical raster maps (e.g. land cover).</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);">
Should such a feature be added to v.rast.stats or would it make more sense to create a new module for that for not overloading v.rast stats.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I would have some code snippet in v.rast.bufferstats (<a href="https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.rast.bufferstats/v.rast.bufferstats.py#L506" id="LPlnk636157">https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.rast.bufferstats/v.rast.bufferstats.py#L506</a>)
 that I could re-purpose...</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);">
What do you think?</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> Markus Metz <markus.metz.giswork@gmail.com><br>
<b>Sendt:</b> mandag 11. februar 2019 21.19<br>
<b>Til:</b> Stefan Blumentrath<br>
<b>Kopi:</b> Markus Neteler; Nikos Alexandris; GRASS-GIS development mailing list<br>
<b>Emne:</b> Re: [GRASS-dev] No 'count' method for r.statistics</font>
<div> </div>
</div>
<div>
<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>
</div>
</body>
</html>