Re: [GRASS-user] GRASS GIS based developing tools

2022-10-26 Thread Manuele Pesenti
What is being built by compose? Don't I need a Dockerfile?


Off course you need... I forgot to include it in the git versioning, I beg your 
pardon!
Thanks a lot!



Manuele Pesenti

Software Developer and GIS Specialist

Gter srl

Via Jacopo Ruffini 9/1A - 16128 Genova

P.IVA/CF 01998770992

ph: 010-0899150

http://www.gter.it






 Il mar, 25 ott 2022 19:47:39 +0200, Vaclav Petras  
ha scritto ---







On Tue, 25 Oct 2022 at 03:31, Manuele Pesenti <mailto:manuele.pese...@gter.it> 
wrote:

... 




this should be the link to the complete gist: 
https://gist.github.com/manuelep/e56fe90399c44e02e7cb97d5ef95edbd






What is being built by compose? Don't I need a Dockerfile?___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] GRASS GIS based developing tools

2022-10-25 Thread Manuele Pesenti
Hi Vaclav,

first of all thanks for your feedback, I beg your pardon it seams the link was 
just poiting to the readme file, this should be the link to the complete gist: 
https://gist.github.com/manuelep/e56fe90399c44e02e7cb97d5ef95edbd



anyway you can even clone the complete repo that contains both files using: git 
clone https://gist.github.com/e56fe90399c44e02e7cb97d5ef95edbd.git jupyter-grass



and then follow other instructions reported in the README:

cd jupyter-grass

mkdir notebook-home

docker-compose build --build-arg user="${USER}" --build-arg uid="${UID}"

docker-compose up


Let me know if something is not clear or goes wrong...
Thanks a lot
Cheers


Manuele Pesenti

Software Developer and GIS Specialist

Gter srl

Via Jacopo Ruffini 9/1A - 16128 Genova

P.IVA/CF 01998770992

ph: 010-0899150

http://www.gter.it






 Il mar, 25 ott 2022 05:54:12 +0200, Vaclav Petras  
ha scritto ---



Hi Manuele,



Seeing a setup with JupyterLab is always nice and useful especially if the 
focus is developing and distributing GRASS procedures. A standalone repository 
with everything needed would be a good starting point for sharing such a setup 
and making it ready to go. I don't see a Dockerfile, but it seems it is needed. 
You can compare your setup to docker and binder directories in the 
https://github.com/OSGeo/grass/ and describe how your setup is different.



Best,

Vaclav




On Mon, 24 Oct 2022 at 04:02, Manuele Pesenti <mailto:manuele.pese...@gter.it> 
wrote:







Hi everyone,

maybe this is  such an off topic for this list, I just wanted to share that  I 
wrote a https://gist.github.com/manuelep/e56fe90399c44e02e7cb97d5ef95edbd for 
building

up an environment based on GRASS GIS for developing and distributing GRASS GIS 
based procedures.

The main developing proposed tool in the architecture is Jupyter Lab, I don't 
know if it's such a commont tool between the component of this mailing-list.

I just wanted to have some feedback to understand if it can be considered a 
useful tool.



Unfortunately the readme file at the moment is in italian but the compose file 
and the commands maybe can be understood anyway.



Thanks

Best regards





Manuele Pesenti

Software Developer and GIS Specialist

Gter srl

Via Jacopo Ruffini 9/1A - 16128 Genova

P.IVA/CF 01998770992

ph: 010-0899150

http://www.gter.it








___

grass-user mailing list

mailto:grass-user@lists.osgeo.org

https://lists.osgeo.org/mailman/listinfo/grass-user___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] GRASS GIS based developing tools

2022-10-24 Thread Manuele Pesenti
Hi everyone,

maybe this is  such an off topic for this list, I just wanted to share that  I 
wrote a https://gist.github.com/manuelep/e56fe90399c44e02e7cb97d5ef95edbd for 
building

up an environment based on GRASS GIS for developing and distributing GRASS GIS 
based procedures.

The main developing proposed tool in the architecture is Jupyter Lab, I don't 
know if it's such a commont tool between the component of this mailing-list.

I just wanted to have some feedback to understand if it can be considered a 
useful tool.



Unfortunately the readme file at the moment is in italian but the compose file 
and the commands maybe can be understood anyway.



Thanks

Best regards





Manuele Pesenti

Software Developer and GIS Specialist

Gter srl

Via Jacopo Ruffini 9/1A - 16128 Genova

