How do I get the named Life Cycle Inventory of an activity?
Let's say I'm calculating the Life Cycle Assessment of an activity:
act = [
act for act in ei391cf
if 'benzaldehyde production' == act['name']
and 'RER' == act['location']
]
lca = bw.LCA(
{act[0]: 1},
('ReCiPe 2016 v1.03, midpoint (H)',
'water use', 'water consumption potential (WCP)')
)
lca.lci()
lca.lcia()
... I understand that lca.biosphere_dict
returns the biosphere flows of the Life Cycle Inventory. However, it only lists the codes of the biosphere flows rather than their names and categories. I could write my own function to determine the names and categories, but it must be such a basic task that I am sure there is a function for it.
In fact, I have come across get_labelled_inventory
, but I can't get it to work.
I tried ba.lci.get_labeled_inventory(lca)
but it just returns AttributeError: module 'bw2analyzer' has no attribute 'get_labeled_inventory'
.
First off, please always be careful with something like:
You should at least check the length of this list with e.g.
assert len(act) == 1
. In Brightway 2.5 you can also dobw2data.get_node(name='benzaldehyde production', location='RER', database=ei391cf['name'])
.In Brightway 2.5 you can do
lca.to_dataframe(matrix_label='inventory')
to get an annotated pandasDataframe
.In Brightway 2, you can do something similar with (not tested code):