OK, found it!
Reading the manuals more carefully helps:

So, with my StringIO object "result", formated x y z, the following works:

grass.write_command('r.in.xyz', stdin=result.getvalue(), input='-', 
                                         method='mean', separator=' ')

StringIO can be replaced with BytesIO BTW, though I don`t know what difference 
the two make...

From: grass-user [mailto:grass-user-boun...@lists.osgeo.org] On Behalf Of 
Stefan Blumentrath
Sent: mandag 12. februar 2018 14.42
To: grass-user grass-user (grass-user@lists.osgeo.org) 
Subject: [GRASS-user] raster map from coordinates in python

Dear all,

I have a numpy array with x,y, z coordinates that I would like to write to a 
rater map.
When I convert the array to a StringIO-object and feed it to r.in.xyz I get:
OSError: [Errno 7] Argument list too long
I checked the content of the StringIO object and it contains only three columns 
(separated by space) and rows separated by '\n'...
Any hints on how to accomplish that without writing out stuff to a textfile?

grass-user mailing list

Reply via email to