[GRASS-dev] Using the new s flag or seed option for r.mapcalc in a python script

Paulo van Breugel p.vanbreugel at gmail.com
Fri Jul 25 22:58:14 PDT 2014


On 24-07-14 16:21, Glynn Clements wrote:
> Paulo van Breugel wrote:
>
>> How do I use this new flag / seed parameter for r.mapcalc in python
>> scripts?
> The grass.script.mapcalc() function has been updated to accept a seed=
> parameter, which should be either an integer or the string 'auto' for
> a random seed.
>
Hi, after updating to the latest version, I tried:

grass.script.mapcalc("$tmp_map = rand(${minval},${maxval})",
     seed='auto',
     minval = minval,
     maxval = maxval,
     tmp_map = tmp_map)
grass.script.mapcalc("$tmp_map = rand(${minval},${maxval})",
     seed=1,
     minval = minval,
     maxval = maxval,
     tmp_map = tmp_map)


In both cases I get the error.

ERROR: Pseudo-random number generator not seeded

Any idea what am I doing wrong here?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140726/2ffb1eab/attachment.html>


More information about the grass-dev mailing list