Import the Life cycle inventory database for consumption in Québec into Brightway2

Purpose

  • Describe how to import the life cycle inventory (LCI) database for consumption in Québec, developed by CIRAIG in collaboration with PolyCarbone, into Brightway2.
Note

This notebook illustrates the importation of the datasets of food consumption 🍎. However, the same procedure is also applicable to the datasets of the area of consumption personal hygiene 🧼.

Source

  • Food consumption: Patouillard, L., Greffe, T., Louineau, E., Muller, E., & Bulle, C. (2023). Life cycle inventory database for consumption in Québec – Food consumption (0.1.6) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.8208610

  • Personal hygiene: Azrak, J., Patouillard, L., & Bulle, C. (2024). Life cycle inventory database for consumption in Quebec - Personal hygiene (0.1) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.10524955

More information on Brightway2 and Activity Browser

Import the LCI DB into Brightway2

Code adapted from:

Laure Patouillard

Test performed by:

Ivan Viveros Santos

Import Brightway2

from brightway2 import *

Set the global parameters to import the LCI DB into BW2

Note

In this notebook, the Excel file BDconsoQC_Food_bw2.xlsx was generated by means of the macro-enabled workbook Merge_LCI_DB_Consumption_QC.xlsm as described in section Generate an Excel file for Brightway2.

# Import parameters (defined by the user)

# The name of the target project in Brightway2
project_name_ab = "BD_conso_QC_food"

# Set the path to the LCI DB for consumption in QC 
# Here, the LCI DB is stored in the same directory of this notebook

path_to_BD_import_file = "./BDconsoQC_Food_bw2.xlsx"

# Set the names of the databases to which the LCI DB will be linked to
BD_name_biosphere = "biosphere3"
BD_name_background = "ecoinvent 3.6 cutoff"

Access the target project for the LCI DB of food consumption :

projects.set_current(project_name_ab)

Extract the datasets of the LCI DB of food consumption

xl = ExcelImporter(path_to_BD_import_file)

Apply the strategies of BW2 to import the LCI DB of food consumption

xl.apply_strategies()
xl.match_database(fields=('name','unit','location'))
xl.match_database(BD_name_biosphere, fields=('name','unit','location', 'categories'))
xl.match_database(BD_name_background, fields=('name','unit','location','reference product'))

An empty list should be returned below to confirm that all the flows are correctly linked:

# To check which flows are not linked
[i for i in xl.unlinked]

Save the LCI DB to disk

# To save the DB if all flows are linked 💾
xl.write_database()