Hi Makus,
Nice suggestion, I did not know about this function within r.mapcalc (it is quite hidden!)
I still do not know how to operationalize it, though.
For now, the solution with R worked, but it could be useful to have something like that in GRASS in the future.
Should I open an issue with a suggestion?
(I do not have time to do it right now)
Best
Bernardo
Em quarta-feira, 11 de janeiro de 2023 09:39:17 GMT+1, Markus Neteler neteler@osgeo.org escreveu:
Hi Bernardo,
Not sure if this helps but there is also this function in r.mapcalc:
https://grass.osgeo.org/grass78/manuals/r.mapcalc.html
graph(x,x1,y1[x2,y2…]) convert the x to a y based on points
in a graph F
graph2(x,x1[,x2,…],y1[,y2…]) alternative form of graph()
The graph() function allows users to specify a x-y conversion using
pairs of x,y coordinates. In some situations a transformation from one
value to another is not easily established mathematically, but can be
represented by a 2-D graph and then linearly interpolated. The graph()
function provides the opportunity to accomplish this. An x-axis value
is provided to the graph function along with the associated graph
represented by a series of x,y pairs. The x values must be
monotonically increasing (each larger than or equal to the previous).
The graph function linearly interpolates between pairs. Any x value
lower the lowest x value (i.e. first) will have the associated y value
returned. Any x value higher than the last will similarly have the
associated y value returned.
[…]
Perhaps a dynamic (set of) graphs could be constructed?
Best,
Markus
On Wed, Dec 14, 2022 at 2:37 PM Bernardo Santos via grass-user
<grass-user@lists.osgeo.org> wrote:
Hi,
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.
However, the results gets very homogeneous, since the interpolated null cells always get the value of the most common land cover class.
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?
If not in GRASS, does anyway know of such a method in a different platform, i.e. R?
Thanks!
Best
Bernardo
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
–
Markus Neteler, PhD
https://www.mundialis.de - free data with free software
https://grass.osgeo.org
https://courses.neteler.org/blog