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

Nikos Alexandris nik at nikosalexandris.net
Thu Aug 23 02:52:20 PDT 2018


* Stefan Blumentrath <Stefan.Blumentrath at nina.no> [2018-08-23 07:23:12 +0000]:

>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, but rather use NumPy for convenience in
>matrix/table operations (avoiding pandas)...

```
for category in categories:
    statistics_filename = prefix + '_' + category
    r.stats(input=(base,reclassified),
            output=statistics_filename,
            flags='ncapl',
            separator=',',
            quiet=True)
```

Instead, I want to (modify the above so as to) collect/direct all
iterations in one output file.

The question, finally, seems to be: use Python's 'csv' library or prefer
NumPy? The number of records might reach tens of thousands (or more).

Nikos

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180823/64563020/attachment.sig>


More information about the grass-dev mailing list