Lars_N
Lars_N

Reputation: 1

How can I compare ecoinvent's LCIA scores to the characterized inventory in Brightway2?

I am digging into Brightway2 for a research project using ecoinvent version 3.9.1. As I want to calculate different scenarios, I am not interested in a particular foreground system for now, but rather arrive at the matrix of Footprint multipliers (CBA^-1). As a first step, I want to compare the results stored in Brightways lca.characterized_inventory object to the LCIA results provided by ecoinvent in excel format (downloadable via licence on their website). I have chosen 'ReCiPe 2016 v1.03, midpoint (H) no LT','material resources: metals/minerals no LT','surplus ore potential (SOP) no LT' as an LCIA method and I want to know if everything went well while importing ecoinvent into Brightway i.e. how well the LCIA results match with the excel file.

For me it boils down to a problem with interpreting the characterized inventory. How do I map it's matrix values to actual activity names I can search for in the excel file? I found that the activity UUID_Product UUIDs identifiers in the excel file do not match those created by Brightway. Why is that? For example: according to ecoinvent, ferronickel production has an impact of 1,39 kg Cu-Eq per kilogram. How and where do I find this number in my Brightway2 inventory? I want to end up with a plot showing ecoinvent lcia scores on one axis and Brightway scores on the other, sorted by activity.

I have of course loaded ecoinvent and computed the lca. I don't remember where I got this from but I think I summed over characterization factors (?) to store the lcia results by activity inside a structured numpy array:

results_by_activity = (lca.characterized_inventory.sum(axis=0)).A1

I have created a pandas series that is supposed to store both activity names and impacts:

list_of_names_in_columns = [bw.get_activity(rev_act_dict[col])['name'] 
                            for col in range(lca.characterized_inventory.shape[1])]
pd.Series(index=list_of_names_in_columns, data=results_by_activity).sort_values(ascending=False)

I have also loaded my excel sheet into a pandas dataframe

import pandas as pd

ei_lcia_score_file = r'C:my_file_path\Cut-off_Cumulative_LCIA_v391.xlsx'
df = pd.read_excel(ei_lcia_score_file, sheet_name='LCIA', header = [0,1,2])
#use previously selected LCIA method to select a method column from the ecoinvent file
ei_lcia_midpoint_scores = df[LCIA_method]

I have been reading about reverse dictionaries storing activity names and biosphere flows here: Connecting exchange names and codes to LCA inventory results

I'm still confused.

I would appreciate any help, as I am getting stuck with my project.

Upvotes: 0

Views: 162

Answers (1)

mfastudillo
mfastudillo

Reputation: 1631

The characterised inventory has as columns activities and as rows characterised elementary flows. if you sum by rows you'll get for each activity the contributions of its direct emissions to the LCIA score of the activity you are calculating. If you aggregate the columns you'll get the contribution per elementary flow. If I am not mistaken is the result of: $$C B s^{-1}$$ where is s is the solution to the linear system f = A s. You don't need to calculate the inverse for that, but you can if you need it.

You could try something like this for the calculation, I hope that with the comments it would be enough to understand the logic. The end result is a

import bw2calc as bc
import bw2data as bd
import pandas as pd

lca = bc.LCA({ecoinvent_act:1},recipe_method)
lca.lci()
lca.lcia()

# get the leointief inverse
L = lca.invert_technosphere_matrix()

# matrix with biosphere flows as rows activities as cols
B = lca.biosphere_matrix.todense()

# matrix with characterization factors
 C = lca.characterization_matrix.todense()

# LCIA contribution, characterized elementary flows as rows
# activities as columns
score_matrix = (C @ B @ L)

# aggregate per activity
scores = score_matrix.sum(axis=0)

# here we pick the names of the activities in the columns of
# the matrices
names = [(bd.get_node(id=i)['name'],bd.get_node(id=i)['location']) 
for i in lca.activity_dict]

pd.Series(scores.A1,index=names)

Upvotes: 0

Related Questions