technical question on distance decay function in pollination model

WillemVWillemV Member
edited August 2014 in Terrestrial Models
hi all,

a question on the pollination model. The distance decay function relates the contribution of each cell to an agricultural land parcel to the distance between that cell and the agricultural land parcel. The closer the cell the higher the contribution. In the inputs the average flight distance has to be provided. However, no maximum flight distance has to be provided. This means that in principle each cell in the landscape can contribute to an agricultural, up to several 100 km, but this contribution can become infinitely small. Although it likely does not effect the results it might seriously increase computation time.

I was wondering if it's possible to set somewhere in InVEST a predefined maximum flight distance or whether InVEST already uses a predefined threshold below which cells have no contribution and stops calculations?



  • jdouglassjdouglass Administrator, NatCap Staff
    HI Willem,

    A great question and an interesting point.

    You're right that in principle, every cell could be affected by the pollinator's flight path, though the contribution would be very, very small. In practice, however, such precision is difficult to achieve with a computer trying to accurately represent tiny decimal values in binary. The scipy.ndimage.gaussian_filter function that we use to model foraging patterns already appears to have a threshold after which contributions are no longer considered.

    If you're interested, try this in your python shell:

    >>> import numpy
    >>> import scipy.ndimage
    >>> array = numpy.zeros((11, 11)) # create matrix of 0's
    >>> array[5][5] = 1 # set the center pixel to 1
    >>> sigma = 1 # sigma of 1 represents 1 pixel avg. flight radius for pollinator
    >>> gaussian_matrix = scipy.ndimage.gaussian_filter(array, sigma)
    >>> numpy.savetxt('filtered.txt', gaussian_matrix)

    This creates an 11x11 matrix of 0.0's, sets the center pixel to 1 and then applies a gaussian filter with a sigma ('average flight distance') of 1 pixel before saving it to a text file for easier reading.

    When I open up the text file, all pixels along the border have the value 0.000000000000000000e+00, while pixels slightly in from the border have non-zero values. Increasing the matrix size (say, to a size of (21 x 21)), yields the same results:


    So I don't think we need to worry about setting a maximum flight distance, since numpy appears to handle this for us :)
Sign In or Register to comment.