Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vjousse opened this issue Nov 29, 2024 · 6 comments

Comments

@vjousse
Copy link

vjousse commented Nov 29, 2024

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 cmutel transferred this issue from brightway-lca/bw_simapro_csv Nov 29, 2024
@cmutel
Copy link
Member

cmutel commented Nov 29, 2024

@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
Copy link
Author

vjousse commented Nov 29, 2024

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

@vjousse vjousse changed the title Documentation on how to import the json file into Brightway Documentation on how to import the json file exported by bw_simapro_csv into Brightway Nov 29, 2024
@cmutel
Copy link
Member

cmutel commented Nov 29, 2024

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
Copy link
Author

vjousse commented Nov 29, 2024

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 cmutel transferred this issue from brightway-lca/brightway2-io Nov 29, 2024
@cmutel
Copy link
Member

cmutel commented Nov 29, 2024

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

@vjousse
Copy link
Author

vjousse commented Nov 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants