This is a Python package designed to import external input-output databases to brightway, such as EXIOBASE. In addition, it can assist you to model different types of uncertainty analysis or scenario analysis with datapackage matrix data.
This library is developed based on Brightway2.5 and EXIOBASE3 dataset.
EXIOBASE is a global, detailed Multi-Regional Environmentally Extended Supply-Use Table (MR-SUT) and Input-Output Table (MR-IOT). It can be used to do Life Cycle Assessment(LCA) analysis. The inventory data and emission data is stored in txt
files.
EXIOBASE3 is one of the most extensive EE-MRIO systems available worldwide. EXIOBASE 3 builds upon the previous versions of EXIOBASE by using rectangular supply‐use tables (SUT) in a 163 industry by 200 products classification as the main building blocks.
Where:
- B: Biosphere matrix
- A: Technospere matrix
- I: Identity matrix
-
$f$ : Functional unit - g: Inventory
-
Perform LCA based on input-output databases (such as EXIOBASE), using Brightway.
- Perform LCA using only EXIOBASE as background system, or using EXIOBASE combined with a customizable foreground system.
- The corresponding matrices are arranged like this:
The foreground system is constructed from four matrices:fgbg
,fgfg
,bgfg
, andbifg
. These matrices are named to reflect their row and column positions. Specifically:fgfg
: This is the square matrix representing the foreground system. It includes exchanges from foreground (fg) to foreground (fg).fgbg
: This is the matrix representing all exchanges from the foreground (fg) system to the background (bg) system. Normally, this matrix is empty because the background system (database) is pre-defined and thus does not have inputs form the user-defined foreground system. So, by default this matrix is all zeros.bgfg
: This is the matrix representing all exchanges from the background (bg) to the foreground (fg) system. For example, this could be the input of “EU28-Energy” to an activity in the foreground system.bifg
: This is the matrix representing all the biosphere (bi) exchanges in the foreground (fg) system.
- The corresponding matrices are arranged like this:
- Perform LCA using only EXIOBASE as background system, or using EXIOBASE combined with a customizable foreground system.
-
Uncertainty Analysis for input-output databases.
- uniformly
- This strategy assumes that all exchanges have the same uncertainty(that is type of distribution, location, and scale). It adds this uncertainty information to all exchanges to both biosphere and technosphere matrices or the user can specify to add uncertainty only to one of them.
- columnwise
- This strategy adds the same uncertainty information to each exchange of a specific column of a matrix, but different uncertainty information to each column of a matrix. Different columns can thus have different uncertainty(that is type of distribution, location, and scale). To use this strategy, the uncertainty information should be defined in the user input file (uncertainty_file.csv).
- itemwise
- This strategy adds different uncertainty(that is type of distribution, location, and scale) to different exchanges. To use this strategy, the uncertainty information should be defined in the user input file (uncertainty_file.csv).
NOTICE:
- Supported uncertainty type: 0, 1, 2, 3, 4 (Check here to select your uncertainty type.)
- For strategy 2 and 3, only technosphere and biosphere matrices are supported.
itemwise
recommends apply only to the foreground system, considering the amount of data that introduces uncertainty for both systems. The library does not specifically handle this situation.
- uniformly
- This library was developed using Python 3.12.9.
- You need to have Brightway2.5 installed. (click here to see how to install Brightway).
- If you need to find the characterization factors through Brightway, then you need to have ecoinvent imported, otherwise, it is not necessary. (click here to see how to import ecoinvent.)
-
Open your local terminal.
(For windows, search for "Terminal/Prompt/PowerShell"; for macOS, search for "Terminal") -
Install the library.
pip install bamboo_lca
(The examples of those file is in data folder.)
-
External database file
- This is the file of your background database. For EXIOBASE, it's the
A.txt
andS.txt
.
- This is the file of your background database. For EXIOBASE, it's the
-
Foreground system file
- Reference example: foreground_system.csv
- This is the file for your foreground database, you need to prepare yourself.
- Below shows the purpose of each column. You only need to change the data instead of the column names and order.
- Activity name: includes all activity names of foreground.
- Exchange name: includes all exchange names of foreground.
- Exchange type: indicate the exchange is belongs to technosphere, biosphere or production.
- Exchange amount: indicate the amount of exchange required.
-
Uncertainty file
- Reference example: uncertainty_file.csv
- It's essentially the same as foreground system file, just add uncertainty information to the same file. You can also add it in foreground system file.
- You only need to change the data instead of the column names and order. Except the columns required in foreground system file, you also need:
- Exchange uncertainty type: indicate the type of uncertainty you are gonna experiment. (Check uncertainty types here).
- GSD: short for "Geometric Standard Deviation", used for uncertainty distribution definition.
- Exchange negative: indicate uncertainty distribution is negative or positive.
-
Characterization factor file
- Reference example: cf_mapping_file.csv
- Below shows the purpose of some columns.
- brightway code: This is the code of activity in Brightway.
- CFs: The characterization factor value.
- 1. lca_with_background.ipynb
- 2. lca_with_foreground.ipynb
- 3.1. lca_with_uniform_uncertainty.ipynb
- 3.2. lca_with_columnwise_uncertainty.ipynb
- 3.2. lca_with_itemwise_uncertainty.ipynb
There are some figures in the assets folder to help you understand the structure of the library.
If you encounter any issues or would like to contribute to the library, please contact:
- Ning An (ningan@plan.aau.dk)
- Elisabetta Pigni (elisabetta.pigni@unibo.it)
- Massimo Pizzol (massimo@plan.aau.dk)