<html><head></head><body><div class="ydpe65fbfefyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div></div>
<div dir="ltr" data-setdir="false">Hi Makus,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Nice suggestion, I did not know about this function within r.mapcalc (it is quite hidden!)</div><div dir="ltr" data-setdir="false">I still do not know how to operationalize it, though.</div><div dir="ltr" data-setdir="false">For now, the solution with R worked, but it could be useful to have something like that in GRASS in the future.</div><div dir="ltr" data-setdir="false">Should I open an issue with a suggestion?</div><div dir="ltr" data-setdir="false">(I do not have time to do it right now)</div><div><br></div><div dir="ltr" data-setdir="false">Best</div><div dir="ltr" data-setdir="false">Bernardo</div>
</div><div id="yahoo_quoted_4134467451" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
Em quarta-feira, 11 de janeiro de 2023 09:39:17 GMT+1, Markus Neteler <neteler@osgeo.org> escreveu:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">Hi Bernardo,<br></div><div dir="ltr"><br></div><div dir="ltr">Not sure if this helps but there is also this function in r.mapcalc:<br></div><div dir="ltr"><br></div><div dir="ltr"><a href="https://grass.osgeo.org/grass78/manuals/r.mapcalc.html" target="_blank">https://grass.osgeo.org/grass78/manuals/r.mapcalc.html</a><br></div><div dir="ltr"><br></div><div dir="ltr">graph(x,x1,y1[x2,y2..]) convert the x to a y based on points<br></div><div dir="ltr">in a graph F<br></div><div dir="ltr">graph2(x,x1[,x2,..],y1[,y2..]) alternative form of graph()<br></div><div dir="ltr"><br></div><div dir="ltr">The graph() function allows users to specify a x-y conversion using<br></div><div dir="ltr">pairs of x,y coordinates. In some situations a transformation from one<br></div><div dir="ltr">value to another is not easily established mathematically, but can be<br></div><div dir="ltr">represented by a 2-D graph and then linearly interpolated. The graph()<br></div><div dir="ltr">function provides the opportunity to accomplish this. An x-axis value<br></div><div dir="ltr">is provided to the graph function along with the associated graph<br></div><div dir="ltr">represented by a series of x,y pairs. The x values must be<br></div><div dir="ltr">monotonically increasing (each larger than or equal to the previous).<br></div><div dir="ltr">The graph function linearly interpolates between pairs. Any x value<br></div><div dir="ltr">lower the lowest x value (i.e. first) will have the associated y value<br></div><div dir="ltr">returned. Any x value higher than the last will similarly have the<br></div><div dir="ltr">associated y value returned.<br></div><div dir="ltr">[...]<br></div><div dir="ltr"><br></div><div dir="ltr">Perhaps a dynamic (set of) graphs could be constructed?<br></div><div dir="ltr"><br></div><div dir="ltr">Best,<br></div><div dir="ltr">Markus<br></div><div dir="ltr"><br></div><div dir="ltr">On Wed, Dec 14, 2022 at 2:37 PM Bernardo Santos via grass-user<br></div><div dir="ltr"><<a ymailto="mailto:grass-user@lists.osgeo.org" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>> wrote:<br></div><div dir="ltr">><br></div><div dir="ltr">> Hi,<br></div><div dir="ltr">><br></div><div dir="ltr">> I am trying to produce scenarios of past land cover, before hydropower reservoirs were built. To do so, I need to fill empty pixels from a raster in the locations where the reservoirs are currently present, using as input the actual land cover map. I tried doing that with r.neighbors (taking method=mode) with neighborhoods of increasing size, to replace null pixels with the most common land cover class in the neighborhood. I also tried that with r.fill.stats which is basically the same thing.<br></div><div dir="ltr">> However, the results gets very homogeneous, since the interpolated null cells always get the value of the most common land cover class.<br></div><div dir="ltr">><br></div><div dir="ltr">> Do anyway know of a method in GRASS to perform a "probabilistic" neirighborhood analysis, where cells in a neighborhood are given weights (possibly related to the distance to the central cell and to their frequency) and these weights are used to stocastically sample a value to fill the central cell?<br></div><div dir="ltr">> If not in GRASS, does anyway know of such a method in a different platform, i.e. R?<br></div><div dir="ltr">><br></div><div dir="ltr">> Thanks!<br></div><div dir="ltr">> Best<br></div><div dir="ltr">> Bernardo<br></div><div dir="ltr">> _______________________________________________<br></div><div dir="ltr">> grass-user mailing list<br></div><div dir="ltr">> <a ymailto="mailto:grass-user@lists.osgeo.org" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br></div><div dir="ltr">> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">-- <br></div><div dir="ltr">Markus Neteler, PhD<br></div><div dir="ltr"><a href="https://www.mundialis.de " target="_blank">https://www.mundialis.de </a>- free data with free software<br></div><div dir="ltr"><a href="https://grass.osgeo.org" target="_blank">https://grass.osgeo.org</a><br></div><div dir="ltr"><a href="https://courses.neteler.org/blog" target="_blank">https://courses.neteler.org/blog</a><br></div></div>
</div>
</div></body></html>