[GRASS-dev] [GRASS-user] os.environ['GRASS_REGION'] Error

Vaclav Petras wenzeslaus at gmail.com
Thu Jun 5 10:28:22 PDT 2014


On Thu, Jun 5, 2014 at 12:42 PM, Javier Martínez-López <
javi.martinez.lopez at gmail.com> wrote:

> Solved! Margherita pointed out that the original script was messing up
> the values of the projection because in one of the testing versions I
> was using integer values instead of characters for the region
> resolution parameter, and since then the script started giving this
> error, which I did not noticed. That is why it was running in one
> machine and not in the other one...
>
> This is the test script about parallel computing using different
> regions [1]. I will test it and let you know if it works with a large
> segmentation processing job.
>
> Thank you very much!
>
> Cheers,
>
>
> Javier
>
> [1]
> https://github.com/javimarlop/eHabpy/blob/master/pas/parallel_grass_example.py
>
>
Hi Javier,

do you know about PyGRASS GridModule [1]? Would it solve what you are doing?

If you stay with your code, it might be safer for you to pass GRASS_REGION
in the env parameter. I hope it works with run_command (and not only with
underlying Popen [2]). You can see what I mean in the example with Popen
[3].

Vaclav

[1] http://grass.osgeo.org/grass71/manuals/pygrass/modules_grid.html
[2] https://docs.python.org/2/library/subprocess.html#popen-constructor
[3]
http://trac.osgeo.org/grass/browser/sandbox/wenzeslaus/gunittest/grass_py_static_check.py?rev=60678#L65


> On Thu, Jun 5, 2014 at 4:46 PM, Markus Neteler <neteler at osgeo.org> wrote:
> > On Thu, Jun 5, 2014 at 10:27 AM, Javier Martínez-López
> > <javi.martinez.lopez at gmail.com> wrote:
> >> Hello all,
> >>
> >> trying to create a temporary region within a python GRASS script using:
> >>
> >> os.environ['GRASS_REGION'] = grass.region_env(res=150)
> >>
> >> I get the following errors on a CentOS server:
> >>
> >> ERROR: Syntax error in cell header
> >> ERROR: Field <projection> missing
> >
> > What does
> > g.region -p
> >
> > say in that location?
> >
> > best,
> > Markus
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140605/cf3c4909/attachment.html>


More information about the grass-dev mailing list