P.IVA/CF 01998770992

ph: 010-0899150

http://www.gter.it___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] missing file error running r.terraflow module

2021-09-07 Thread Manuele Pesenti
Dear Grass users,

I obtain this error running r.terraflow module from the python environment:



import grass.script as gs

...

gs.run_command("r.terraflow", elevation='DSM_neg', filled='DSM_neg_filled', 
overwrite=True)





WARNING: Raster map  is of type DCELL_TYPE -- precision may be

 lost

ami_single_temp_name: G_mkstemp() failed: : No such file or directory

r.terraflow: ami_stream.cpp:93: int ami_single_temp_name(const string&, char*): 
Assertion `0' failed.

Traceback (most recent call last):

  File "/home/manuele/.virtualenvs/ETS/bin/ets.py", line 7, in 

    exec(compile(f.read(), __file__, 'exec'))

  File "/home/manuele/Lavoro/ETS/ETSCore/scripts/ets.py", line 87, in 

    terraflow(env['resolution'], area_studio=env['aoi'])

  File "/home/manuele/Lavoro/ETS/ETSCore/src/ETSCore/core.py", line 159, in 
terraflow

    gs.run_command("r.terraflow", elevation='DSM_neg', filled='DSM_neg_filled', 
overwrite=True)

  File "/usr/lib/grass78/etc/python/grass/script/core.py", line 441, in 
run_command

    return handle_errors(returncode, returncode, args, kwargs)

  File "/usr/lib/grass78/etc/python/grass/script/core.py", line 342, in 
handle_errors

    raise CalledModuleError(module=None, code=code,

grass.exceptions.CalledModuleError: Module run None r.terraflow --o 
elevation=DSM_neg filled=DSM_neg_filled ended with error

Process ended with non-zero return code -6. See errors in the (error) output.





I haven't found any help looking about it on the web and I cannot understand 
the reference about the missing file 

ami_single_temp_name: G_mkstemp() failed: : No such file or directory

that I guess is the problem.



thanks a lot for any help.

Cheers



  Manuele___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error import from grass.pygrass.vector library

2021-08-24 Thread Manuele Pesenti
 Attivato mar, 24 ago 2021 11:04:44 +0200 Stefan Blumentrath 
 ha scritto 






What version of grass_sessions do you use?

I run grass_session 0.4 on Ubuntu 18.04 with GRASS 7.8 and your script works 
fine…

 







Thanks Stefan! It solves my problem... I 
https://github.com/zarch/grass-session/issues/22 to the github repo of 
grass_session.



Cheers



  Manuele___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error import from grass.pygrass.vector library

2021-08-24 Thread Manuele Pesenti
 Attivato mar, 24 ago 2021 11:04:44 +0200 Stefan Blumentrath 
 ha scritto 



What version of grass_sessions do you use?

I run grass_session 0.4 on Ubuntu 18.04 with GRASS 7.8 and your script works 
fine…

 







$ pip show grass_session

Name: grass-session

Version: 0.5

...



Ubuntu 21.04



$ grass --version

GRASS GIS 7.8.5

...



I'll try to downgrade grass_session



Thanks!



  Manuele___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Error import from grass.pygrass.vector library

2021-08-24 Thread Manuele Pesenti
 Attivato mar, 24 ago 2021 10:10:10 +0200 Stefan Blumentrath 
 ha scritto 




Hm…

 

Did you initialize the session, e.g. like:

 

with Session(gisdb="/tmp", location="location", create_opts="EPSG:4326"):

    from grass.pygrass.vector import Vector







Yes it's exactly what I do, the strange fact is that I can by-pass the 
exception assigning the LD_LIBRARY_PATH value before running the script even if 
even now before importing vector lib this env variable has the correct value 
exactly thanks to the grass_session lib import...



so the script modified as you suggested reported here under still raise the 
exception



# -*- coding: utf-8 -*-



import os, sys



GISBASE = '/usr/lib/grass78'

GRASSBIN = '/usr/bin/grass78'



# Define GRASS-Python environment

os.environ['GISBASE'] = GISBASE



os.environ['GRASSBIN'] = GRASSBIN



sys.path.append(os.path.join(GISBASE, "etc", "python"))



from grass_session import Session

import grass.script as gs



print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")

print(f"GRASSBIN: {os.environ['GRASSBIN']}")



with Session(gisdb="/tmp", location="location", create_opts="EPSG:4326"):



    from grass.pygrass.vector import Vector



print('DONE!')





while the old script (for convenience reported here under) runned as 



$ LD_LIBRARY_PATH=$(grass78 --config path)/lib python import_test.py 

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

DONE!



returns just what printed in the script without raising the exception.



# -*- coding: utf-8 -*-



import os, sys



GISBASE = '/usr/lib/grass78'

GRASSBIN = '/usr/bin/grass78'



# Define GRASS-Python environment

os.environ['GISBASE'] = GISBASE



os.environ['GRASSBIN'] = GRASSBIN



sys.path.append(os.path.join(GISBASE, "etc", "python"))



# from grass_session import Session

import grass.script as gs



print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")

print(f"GRASSBIN: {os.environ['GRASSBIN']}")



# with Session(gisdb="/tmp", location="location", create_opts="EPSG:4326"):



from grass.pygrass.vector import Vector



print('DONE!')



Cheers



    Manuele



 

 

Cheers

Stefan

 

From: grass-user <mailto:grass-user-boun...@lists.osgeo.org> On Behalf Of 
Manuele Pesenti
 Sent: tirsdag 24. august 2021 09:38
 To: Grass User <mailto:grass-user@lists.osgeo.org>
 Subject: Re: [GRASS-user] Error import from grass.pygrass.vector library


 

 


Drear Stefan,
 thanks for your quick reply but the solution is not so clear, I already use 
grass_session library even if not reported in the attached example, how can it 
helps with the issue? Just import the vector library after the session is 
loaded does not solve as far
 as I've tested.
 
 Cheers
 
     Manuele
 

 Attivato ven, 20 ago 2021 21:26:22 +0200 Stefan Blumentrath 
<mailto:stefan.blumentr...@nina.no> ha scritto 


 

Dear Manuele,

 

For ctypes in pygrass, the C-libraries need to be loaded explicitly.

 

You could have a look here:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzarch%2Fgrass-session%2Fblob%2F6097f834be20ee0d703deb2af90f22d6dc66f368%2Fgrass_session%2Fsession.py%23L332=04%7C01%7C%7C5490515dd62a4bc57acf08d966d433e6%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637653884462405890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000=V0ecwomhbdvobU2B3tal1udBRXj5jkvWwN9e4K0dKSw%3D=0

to see how it can be done, or just use the grass_session python library (pip 
install grass-session) for convenience…

 

Cheers

Stefan

 

From: grass-user <mailto:grass-user-boun...@lists.osgeo.org> On Behalf Of 
Manuele Pesenti
 Sent: fredag 20. august 2021 16:40
 To: grass-user <mailto:grass-user@lists.osgeo.org>
 Subject: [GRASS-user] Error import from grass.pygrass.vector library


 

Dear All,


 


I'm moving my first steps on the development of a python script that uses 
Grass, but I cannot import from the grass.pygrass.vector library.


I work on a Ubuntu/Linux environment and I've installed grass using apt, this 
is the test script I'm currently running:


 


# -*- coding: utf-8 -*-


 


import os, sys


 


GISBASE = '/usr/lib/grass78'


GRASSBIN = '/usr/bin/grass78'


 


# Define GRASS-Python environment


os.environ['GISBASE'] = GISBASE


 


os.environ['GRASSBIN'] = GRASSBIN


 


sys.path.append(os.path.join(GISBASE, "etc", "python"))


 


from grass_session import Session


import grass.script as gs


 


print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")


print(f"GRASSBIN: {os.environ['GRASSBIN']}")


 


from grass.pygrass.vector import Vector


 


print('DONE!')


 


and this is the output:


 


$ python import_test.py 


LD_LIBRARY_PATH: /usr/lib/grass78/lib


Re: [GRASS-user] Error import from grass.pygrass.vector library

2021-08-24 Thread Manuele Pesenti
Drear Stefan,
thanks for your quick reply but the solution is not so clear, I already use 
grass_session library even if not reported in the attached example, how can it 
helps with the issue? Just import the vector library after the session is 
loaded does not solve as far as I've tested.

Cheers

    Manuele

 Attivato ven, 20 ago 2021 21:26:22 +0200 Stefan Blumentrath 
<mailto:stefan.blumentr...@nina.no> ha scritto 



Dear Manuele,

 

For ctypes in pygrass, the C-libraries need to be loaded explicitly.

 

You could have a look here:

https://github.com/zarch/grass-session/blob/6097f834be20ee0d703deb2af90f22d6dc66f368/grass_session/session.py#L332

to see how it can be done, or just use the grass_session python library (pip 
install grass-session) for convenience…

 

Cheers

Stefan

 

From: grass-user <mailto:grass-user-boun...@lists.osgeo.org> On Behalf Of 
Manuele Pesenti
 Sent: fredag 20. august 2021 16:40
 To: grass-user <mailto:grass-user@lists.osgeo.org>
 Subject: [GRASS-user] Error import from grass.pygrass.vector library


 

Dear All,


 


I'm moving my first steps on the development of a python script that uses 
Grass, but I cannot import from the grass.pygrass.vector library.


I work on a Ubuntu/Linux environment and I've installed grass using apt, this 
is the test script I'm currently running:


 


# -*- coding: utf-8 -*-


 


import os, sys


 


GISBASE = '/usr/lib/grass78'


GRASSBIN = '/usr/bin/grass78'


 


# Define GRASS-Python environment


os.environ['GISBASE'] = GISBASE


 


os.environ['GRASSBIN'] = GRASSBIN


 


sys.path.append(os.path.join(GISBASE, "etc", "python"))


 


from grass_session import Session


import grass.script as gs


 


print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")


print(f"GRASSBIN: {os.environ['GRASSBIN']}")


 


from grass.pygrass.vector import Vector


 


print('DONE!')


 


and this is the output:


 


$ python import_test.py 


LD_LIBRARY_PATH: /usr/lib/grass78/lib


GRASSBIN: /usr/bin/grass78


Traceback (most recent call last):


  File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 76, in 
load


    return ctypes.cdll.LoadLibrary(path)


  File "/usr/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary


    return self._dlltype(name)


  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__


    self._handle = _dlopen(self._name, mode)


OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file 
or directory


 


During handling of the above exception, another exception occurred:


 


Traceback (most recent call last):


  File "/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py", line 21, in 



    from grass.pygrass.vector import Vector


  File "/usr/lib/grass78/etc/python/grass/pygrass/vector/__init__.py", line 5, 
in 


    import grass.lib.gis as libgis


  File "/usr/lib/grass78/etc/python/grass/lib/gis.py", line 23, in 


    _libs["grass_gis.7.8"] = load_library("grass_gis.7.8")


  File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 62, in 
load_library


    return self.load(path)


  File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 78, in 
load


    raise ImportError(e)


ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such 
file or directory



 


Thank you very mutch for any help


 


Cheers


 


      Manuele


 


 


 



 ___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Error import from grass.pygrass.vector library

2021-08-20 Thread Manuele Pesenti
Dear All,

 

I'm moving my first steps on the development of a python script that uses 
Grass, but I cannot import from the grass.pygrass.vector library. 

I work on a Ubuntu/Linux environment and I've installed grass using apt, this 
is the test script I'm currently running: 



# -*- coding: utf-8 -*-



import os, sys



GISBASE = '/usr/lib/grass78'

GRASSBIN = '/usr/bin/grass78'



# Define GRASS-Python environment

os.environ['GISBASE'] = GISBASE



os.environ['GRASSBIN'] = GRASSBIN



sys.path.append(os.path.join(GISBASE, "etc", "python"))



from grass_session import Session

import grass.script as gs



print(f"LD_LIBRARY_PATH: {os.environ['LD_LIBRARY_PATH']}")

print(f"GRASSBIN: {os.environ['GRASSBIN']}")



from grass.pygrass.vector import Vector



print('DONE!')



and this is the output:



$ python import_test.py 

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

Traceback (most recent call last):

  File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 76, in 
load

    return ctypes.cdll.LoadLibrary(path)

  File "/usr/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary

    return self._dlltype(name)

  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__

    self._handle = _dlopen(self._name, mode)

OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file 
or directory



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py", line 21, in 


    from grass.pygrass.vector import Vector

  File "/usr/lib/grass78/etc/python/grass/pygrass/vector/__init__.py", line 5, 
in 

    import grass.lib.gis as libgis

  File "/usr/lib/grass78/etc/python/grass/lib/gis.py", line 23, in 

    _libs["grass_gis.7.8"] = load_library("grass_gis.7.8")

  File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 62, in 
load_library

    return self.load(path)

  File "/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py", line 78, in 
load

    raise ImportError(e)

ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such 
file or directory




Thank you very mutch for any help



Cheers



      Manuele___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user