[Qgis-user] [QGIS-user] Convert r.report output from txt to csv/xls
Ari Meyer
ari.meyer at gmail.com
Tue Jan 18 18:59:53 PST 2022
Thanks, Nicolas. @Igor, that might be worth submitting to the GRASS team.
Kind of absurd to have to parse text files like that in this day and age.
Sorry for the soapbox. ;-)
Ari
On Tue, Jan 18, 2022 at 8:05 PM Nicolas Cadieux <njacadieux.gitlab at gmail.com>
wrote:
> Hi,
>
> Probably but this would be a Grass request.
>
> Nicolas Cadieux
> https://gitlab.com/njacadieux
>
> Le 18 janv. 2022 à 20:14, Ari Meyer <ari.meyer at gmail.com> a écrit :
>
>
> Just a question, given the discussion here. Shouldn't such a report be
> generated in a structured format like YAML/JSON/XML for easier parsing?
> Would this merit an enhancement request?
> Ari
>
> On Tue, Jan 18, 2022 at 6:54 PM chris hermansen <clhermansen at gmail.com>
> wrote:
>
>> Nicolás, Igor and list,
>>
>> On Tue, Jan 18, 2022, 16:40 Nicolas Cadieux <njacadieux.gitlab at gmail.com>
>> wrote:
>>
>>> Hi,
>>> The r.report is a rather complicated text file that contains a lot of
>>> characters made for improving the look of the output. On way could be to
>>> python your way thought it so that is can find your way to the proper
>>> information. This would save time if you have lots of files.
>>>
>>
>> Or if you have to process the same file many times because your data is
>> evolving.
>>
>>>
>>> The faster way, if you don’t program is to use a mixture of notepad++
>>> along with excel or open office. You can easily remove all useless
>>> characters like and replace them by no string or with a “,”. Then you can
>>> import in open office. I like OpenOffice Calc for this because you can
>>> they is to merge multiple separation characters into one. This could help
>>> with the imports. For example, if you have “line 1…….data,data,data”, you
>>> could use both the dot and the comma as separators and the multiple dots
>>> would be merged as one unique separator.
>>>
>>
>> Or not... If your decimal points are dots.
>>
>>>
>>> If you have multiple files, you could use concatenation to make one big
>>> .csv file. For windows, use the example could here.
>>> https://superuser.com/questions/111825/a-command-line-or-batch-cmd-to-concatenate-multiple-files
>>>
>>> Hope this helps. This by the way is an excellent way to start learning
>>> Python programming. Python has easy of way to read and write.txt file and
>>> multiple way to manipulate text strings. Great project if you have the
>>> time to learn.
>>>
>>
>> I have to transform data files like this quite often.
>>
>> Generally whether using Python or another programming language, you want
>> to use regular expressions to match and transform text patterns. The
>> learning curve can be a bit steep but very worthwhile.
>>
>> On Unix / Linux there is a specialized language for this type of
>> transform called awk. It's probably available for Windows somewhere. The
>> advantage of awk is there is no programming overhead for reading and
>> writing lines; the awk programs are statements reacting to the input
>> received from the file.
>>
>>>
>>> Nicolas Cadieux
>>> https://gitlab.com/njacadieux
>>>
>>> Le 18 janv. 2022 à 19:18, Igor Oliveira Ribeiro <
>>> igorgeoinformacao at gmail.com> a écrit :
>>>
>>>
>>> Hi,
>>> I have been using qgis version 3.10 and 3.16. I've been using the
>>> r.report tool to extract some data from a raster. Currently, the report is
>>> generated from r.report in *.txt format. I would like to know if it is
>>> possible to convert this format to csv/xls, within QGIS?
>>>
>>> --
>>>
>>> See our last paper: <https://doi.org/10.1016/j.envpol.2020.114029>
>>>
>>> Impact of biomass burning on a metropolitan area in the Amazon during
>>> the 2015 El Niño: The enhancement of carbon monoxide and levoglucosan
>>> concentrations. <https://doi.org/10.1016/j.envpol.2020.114029>
>>>
>>> Igor Oliveira Ribeiro
>>>
>>> Post-Doc on Regional Climate Change, Vulnerability, Impacts and
>>> Adaptation - Cuomo Foundation/UEA
>>>
>>> +55 92 98103 7136 | skype: igorflorestal
>>>
>>> Universidade do Estado do Amazonas | Instituto Nacional de Pesquisas da
>>> Amazônia
>>>
>>> Visite: www.geoescrita.com.br
>>>
>>> <https://www.linkedin.com/in/igoroliveiraribeiro/>
>>> <https://www.instagram.com/geoescrita/>
>>> <https://www.researchgate.net/profile/Igor_Oliveira_Ribeiro>
>>> <http://lattes.cnpq.br/3909691804095045>
>>> <https://orcid.org/0000-0002-3529-0525> <https://www.geoescrita.com.br/>
>>>
>>> Think globally, act locally!
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220118/245fc1f9/attachment.html>
More information about the Qgis-user
mailing list