Re: [GRASS-user] raster map from coordinates in python

2018-02-12 Thread Stefan Blumentrath
Thanks, Nikos!
Interesting! Not 100% sure though, how to conclude from that post.
One voice there says "the two are not comparable one should use BytesIO, when 
input data is bytes, and StringIO when Input data is string".
However in the this case, both seem suitable. So, the performance comparison 
suggests that StringIO would be better for Pyhon 2, while BytesIO will be 
better for Python 3 (where cStringIO will be no longer available).
So, I tend to use BytesIO with regards to future compatibility...

Cheers
Stefan 

-Original Message-
From: Nikos Alexandris [mailto:n...@nikosalexandris.net] 
Sent: mandag 12. februar 2018 21.20
To: Stefan Blumentrath <stefan.blumentr...@nina.no>
Cc: grass-user grass-user (grass-user@lists.osgeo.org) 
<grass-user@lists.osgeo.org>
Subject: Re: [GRASS-user] raster map from coordinates in python

* Stefan Blumentrath <stefan.blumentr...@nina.no> [2018-02-12 19:41:15 +]:

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

Out of curiosity I did a search. https://stackoverflow.com/a/37463095

Nikos

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

Re: [GRASS-user] raster map from coordinates in python

2018-02-12 Thread Stefan Blumentrath
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='-', 
output=output,
 method='mean', separator=' ')

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


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) 
<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?

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

[GRASS-user] raster map from coordinates in python

2018-02-12 Thread Stefan Blumentrath
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?

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