After downloading data as CSV from the HESTIA platform, the format will look like this:
| site.@id | site.measurements.0.term.@id | site.measurements.0.value | site.measurements.1.term.@id | site.measurements.1.value | site.measurements.2.term.@id | site.measurements.2.value | site.dataPrivate |
|---|---|---|---|---|---|---|---|
| xvflr | sandContent | 90 | siltContent | 6 | clayContent | 4 | false |
| gght | sandContent | 90 | siltContent | 6 | clayContent | 4 | false |
It is possible to pivot some data based on the term.@id and move them as columns, such as:
| site.@id | site.measurements.sandContent.value | site.measurements.siltContent.value | site.measurements.clayContent.value | site.dataPrivate |
|---|---|---|---|---|
| xvflr | 90 | 6 | 4 | false |
| gght | 90 | 6 | 4 | false |
Python version 3 minimumpip install hestia_earth.utilshestia-pivot-csv --input-file source.csv
This writes source-pivoted.csv beside the original. To choose the name yourself:
hestia-pivot-csv --input-file source.csv --output-file dest.csv
The input can be a CSV or a JSON file of nodes.