[GRASS-user] r.hazard.flood

Vaclav Petras wenzeslaus at gmail.com
Tue Jul 8 06:51:40 PDT 2014


On Tue, Jul 8, 2014 at 4:29 AM, Hamish <hamish.webmail at gmail.com> wrote:

> Leo wrote:
> > > Cellsize : 118.28096836
> > > SECTION 1a (of 4): Initiating Memory.
> > > Current region rows: 17433, cols: 17539
> > > ERROR: G_malloc: unable to allocate 2448854040 bytes of memory at
> > > init_vars.c:134
> > > WARNING: Subprocess failed with exit code 1
>
> Madi:
> > This log suggests that r.watershed, called by r.hazard.flood, is not
> > able to finish the job due to lack of memory.
>
> [@devs]
> in bash you can do a test "if [ $? -ne 0 ] ; then" to see if r.watershed
> finished correctly and go to a 'g.message -e' and 'exit 1' if it
> failed. r.hazard.flood is a python script, how to apply the same to
> grass.run_command() before claiming success and continuing?
>
> In case of run_command you should check the return value which is the exit
code of the module.

ret = run_command('g.region', s=0, n=5, w=0, e=5, res=1)
if ret != 0:
    grass.script.fatal(_("g.region failed, see the error message above"))

It is actually designed to resemble the calls in shell which I don't think
is a right think to do, so please see ticket #2326.

[doc]
http://grass.osgeo.org/programming7/namespacepython_1_1script_1_1core.html#a0cbf4805e1691904c8245037ea359c71
[src]
http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/script/core.py#L352
[ticket] http://trac.osgeo.org/grass/ticket/2326

>
> regards,
>
> --
> Hamish <hamish.webmail at gmail.com>
> .
> Thought I should join the Yahoo mail diaspora before 30 days
> worth of my emails got flushed from everyone's spam boxes never
> to be seen again. In the last weeks some have made it to the ML
> archives at least, if not to end recipients. Others seem to have
> just disappeared into /dev/null. It didn't help that the web
> interface had become an unusable gibberish of broken JavaScript
> and their IMAP would only transfer the oldest 4% of my inbox.
> .
> http://www.ietf.org/mail-archive/web/ietf/current/msg87153.html
>
> http://www.spamresource.com/2014/04/up-in-arms-about-yahoos-dmarc-policy.html
> http://wiki.list.org/pages/viewpage.action?pageId=17891458
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140708/6ab0835c/attachment.html>


More information about the grass-user mailing list