[GRASS-user] garray.read() returns 0-filled array

Stefan Blumentrath Stefan.Blumentrath at nina.no
Mon Mar 16 07:01:31 PDT 2020


Hei Ken,

With this PR:
https://github.com/zarch/grass-session/pull/14
applied, also pygrass modules should work as usual with grass-session.

I just updated it, so it needs testing...

If you define the GRASS_PYTHON environment variable, it should be possible to use any Python installation. If these are compatible is a different question...

GRASS GIS 7.8 should use Python 3, so I am surprised to see that your $GRASS_PYTHON version is /usr/bin/python2.7 ... That is possibly also a source for your trouble with garray...

Cheers
Stefan

-----Original Message-----
From: Ken Mankoff <mankoff at gmail.com> 
Sent: mandag 16. mars 2020 01:14
To: Stefan Blumentrath <Stefan.Blumentrath at nina.no>
Cc: GRASS user list <grass-user at lists.osgeo.org>
Subject: Re: [GRASS-user] garray.read() returns 0-filled array


On 2020-03-15 at 15:11 -07, Stefan Blumentrath <Stefan.Blumentrath at nina.no> wrote...
> I have no experience with garray, but raster2numpy function in pygrass 
> worked quite well for me:
> https://grass.osgeo.org/grass78/manuals/libpython/pygrass.raster.html#
> pygrass.raster.raster2numpy

Thank you for this suggestion. This works but raises new issues.

1) Fully external-to-GRASS interactions works better for me. This solution requires running Python from within GRASS, which adds an extra layer, which makes it harder to get to the same place interactively in Python and debug.

2) Worse, it seems I need to run the $GRASS_PYTHON version which is /usr/bin/python2.7, so I no longer have access to my scientific Python stack.

The 1st issue can be worked around. The 2nd not so much. I hope I'm mis-using the library and can do this from within my Anaconda Python.

  -k.


More information about the grass-user mailing list