brightway-lca / brightway2-data

Tools for the management of inventory databases and impact assessment methods. Part of the Brightway LCA framework.
https://docs.brightway.dev/
BSD 3-Clause "New" or "Revised" License
8 stars 21 forks source link

IO table update #105

Closed cmutel closed 2 years ago

cmutel commented 2 years ago

Current status (as of evening of August 17):

cmutel commented 2 years ago

@michaelweinold @BenPortner This is ready to merge. Thanks a lot to @BenPortner for laying the foundations. In particular, being able to treat IO Table activities just like others, and having .technosphere(), .biosphere(), etc. is awesome. In the end, I did the following:

In the future, we could imagine adding the ability to manipulate data values, though this would not be fun to program. I think there could also be more tests for the filtering functions in IOTableExchanges. But overall, the fact that we can do this and it just works is brilliant!

In [1]: import bw2data as bd

In [2]: bd.projects.set_current("Exiobase 3.8.1 monetary")

In [3]: act = bd.Database('Exiobase 3.8.1 monetary').random()

In [4]: for exc, index in zip(act.technosphere(), range(10)):
   ...:     print(exc)
   ...:
Exchange: 9.429556024898034e-10 million € 'Vegetables, fruit, nuts' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 2.0292324949284374e-13 million € 'Oil seeds' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 5.155615312446571e-08 million € 'Crops nec' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 7.775732141501734e-11 million € 'Cattle' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 2.4537679830724524e-13 million € 'Animal products nec' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 1.5916580553554383e-10 million € 'Products of forestry, logging and related services' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 3.0656987365373922e-12 million € 'Fish and other fishing products; services incidental of fishing' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 1.0637340834562803e-11 million € 'Sand and clay' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 5.077701592526296e-10 million € 'Chemical and fertilizer minerals, salt and other mining and quarrying products n.e.c.' (million €, AT, None) to 'Crops nec' (million €, WF, None)>
Exchange: 8.148216823489207e-11 million € 'Products of meat cattle' (million €, AT, None) to 'Crops nec' (million €, WF, None)>