Re: summing rasters

4 views
Skip to first unread message

Joel Pitt

unread,
Apr 19, 2010, 10:55:35 PM4/19/10
to mdig...@googlegroups.com
On Tue, Apr 20, 2010 at 2:44 PM, Steve Wangen <i.bl...@gmail.com> wrote:
> Genius!
> Alright - one last question and I'll never bug you again (yeah right).
> I'm having some trouble specifying the r.mdig.kernel - my impression is to
> implement an exponential kernel, the only arguments that need to be given
> are "d_b" and "kernel=exponential", however that doesn't seem to be working
> quite right.
> Looking at the kernel_math.c file, it looks like it can also have a value
> for 'p', which I assume to be the 'frequency' argument - is that correct?

The p is the sampled random variate from 0 to 1. The inverse cdfs are
used to convert this into a random variate fitting the distribution.

> The default for the limit is 0.0 - does that mean by default it throws away
> all events?

When limit == 0.0 there should be no limit.

> So, with these thoughts I tried specifying it as:
>       <event name="r.mdig.kernel">
>         <param name="kernel">
>           <value>exponential</value>
>         </param>
>         <param name="d_b">
>           <value>0.1</value>
>         </param>
>         <param name="frequency">
>           <value>1</value>
>         </param>
>         <param name="limit">
>           <value>50</value>
>         </param>
>       </event>
> I thought this would provide a kernel of the form p=0.1*e^(-0.1x) and
> subject all individuals to dispersal, with a max dist of 50 cells (which
> would be a very low probability).  But, when I include it like this, nothing
> happens.  Am I interpreting the parameters incorrectly, or does that sound
> like it should work?

You're frequency parameter means that the mean/lambda of the Poisson
distribution used to generate events is 1. This means you'll probably
get a lot of evaluations for the number of events being equal to 0.

Check out the graphs here:

http://en.wikipedia.org/wiki/Poisson_distribution

Frequency is independent of density at the moment, I could probably
add some simple density dependence if you liked, but you'd have to
properly define it for me first.

I guess the simplest method would just be to subject every individual
within in a cell to kernel dispersal.

...

Since I was using it primarily for human mediated dispersal I made an
assumption that the density dependent effects would be minimal (and
that I didn't actually have enough data to calibrate such an effect).

J


--
Subscription settings: http://groups.google.com/group/mdig-user/subscribe?hl=en

Steve Wangen

unread,
Apr 20, 2010, 12:02:55 AM4/20/10
to mdig...@googlegroups.com
That should make a little more sense.

By the way, I'm not sure I mentioned this, but there is a bit in GRASSInterface.py on line 772 and 784 where the r.out.ascii commands have the '-i' tag, which means that they are exporting only integers - you may want to remove that so it can handle continuous data.

-Steve

---------------------------------------------------
Steven Wangen
PhD Candidate
Bio-Protection Research Centre
Lincoln University
http://tinyurl.com/lepidulum-spread
http://www.bioprotection.org.nz
+64 (0)3 325-3838 x.8856

Joel Pitt

unread,
Apr 21, 2010, 7:57:29 PM4/21/10
to mdig...@googlegroups.com
On Tue, Apr 20, 2010 at 4:02 PM, Steve Wangen <i.bl...@gmail.com> wrote:
> That should make a little more sense.
> By the way, I'm not sure I mentioned this, but there is a bit in
> GRASSInterface.py on line 772 and 784 where the r.out.ascii commands have
> the '-i' tag, which means that they are exporting only integers - you may
> want to remove that so it can handle continuous data.

Hi Steve,

I made the change for the raster_to_ascii method. The index_to_ascii
method needs the -i because the index values need to refer to the
indexes within the lifestage transition files.

steven.wangen

unread,
Apr 25, 2010, 10:08:56 PM4/25/10
to mdig
As an example -

what value for frequency would be used to subject every individual to
kernel dispersal? I thought the # of seeds in a cell would be good
for this approach (used to define the mean number of dispersals), but
if it limited to [0,1], then my logic is faltering somewhere...



On Apr 20, 2:55 pm, Joel Pitt <joel.p...@gmail.com> wrote:

Steve Wangen

unread,
Apr 25, 2010, 10:47:49 PM4/25/10
to mdig
Wait - I might have figured it out.  I was specifying an argument for 'd_b' instead of 'd_a', because the kernel.math file specified it as a 'b' parameter... let's try this again...

---------------------------------------------------
Steven Wangen
PhD Candidate
Bio-Protection Research Centre
Lincoln University
http://tinyurl.com/lepidulum-spread
http://www.bioprotection.org.nz
+64 (0)3 325-3838 x.8856


Joel Pitt

unread,
Apr 26, 2010, 12:09:07 AM4/26/10
to mdig...@googlegroups.com
Frequency is independent of both d_a, d_b, and the number of
individuals present.

We could make the value passed to frequency be a scaling factor for
how individuals relate to the number of dispersal events generated
(and then use that number as the mean to the poisson event generator)
- but I'd have to program that in. First I'd like to ensure this *is*
the behaviour you're after - i.e. whether there the number of events
should be stochastic at all, or if there should just be an equal
number of events as there are individuals.

J

Steve Wangen

unread,
Apr 26, 2010, 1:39:34 AM4/26/10
to mdig...@googlegroups.com
Is it more straightforward to make the number of events equal to the number of individuals present?  

Would that be similar to setting frequency equal to the map of the 'seed' lifestage?  

If that's easier, I could give that a try - my only concern would be processing time.  Initially I had it in my head that the local dispersal could be used for the majority of dispersal events and just use the kernel for a smaller few.  The idea wasn't to make it 'density-dependent' in the sense that the dispersal parameters would change based on the density of individuals, but the number of individuals dispersed would be a function of the individuals present (even as 100%).

Separately, the r.mdig.kernel is currently creating new individuals and dispersing them, not re-locating existing individuals?

---------------------------------------------------
Steven Wangen
PhD Candidate
Bio-Protection Research Centre
Lincoln University
http://tinyurl.com/lepidulum-spread
http://www.bioprotection.org.nz
+64 (0)3 325-3838 x.8856


Reply all
Reply to author
Forward
0 new messages