brightway-lca / bw_simapro_csv

Read and parse SimaPro CSV LCI and LCIA files
https://docs.brightway.dev/projects/bw-simapro-csv/en/latest/
MIT License
2 stars 1 forks source link

Documentation on how to import the `json` file exported by `bw_simapro_csv` into Brightway #14

Open vjousse opened 4 days ago

vjousse commented 4 days ago

There is a mention in the documentation of https://github.com/brightway-lca/bw_simapro_csv that the json file can be imported into Brightway using bw2io but I haven't found a way to do it.

Is there a documentation somewhere about it?

Thanks for the awesome work!

cmutel commented 4 days ago

@vjousse Can you provide more detail on what kind of json file you want to import? json is just a generic format, LCA/sustainability assessment can be expressed in many ways in json.

vjousse commented 4 days ago

Oops sorry, I’ve opened the issue on the wrong repo. I was talking about the JSON exported by https://github.com/brightway-lca/bw_simapro_csv

cmutel commented 4 days ago

Sorry, I moved the issue, but can move it back if needed.

bw_simapro_csv doesn't export JSON? Where do you see that?

vjousse commented 4 days ago

There is a mention of it in the documentation here: https://github.com/brightway-lca/bw_simapro_csv?tab=readme-ov-file#exporting-to-brightway

Exporting to Brightway Process datasets can be exported to a format usable by bw2io with SimaProCSV.to_brightway(). This returns a Python dictionary, but you can also write this data to a file on disk by passing a pathlib.Path instance, i.e.:

from pathlib import Path
from bw_simapro_csv import SimaProCSV
sp = SimaProCSV(Path("my SimaPro file.csv"))
sp.to_brightway(Path("my-export.json"))

The code: https://github.com/brightway-lca/bw_simapro_csv/blob/main/bw_simapro_csv/main.py#L185

cmutel commented 4 days ago

You don't need to export anything to JSON, just use SimaProBlockCSVImporter directly.

vjousse commented 4 days ago

Oh thanks for the tip! Should I submit a documentation PR for it in the bw_simapro_csv repo?