Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-23 Thread Nikos Alexandris
* Moritz Lennert [2018-08-23 13:02:03 +0200]: On 23/08/18 11:52, Nikos Alexandris wrote: * Stefan Blumentrath [2018-08-23 07:23:12 +]: Dear Nikos, Can you give us a bit more context? What is it you want to achieve? How are you using r.stats and what is it you want to do with the outpu

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-23 Thread Moritz Lennert
On 23/08/18 11:52, Nikos Alexandris wrote: * Stefan Blumentrath [2018-08-23 07:23:12 +]: Dear Nikos, Can you give us a bit more context? What is it you want to achieve? How are you using r.stats and what is it you want to do with the output? Personally, I am not too familiar with perfor

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-23 Thread Nikos Alexandris
* Stefan Blumentrath [2018-08-23 07:23:12 +]: Dear Nikos, Can you give us a bit more context? What is it you want to achieve? How are you using r.stats and what is it you want to do with the output? Personally, I am not too familiar with performance implications of NumPy vs. plain Python

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-23 Thread Stefan Blumentrath
/table operations (avoiding pandas)... Cheers Stefan -Original Message- From: Nikos Alexandris Sent: onsdag 22. august 2018 17:57 To: Stefan Blumentrath Cc: GRASS-GIS development mailing list Subject: Re: [GRASS-dev] Parsing output of r.category which includes labels Stefan, a somewhat

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-22 Thread Nikos Alexandris
Stefan, a somewhat irrelevant question to the original subject: do you think the NumPy way is worth to collage a series of `r.stats` outputs? Imagine administrative boundaries and one `r.stats` call for each. They may be tenths, or hundreds, or thousands as the script is meant to cover European

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-21 Thread Nikos Alexandris
* Moritz Lennert [2018-08-21 12:57:01 +0200]: On 21/08/18 12:47, Stefan Blumentrath wrote: Hi Nikos, If you are interested in dictionary output you could do: category_labels = grass.parse_command('r.category', map='youmap', delimiter='\t') Right, nice solution ! For those not very famili

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-21 Thread Moritz Lennert
On 21/08/18 12:47, Stefan Blumentrath wrote: Hi Nikos, If you are interested in dictionary output you could do: category_labels = grass.parse_command('r.category', map='youmap', delimiter='\t') Right, nice solution ! For those not very familiar with the scripting library: the "delimiter" o

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-21 Thread Stefan Blumentrath
2018 02:02 To: Moritz Lennert Cc: GRASS-GIS development mailing list Subject: Re: [GRASS-dev] Parsing output of r.category which includes labels * Moritz Lennert [2018-08-20 13:40:36 +0200]: >On 19/08/18 22:19, Nikos Alexandris wrote: >>If I am not wrong, all use cases of `read_comman

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-20 Thread Nikos Alexandris
* Stefan Blumentrath [2018-08-20 10:48:34 +]: Hi Nikos, You could use numpy and genfromtxt() to parse the output string... genfromtxt() requires an StringIO object (or file) and StringIO (from io) requires unicode()... So you could do: from io import StringIO import numpy as np output =

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-20 Thread Nikos Alexandris
* Moritz Lennert [2018-08-20 13:40:36 +0200]: On 19/08/18 22:19, Nikos Alexandris wrote: If I am not wrong, all use cases of `read_command()` [0, 1], in (at least) the grass-addons repository, do not consider an output from `r.category` which includes labels. [0] https://grass.osgeo.org/gras

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-20 Thread Moritz Lennert
On 19/08/18 22:19, Nikos Alexandris wrote: If I am not wrong, all use cases of `read_command()` [0, 1], in (at least) the grass-addons repository, do not consider an output from `r.category` which includes labels. [0] https://grass.osgeo.org/grass74/manuals/libpython/script.html?highlight=read_

Re: [GRASS-dev] Parsing output of r.category which includes labels

2018-08-20 Thread Stefan Blumentrath
1: https://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html -Original Message- From: grass-dev On Behalf Of Nikos Alexandris Sent: søndag 19. august 2018 22:19 To: GRASS-GIS development mailing list Subject: [GRASS-dev] Parsing output of r.category which includes labels If I am not wrong, all use

[GRASS-dev] Parsing output of r.category which includes labels

2018-08-19 Thread Nikos Alexandris
If I am not wrong, all use cases of `read_command()` [0, 1], in (at least) the grass-addons repository, do not consider an output from `r.category` which includes labels. [0] https://grass.osgeo.org/grass74/manuals/libpython/script.html?highlight=read_command#script.core.read_command [1] https: