BAMBOO
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.
📖 Background Knowledge
EXIOBASE
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.
Formula
$g = B (I-A)^{-1} f$.
Where:
- B: Biosphere matrix
- A: Technospere matrix
- I: Identity matrix
- $f$: Functional unit
- g: Inventory
✨ Features
-
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.
itemwiserecommends 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
👩💻 Getting Started
Requirements
- This library was developed using Python 3.12.9.
Dependencies
- 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.)
Installation
-
Open your local terminal.
(For windows, search for "Terminal/Prompt/PowerShell"; for macOS, search for "Terminal") -
Install the library.
pip install bamboo_lca
Required files
(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.txtandS.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.
Notebooks
- 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
Figures
There are some figures in the assets folder to help you understand the structure of the library.
💬 Contact
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)
Funding
This contribution is funded by the ALIGNED project (Horizon Europe, grant number 101059430).
LICENSE
This project also uses bw2data, bw_processing, and bw2calc, which are all licensed under the BSD 3-Clause License.
You may obtain a copy of the License at: https://github.com/brightway-lca/brightway2-data/blob/main/LICENSE
Metadata
Release files for bamboo-lca 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bamboo_lca-0.1.6.tar.gz | 16.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bamboo_lca-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.0 kB
Release files / bamboo_lca-0.1.6.tar.gz
| Download URL | bamboo_lca-0.1.6.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e4bc4d0badd1069bbd7c59b492d9416c1a5f2beb20fa5938d0bc3511779ee4c
|
|
BLAKE2b-256 checksum How to use checksums |
043745d97e30160e50aaecc1bcba9a26030e9ff62a4ef596798ac2012df881a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / bamboo_lca-0.1.6-py3-none-any.whl
| Download URL | bamboo_lca-0.1.6-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da9a2bbd72ee5912d698c8db842858b4817b518d58b3a362f65308be9a480431
|
|
BLAKE2b-256 checksum How to use checksums |
9f70efbd99c9fbe535c6143882169c00b0fc31c2fd2fd3e28cd9fa1a95b6354d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for bamboo-lca 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.