Hi Johannes,
thanks a lot for the info. I am doing effectively the same now by using
R and rbinom but I am switching to rmultinom..
Cheers,
Rainer
Johannes Radinger <johannesradinger@gmail.com> writes:
Hi Rainer,
I don't know of any standard GRASS tool that performs such tasks.
However I had a similar task, also an ecological topic and it was about
the redistribution of fish according to a dispersal kernel. So in my case
a number of fish (n_individuals) should be randomly distributed over a
raster map, but in my case with varying probabilities (used as weighting
factor) in the landscape.
I solved that with the python/array interface of GRASS, in detail with a
random multinomial approach of numpy:
# Import Python modules
import grass.script.array as garray
import numpy
# Probability map, varying probability over the landscape, used as
weighting factor
probmap = garray.array()
probmap.read("probmap")
# Output, redistributed individuals (n=500)
outputmap = garray.array()
n_individuals=500
outputmap[...] = numpy.random.multinomial(n_individuals,
(probmap/numpy.sum(probmap)).flat, size=1).reshape(probmap.shape)
outputmap.write("outputmap")
This approach is also implemented in the newest version of the GRASS-GIS
addon r.fidimo (GRASS70), which
is a fish dispersal model for river networks.
So maybe that approach helps you!
Best,
Johannes
On Fri, Sep 6, 2013 at 1:17 PM, Rainer M Krug <Rainer@krugs.de> wrote:
Hi
I am writing a simulation of dispersal, and one possible dispersal
approach is to distribute a certain number of seeds N randomly in the
landscape.
Therefore I would like to generate a random raster map with the sum of
all cells equals to N. Is there a way of doing this easily in GRASS?
At the moment, I am using an R function, which distributes the seeds,
but due to computational time considerations, I would like to move it to
GRASS.
Thanks,
Rainer
--
Rainer M. Krug
email: RMKrug<at>gmail<dot>com
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
<#secure method=pgpmime mode=sign>
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug