[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 23:44:15 PDT 2014


On 26-07-14 07:58, Paulo van Breugel wrote:
> 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?
>
Sorry, please ignore my message. I did a completely clean install of 
grass and now it works. Must have been some problem with old install or 
I was just too early with updating last time.

In short, thanks Glynn for implementing the random seed options, great work!

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


More information about the grass-dev mailing list