from brightway2 import *
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.
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:
Test performed by:
Import Brightway2
Set the global parameters to import the LCI DB into BW2
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
= "BD_conso_QC_food"
project_name_ab
# Set the path to the LCI DB for consumption in QC
# Here, the LCI DB is stored in the same directory of this notebook
= "./BDconsoQC_Food_bw2.xlsx"
path_to_BD_import_file
# Set the names of the databases to which the LCI DB will be linked to
= "biosphere3"
BD_name_biosphere = "ecoinvent 3.6 cutoff" BD_name_background
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
= ExcelImporter(path_to_BD_import_file) xl
Apply the strategies of BW2 to import the LCI DB of food consumption
xl.apply_strategies()
=('name','unit','location'))
xl.match_database(fields=('name','unit','location', 'categories'))
xl.match_database(BD_name_biosphere, fields=('name','unit','location','reference product')) xl.match_database(BD_name_background, fields
An empty list should be returned below to confirm that all the flows are correctly linked:
# To check which flows are not linked
for i in xl.unlinked] [i
Save the LCI DB to disk
# To save the DB if all flows are linked 💾
xl.write_database()