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
GRASS version:
GRASS 7.1.svn (2014)
libgis Revision: 60707
libgis Date: 2014-06-05 00:58:35 +0200 (Thu, 05 Jun 2014)
Doing it on my Ubuntu installation works fine! Any idea about what
could be the problem?
Thank you very much!
Cheers,
Javier
On Thu, Jun 5, 2014 at 10:27 AM, Javier Martínez-López
<javi.martinez.lopez@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
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
On Thu, Jun 5, 2014 at 4:46 PM, Markus Neteler <neteler@osgeo.org> wrote:
On Thu, Jun 5, 2014 at 10:27 AM, Javier Martínez-López
<javi.martinez.lopez@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
On Thu, Jun 5, 2014 at 12:42 PM, Javier Martínez-López <
javi.martinez.lopez@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@osgeo.org> wrote:
> On Thu, Jun 5, 2014 at 10:27 AM, Javier Martínez-López
> <javi.martinez.lopez@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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
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@gmail.com> wrote:
On Thu, Jun 5, 2014 at 12:42 PM, Javier Martínez-López
<javi.martinez.lopez@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@osgeo.org> wrote:
> On Thu, Jun 5, 2014 at 10:27 AM, Javier Martínez-López
> <javi.martinez.lopez@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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev