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

Javier Martínez-López javi.martinez.lopez at gmail.com
Mon Jun 9 04:23:26 PDT 2014


Hi Vaclav,

I ended up manually creating temporary mapsets (in the last version of
the example script) and it works fine now. I plan to use it for
segmenting different regions in parallel. In any case the GridModule
looks great! I will try it for a next version/script.

Thank you and cheers,

Javier

On Thu, Jun 5, 2014 at 7:28 PM, Vaclav Petras <wenzeslaus at gmail.com> wrote:
>
>
>
> 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
>
>


More information about the grass-user mailing list