# Table of Contents - [Brightway LCA Software Framework — Brightway documentation](#brightway-lca-software-framework-brightway-documentation) - [Overview — Brightway documentation](#overview-brightway-documentation) - [Examples — Brightway documentation](#examples-brightway-documentation) - [FAQ — Brightway documentation](#faq-brightway-documentation) - [Support Brightway — Brightway documentation](#support-brightway-brightway-documentation) - [Contact — Brightway documentation](#contact-brightway-documentation) - [Cheat Sheet — Brightway documentation](#cheat-sheet-brightway-documentation) - [Changelog — Brightway documentation](#changelog-brightway-documentation) - [Report Bugs or Errors — Brightway documentation](#report-bugs-or-errors-brightway-documentation) - [API — Brightway documentation](#api-brightway-documentation) - [Installation — Brightway documentation](#installation-brightway-documentation) - [Contributing — Brightway documentation](#contributing-brightway-documentation) - [Credits & License — Brightway documentation](#credits-license-brightway-documentation) - [Glossary — Brightway documentation](#glossary-brightway-documentation) - [Unknown](#unknown) - [Brightway (Versions, Compatibility, etc.) — Brightway documentation](#brightway-versions-compatibility-etc-brightway-documentation) - [Brightway LCA Software Framework — Brightway documentation](#brightway-lca-software-framework-brightway-documentation) - [Projects — Brightway documentation](#projects-brightway-documentation) - [Brightway Structure — Brightway documentation](#brightway-structure-brightway-documentation) - [Error Messages — Brightway documentation](#error-messages-brightway-documentation) - [Inventory Data — Brightway documentation](#inventory-data-brightway-documentation) - [Databases — Brightway documentation](#databases-brightway-documentation) - [Brightway Software Ecosystem — Brightway documentation](#brightway-software-ecosystem-brightway-documentation) - [Compatibility — Brightway documentation](#compatibility-brightway-documentation) - [Impact Assessment — Brightway documentation](#impact-assessment-brightway-documentation) - [Inventory Graph — Brightway documentation](#inventory-graph-brightway-documentation) - [Data Management — Brightway documentation](#data-management-brightway-documentation) - [bw2io Changelog — Brightway documentation](#bw2io-changelog-brightway-documentation) - [bw2analyzer Changelog — Brightway documentation](#bw2analyzer-changelog-brightway-documentation) - [Environment Management — Brightway documentation](#environment-management-brightway-documentation) - [Matrix Construction — Brightway documentation](#matrix-construction-brightway-documentation) - [LCA Calculations — Brightway documentation](#lca-calculations-brightway-documentation) - [bw2parameters Changelog — Brightway documentation](#bw2parameters-changelog-brightway-documentation) - [bw2data Changelog — Brightway documentation](#bw2data-changelog-brightway-documentation) - [bw2calc Changelog — Brightway documentation](#bw2calc-changelog-brightway-documentation) - [Formatting Guide — Brightway documentation](#formatting-guide-brightway-documentation) - [Negative or Confusing LCA Results — Brightway documentation](#negative-or-confusing-lca-results-brightway-documentation) - [Importing Data — Brightway documentation](#importing-data-brightway-documentation) - [Importing — Brightway documentation](#importing-brightway-documentation) - [Contributing to the Code — Brightway documentation](#contributing-to-the-code-brightway-documentation) - [Exporting — Brightway documentation](#exporting-brightway-documentation) - [Ecoinvent Database — Brightway documentation](#ecoinvent-database-brightway-documentation) - [Contributing to the Documentation — Brightway documentation](#contributing-to-the-documentation-brightway-documentation) - [bw2io — Brightway documentation](#bw2io-brightway-documentation) - [Contributing to the Examples — Brightway documentation](#contributing-to-the-examples-brightway-documentation) - [SimaPro Interoperability — Brightway documentation](#simapro-interoperability-brightway-documentation) - [Updating and Upgrading — Brightway documentation](#updating-and-upgrading-brightway-documentation) - [Importing Data — Brightway documentation](#importing-data-brightway-documentation) - [Python — Brightway documentation](#python-brightway-documentation) - [Exporting Data — Brightway documentation](#exporting-data-brightway-documentation) - [bw2data — Brightway documentation](#bw2data-brightway-documentation) - [Docker Setup — Brightway documentation](#docker-setup-brightway-documentation) - [Graphical User Interface (GUI) — Brightway documentation](#graphical-user-interface-gui-brightway-documentation) - [bw2calc — Brightway documentation](#bw2calc-brightway-documentation) - [Inventory Manipulation — Brightway documentation](#inventory-manipulation-brightway-documentation) - [LCA Calculation — Brightway documentation](#lca-calculation-brightway-documentation) - [bw2analyzer — Brightway documentation](#bw2analyzer-brightway-documentation) - [Visualization — Brightway documentation](#visualization-brightway-documentation) - [bw2parameters — Brightway documentation](#bw2parameters-brightway-documentation) - [Uncertainty (Monte Carlo) — Brightway documentation](#uncertainty-monte-carlo-brightway-documentation) - [Regionalization — Brightway documentation](#regionalization-brightway-documentation) --- # Brightway LCA Software Framework — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Brightway LCA Software Framework[#](#brightway-lca-software-framework "Link to this heading") ============================================================================================== What is Brightway?[#](#what-is-brightway "Link to this heading") ----------------------------------------------------------------- Brightway is an open-source software package for [life cycle assessment](https://en.wikipedia.org/wiki/Life-cycle_assessment) (LCA) written in Python. LCA is a method for evaluating the environmental impacts of a good or service. It involves analyzing all of the inputs and outputs of a the product’s supply chain, including raw materials, energy use, and waste products, and quantifying the environmental impacts of these inputs and outputs over its life cycle. Brightway is designed to make it easy to work with large datasets and perform LCA calculations quickly and accurately. It focuses on flexibility and performance, and offers many possibilities to break the limits of conventional LCA. Brightway has a strong user community in academia, and is increasingly gaining power users from industry and consulting. How can I learn Brightway?[#](#how-can-i-learn-brightway "Link to this heading") --------------------------------------------------------------------------------- 📚 Read the Docs! Brightway has extensive documentation. This includes the theory of life-cycle assessment the the Brightway software framework. You are here! 👨‍🏫 Learn it! Brightway has step-by-step tutorials for beginners and experts alike. Learn how to use Brightway to do life-cycle assessment. Learn more [https://learn.brightway.dev/](https://learn.brightway.dev/) 💻 Try it! Brightway has a live demo in a JupyterLite development environment where you can try out Brightway without installing anything. Learn more [https://docs.brightway.dev/projects/live](https://docs.brightway.dev/projects/live) What’s New?[#](#what-s-new "Link to this heading") --------------------------------------------------- **October 2024**: New AI-powered [Algolia/DocSearch](https://docsearch.algolia.com) search engine. Thank you, @[michaelweinold](https://github.com/michaelweinold) ! **September 2024**: Updated [Cheat Sheet](content/cheatsheet/index.html) with all common Brightway commands. Thank you, @[cmutel](https://github.com/cmutel) ! **May 2024**: Initial [Cheat Sheet](content/cheatsheet/index.html) with some common Brightway commands. Thank you, @[KarinTreyer](https://github.com/KarinTreyer) and @[michaelweinold](https://github.com/michaelweinold) ! **April 2024**: New [Glossay](content/overview/glossary.html) page explaining the most important Brightway terms. Thank you, @[marc-vdm](https://github.com/marc-vdm) ! On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/index.md) ### This Page * [Show Source](_sources/index.md.txt) [Support Brightway](latest/../content/other/support.html) --- # Overview — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Overview[#](#overview "Link to this heading") ============================================== This section gives an overview on _why_ and _how_ the Brightway life cycle assessment (LCA) framework works, as well as some generic LCA methodology and implementation discussion. It is not designed for people learning about Brightway for the first time - please [see the Brightway book](https://learn.brightway.dev/) which is tailored for newcomers. Prerequisites 1. A working [installation of Brightway](../installation/index.html) . 2. Basic knowledge of [Python data types](https://docs.python.org/3/library/datatypes.html) . Note If you have questions that the documentation cannot answer, you can [get in touch with the Brightway community or the Brightway developers](../contact/contact.html) . Brightway Philosophy[#](#brightway-philosophy "Link to this heading") ---------------------------------------------------------------------- Warning Brightway is designed for flexibility, and does not place many constraints on what you are allowed to do while using it. This can be dangerous, as we will happily allow you to delete your database or enter numerical values which can break calculations. If you are first getting started, it’s safest to follow the examples and cheat sheet. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/index.md) ### This Page * [Show Source](../../_sources/content/overview/index.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Examples — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Examples[#](#examples "Link to this heading") ============================================== This section contains a collection of examples that demonstrate how to use Brightway to achieve _specific objectives_. The examples are organized by topic, and are intended to be self-contained. Each example is contained in a Jupyter Notebook, which you can download and run on your own computer. Prerequisites 1. A working [installation of Brightway](../installation/index.html) . 2. Basic knowledge of [Python data types](https://docs.python.org/3/library/datatypes.html) . Note Would you like to contribute by adding your own examples (based on your Jupyter Notebooks)? Please follow the [Examples Contribution Guide](../contributing/examples.html) . [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/index.md) ### This Page * [Show Source](../../_sources/content/examples/index.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # FAQ — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") FAQ[#](#faq "Link to this heading") ==================================== This section contains contains a collection of frequently asked questions that we have received from Brightway users and life-cycle practitioners. This might be _“what is this specific error I keep seeing”_, or _“which Brightway version do I have to use to import a specific version of a database”_. The questions are organized by topic. See also If you have questions that the documentation cannot answer, you can [get in touch with the Brightway community or the Brightway developers](../contact/contact.html) . Note Would you like to contribute by adding your questions (and answers)? Please follow the [Brightway Documentation Contribution Guide](../contributing/index.html#contributing) . [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/index.md) ### This Page * [Show Source](../../_sources/content/faq/index.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Support Brightway — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Support Brightway[#](#support-brightway "Link to this heading") ================================================================ If you would like to support the Brightway project, there are several ways to do so. Contribute to the Project[#](#contribute-to-the-project "Link to this heading") -------------------------------------------------------------------------------- Brightway is a community project, and we welcome contributions of all kinds. See the [contributing guide](../contributing/index.html#contributing) for more information. Départ de Sentier Membership[#](#depart-de-sentier-membership "Link to this heading") -------------------------------------------------------------------------------------- [Départ de Sentier](https://www.d-d-s.ch/) (abbreviated DdS) is a Swiss non-profit association which supports open sustainability assessment and public engagement. DdS organizes conferences and code, [supports teaching](https://github.com/Depart-de-Sentier/) , and rewards open software development. Membership is 25 EUR/year for students. This money goes to servers and conference organization. Cauldron[#](#cauldron "Link to this heading") ---------------------------------------------- [Cauldron](https://www.cauldron.ch/) is a Swiss company founded by the developer of the Brightway LCA ecosystem. It is building tools for sustainability assessment, with a focus on open science for life cycle assessment. It finances Brightway development with money from commercial support contracts and teaching. Clients include academic institutions such as TNO, TUM, and NTNU. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/other/support.md) ### This Page * [Show Source](../../_sources/content/other/support.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Contact — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Contact[#](#contact "Link to this heading") ============================================ The Brightway community is active and growing. There are many ways to get in touch with other users, ask questions, and get help. Note that both users and developers are active in the chat rooms and mailing lists. This means that you can get help from other users, but also that you can get help from the developers directly. Join the Discussion[#](#join-the-discussion "Link to this heading") -------------------------------------------------------------------- | Channel | Link | Description | | --- | --- | --- | | Mailing Lists | [`brightway.groups.io`](https://brightway.groups.io/) | Time-tested old-school-cool e-mail chains | | Chat Rooms | [`brightway:matrix.org`](https://matrix.to/#/#brightway:matrix.org) | Real-time chat with markdown support and end-to-end encryption | | Stack Overflow | [`tagged/brightway`](https://stackoverflow.com/questions/tagged/brightway) | Questions and answers on the most popular software development website | | Chris’ Blog | [`chris.mutel.org`](https://chris.mutel.org/) | In-depth description of developments related to Brightway | Meet and Learn in Person[#](#meet-and-learn-in-person "Link to this heading") ------------------------------------------------------------------------------ | Event | Location | Description | | --- | --- | --- | | [Brightcon Conference](http://brightcon.link) | Europe | Annual user and developer conference with hackathon and workshops | | [DdS Brightway Schools](https://www.d-d-s.ch) | Europe, Americas, Asia | Regular training courses on Brightway and LCA | ![image](../../_images/brightcon_banner.jpg) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/contact/contact.md) ### This Page * [Show Source](../../_sources/content/contact/contact.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Cheat Sheet — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Cheat Sheet[#](#cheat-sheet "Link to this heading") ==================================================== This section contains a basic list of all common Brightway commands. Prerequisites 1. A working [installation of Brightway](../installation/index.html) . 2. Basic knowledge of [Python data types](https://docs.python.org/3/library/datatypes.html) . 3. Basic understanding of matrix-based LCA data and calculations All the commands below assume you have imported the Brightway core libraries: Assumed imports import bw2analyzer as ba import bw2calc as bc import bw2data as bd import bw2io as bi We will also use the convention that `''` is a string which you need to change for your particular use case. Recommended practice Python is a flexible language, and there are many ways to do some of the following operations. We list below our _recommended_ commands to execute these common tasks, and this is the interface we will try to keep compatible with future development. We therefore encourage using these patterns, even if you are used to something different. Table of Contents[#](#table-of-contents "Link to this heading") ---------------------------------------------------------------- On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/cheatsheet/index.md) ### This Page * [Show Source](../../_sources/content/cheatsheet/index.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Changelog — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Changelog[#](#changelog "Link to this heading") ================================================ This page contains a collection of the changelog files of different Brighway packages. They contain information on eventual changes introduced in new versions and the compatibility with life-cycle inventory databases. The files are sourced automatically from their respective GitHub repositories. [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/changelog/index.md) ### This Page * [Show Source](../../_sources/content/changelog/index.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Report Bugs or Errors — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Report Bugs or Errors[#](#report-bugs-or-errors "Link to this heading") ======================================================================== Note We are sorry to find you on this page! But we are happy to help you with your problem. Please follow the steps below to report a bug or error. Errors in the Documentation[#](#errors-in-the-documentation "Link to this heading") ------------------------------------------------------------------------------------ The underlying content of the Brightway documentation website is hosted in the [GitHub repository `brightway-documentation`](https://github.com/brightway-lca/brightway-documentation) . You can therefore: ### 🥈 Report the Error[#](#report-the-error "Link to this heading") Prerequisites 1. A [GitHub account](https://github.com/signup) In order to report an error in the documentation, please [open an new issue](https://github.com/brightway-lca/brightway-documentation/issues) in this repository, describing the error and where you found it. A member of the Brightway developer community will then take care of the issue. Please note that all developments are undertaken on a voluntary basis, so it may take some time for your issue to be resolved. ### 🥇 Fix the Error Yourself[#](#fix-the-error-yourself "Link to this heading") Prerequisites 1. A [GitHub account](https://github.com/signup) 2. Basic knowledge of [the GitHub contribution workflow (fork, branch, PR)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) 3. A [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) of the [`brightway-examples`](https://github.com/brightway-lca/brightway-examples) repository 4. Basic knowledge of [Markdown](https://www.markdownguide.org/basic-syntax/) In order to fix an error in the documentation, you can make an edit of the underlying content yourself: 1. Use the `✏️ Edit on GitHub` button on the top right of the page to open the corresponding file in the GitHub repository. This shows you which file you need to edit. 2. Edit the file in your fork of the repository. Finally, create a pull request. 3. As soon as a member of the Brightway developer community has merged your pull request, the changes will be visible on the Brightway documentation website. Bugs in the Brightway Code[#](#bugs-in-the-brightway-code "Link to this heading") ---------------------------------------------------------------------------------- First you must identify which package contains the bug you have found. You can do so by examining the Python Traceback, which is the error message that is displayed when the bug occurs. The traceback will contain the name of the package that contains the bug. This could be: Traceback (most recent call last): File "", line 1, in AttributeError: module 'bw2calc' has no attribute 'ComparativeMonteCarlo' All Brightway packages are hosted in the [GitHub organization `brightway-lca`](https://github.com/brightway-lca) . You can therefore: ### 🥈 Report the Bug[#](#report-the-bug "Link to this heading") Prerequisites 1. A [GitHub account](https://github.com/signup) 2. Basic knowledge of the [Python Error Traceback](https://web.archive.org/web/20231127162411/https://realpython.com/python-traceback/) In order to report a bug in a Brightway package, please open a new issue in the corresponding repository: * [`brightway2-data`](https://github.com/brightway-lca/brightway2-data) * [`brightway2-calc`](https://github.com/brightway-lca/brightway2-calc) * [`brightway2-io`](https://github.com/brightway-lca/brightway2-io) * [`brightway2-analyzer`](https://github.com/brightway-lca/brightway2-analyzer) (all other Brightway packages can be found on the repository overview page of the [`brightway-lca` GitHub organization](https://github.com/brightway-lca?q=&type=all&language=&sort=) ) Your issue should include: 1. the complete Python Traceback 2. a description of the bug 3. information your operating system and Python version 4. the steps required to reproduce the bug A member of the Brightway developer community will then take care of the issue. Please note that all developments are undertaken on a voluntary basis, so it may take some time for your issue to be resolved. ### 🥇 Fix the Bug Yourself[#](#fix-the-bug-yourself "Link to this heading") Prerequisites 1. A [GitHub account](https://github.com/signup) 2. Basic knowledge of [the GitHub contribution workflow (fork, branch, PR)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) 3. A [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) of the relevant repository Follow the usual GitHub contribution workflow. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/contributing/bugs.md) ### This Page * [Show Source](../../_sources/content/contributing/bugs.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # API — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") API[#](#api "Link to this heading") ==================================== This page contains auto-generated API reference documentation [\[1\]](#f1) . * [bw2io](bw2io/index.html) * [bw2io.backup](bw2io/backup/index.html) * [bw2io.chemidplus](bw2io/chemidplus/index.html) * [bw2io.compatibility](bw2io/compatibility/index.html) * [bw2io.data](bw2io/data/index.html) * [bw2io.data.exiopol](bw2io/data/exiopol/index.html) * [bw2io.download\_utils](bw2io/download_utils/index.html) * [bw2io.ecoinvent](bw2io/ecoinvent/index.html) * [bw2io.errors](bw2io/errors/index.html) * [bw2io.export](bw2io/export/index.html) * [bw2io.export.csv](bw2io/export/csv/index.html) * [bw2io.export.ecospold1](bw2io/export/ecospold1/index.html) * [bw2io.export.excel](bw2io/export/excel/index.html) * [bw2io.export.gexf](bw2io/export/gexf/index.html) * [bw2io.export.matlab](bw2io/export/matlab/index.html) * [bw2io.extractors](bw2io/extractors/index.html) * [bw2io.extractors.csv](bw2io/extractors/csv/index.html) * [bw2io.extractors.ecospold1](bw2io/extractors/ecospold1/index.html) * [bw2io.extractors.ecospold1\_lcia](bw2io/extractors/ecospold1_lcia/index.html) * [bw2io.extractors.ecospold2](bw2io/extractors/ecospold2/index.html) * [bw2io.extractors.excel](bw2io/extractors/excel/index.html) * [bw2io.extractors.exiobase](bw2io/extractors/exiobase/index.html) * [bw2io.extractors.json\_ld](bw2io/extractors/json_ld/index.html) * [bw2io.extractors.simapro\_csv](bw2io/extractors/simapro_csv/index.html) * [bw2io.extractors.simapro\_lcia\_95project\_csv](bw2io/extractors/simapro_lcia_95project_csv/index.html) * [bw2io.extractors.simapro\_lcia\_csv](bw2io/extractors/simapro_lcia_csv/index.html) * [bw2io.importers](bw2io/importers/index.html) * [bw2io.importers.base](bw2io/importers/base/index.html) * [bw2io.importers.base\_lci](bw2io/importers/base_lci/index.html) * [bw2io.importers.base\_lcia](bw2io/importers/base_lcia/index.html) * [bw2io.importers.ecoinvent\_lcia](bw2io/importers/ecoinvent_lcia/index.html) * [bw2io.importers.ecospold1](bw2io/importers/ecospold1/index.html) * [bw2io.importers.ecospold1\_lcia](bw2io/importers/ecospold1_lcia/index.html) * [bw2io.importers.ecospold2](bw2io/importers/ecospold2/index.html) * [bw2io.importers.ecospold2\_biosphere](bw2io/importers/ecospold2_biosphere/index.html) * [bw2io.importers.excel](bw2io/importers/excel/index.html) * [bw2io.importers.excel\_lcia](bw2io/importers/excel_lcia/index.html) * [bw2io.importers.exiobase3\_hybrid](bw2io/importers/exiobase3_hybrid/index.html) * [bw2io.importers.exiobase3\_monetary](bw2io/importers/exiobase3_monetary/index.html) * [bw2io.importers.json\_ld](bw2io/importers/json_ld/index.html) * [bw2io.importers.json\_ld\_lcia](bw2io/importers/json_ld_lcia/index.html) * [bw2io.importers.simapro\_block\_csv](bw2io/importers/simapro_block_csv/index.html) * [bw2io.importers.simapro\_csv](bw2io/importers/simapro_csv/index.html) * [bw2io.importers.simapro\_lcia\_csv](bw2io/importers/simapro_lcia_csv/index.html) * [bw2io.migrations](bw2io/migrations/index.html) * [bw2io.modified\_database](bw2io/modified_database/index.html) * [bw2io.package](bw2io/package/index.html) * [bw2io.remote](bw2io/remote/index.html) * [bw2io.strategies](bw2io/strategies/index.html) * [bw2io.strategies.biosphere](bw2io/strategies/biosphere/index.html) * [bw2io.strategies.csv](bw2io/strategies/csv/index.html) * [bw2io.strategies.ecospold1\_allocation](bw2io/strategies/ecospold1_allocation/index.html) * [bw2io.strategies.ecospold2](bw2io/strategies/ecospold2/index.html) * [bw2io.strategies.exiobase](bw2io/strategies/exiobase/index.html) * [bw2io.strategies.generic](bw2io/strategies/generic/index.html) * [bw2io.strategies.json\_ld](bw2io/strategies/json_ld/index.html) * [bw2io.strategies.json\_ld\_allocation](bw2io/strategies/json_ld_allocation/index.html) * [bw2io.strategies.json\_ld\_lcia](bw2io/strategies/json_ld_lcia/index.html) * [bw2io.strategies.lcia](bw2io/strategies/lcia/index.html) * [bw2io.strategies.locations](bw2io/strategies/locations/index.html) * [bw2io.strategies.migrations](bw2io/strategies/migrations/index.html) * [bw2io.strategies.parameterization](bw2io/strategies/parameterization/index.html) * [bw2io.strategies.products](bw2io/strategies/products/index.html) * [bw2io.strategies.sentier](bw2io/strategies/sentier/index.html) * [bw2io.strategies.sentier.simapro\_units](bw2io/strategies/sentier/simapro_units/index.html) * [bw2io.strategies.simapro](bw2io/strategies/simapro/index.html) * [bw2io.strategies.special](bw2io/strategies/special/index.html) * [bw2io.strategies.useeio](bw2io/strategies/useeio/index.html) * [bw2io.units](bw2io/units/index.html) * [bw2io.unlinked\_data](bw2io/unlinked_data/index.html) * [bw2io.utils](bw2io/utils/index.html) * [bw2data](bw2data/index.html) * [bw2data.backends](bw2data/backends/index.html) * [bw2data.backends.base](bw2data/backends/base/index.html) * [bw2data.backends.iotable](bw2data/backends/iotable/index.html) * [bw2data.backends.iotable.backend](bw2data/backends/iotable/backend/index.html) * [bw2data.backends.iotable.proxies](bw2data/backends/iotable/proxies/index.html) * [bw2data.backends.proxies](bw2data/backends/proxies/index.html) * [bw2data.backends.schema](bw2data/backends/schema/index.html) * [bw2data.backends.typos](bw2data/backends/typos/index.html) * [bw2data.backends.utils](bw2data/backends/utils/index.html) * [bw2data.backends.wurst\_extraction](bw2data/backends/wurst_extraction/index.html) * [bw2data.compat](bw2data/compat/index.html) * [bw2data.configuration](bw2data/configuration/index.html) * [bw2data.data\_store](bw2data/data_store/index.html) * [bw2data.database](bw2data/database/index.html) * [bw2data.errors](bw2data/errors/index.html) * [bw2data.fatomic](bw2data/fatomic/index.html) * [bw2data.filesystem](bw2data/filesystem/index.html) * [bw2data.ia\_data\_store](bw2data/ia_data_store/index.html) * [bw2data.logs](bw2data/logs/index.html) * [bw2data.meta](bw2data/meta/index.html) * [bw2data.method](bw2data/method/index.html) * [bw2data.parameters](bw2data/parameters/index.html) * [bw2data.project](bw2data/project/index.html) * [bw2data.proxies](bw2data/proxies/index.html) * [bw2data.query](bw2data/query/index.html) * [bw2data.revisions](bw2data/revisions/index.html) * [bw2data.search](bw2data/search/index.html) * [bw2data.search.indices](bw2data/search/indices/index.html) * [bw2data.search.schema](bw2data/search/schema/index.html) * [bw2data.search.search](bw2data/search/search/index.html) * [bw2data.serialization](bw2data/serialization/index.html) * [bw2data.signals](bw2data/signals/index.html) * [bw2data.snowflake\_ids](bw2data/snowflake_ids/index.html) * [bw2data.sqlite](bw2data/sqlite/index.html) * [bw2data.string\_distance](bw2data/string_distance/index.html) * [bw2data.subclass\_mapping](bw2data/subclass_mapping/index.html) * [bw2data.updates](bw2data/updates/index.html) * [bw2data.utils](bw2data/utils/index.html) * [bw2data.validate](bw2data/validate/index.html) * [bw2data.weighting\_normalization](bw2data/weighting_normalization/index.html) * [bw2calc](bw2calc/index.html) * [bw2calc.caching\_lca](bw2calc/caching_lca/index.html) * [bw2calc.dense\_lca](bw2calc/dense_lca/index.html) * [bw2calc.dictionary\_manager](bw2calc/dictionary_manager/index.html) * [bw2calc.errors](bw2calc/errors/index.html) * [bw2calc.grid](bw2calc/grid/index.html) * [bw2calc.iterative\_lca](bw2calc/iterative_lca/index.html) * [bw2calc.lca](bw2calc/lca/index.html) * [bw2calc.lca\_base](bw2calc/lca_base/index.html) * [bw2calc.least\_squares](bw2calc/least_squares/index.html) * [bw2calc.log\_utils](bw2calc/log_utils/index.html) * [bw2calc.method\_config](bw2calc/method_config/index.html) * [bw2calc.multi\_lca](bw2calc/multi_lca/index.html) * [bw2calc.restricted\_sparse\_matrix\_dict](bw2calc/restricted_sparse_matrix_dict/index.html) * [bw2calc.result\_cache](bw2calc/result_cache/index.html) * [bw2calc.single\_value\_diagonal\_matrix](bw2calc/single_value_diagonal_matrix/index.html) * [bw2calc.utils](bw2calc/utils/index.html) * [bw2analyzer](bw2analyzer/index.html) * [bw2analyzer.comparisons](bw2analyzer/comparisons/index.html) * [bw2analyzer.contribution](bw2analyzer/contribution/index.html) * [bw2analyzer.econ](bw2analyzer/econ/index.html) * [bw2analyzer.health\_check](bw2analyzer/health_check/index.html) * [bw2analyzer.lci](bw2analyzer/lci/index.html) * [bw2analyzer.matrix\_grapher](bw2analyzer/matrix_grapher/index.html) * [bw2analyzer.page\_rank](bw2analyzer/page_rank/index.html) * [bw2analyzer.report](bw2analyzer/report/index.html) * [bw2analyzer.sc\_graph](bw2analyzer/sc_graph/index.html) * [bw2analyzer.tagged](bw2analyzer/tagged/index.html) * [bw2analyzer.utils](bw2analyzer/utils/index.html) * [bw2parameters](bw2parameters/index.html) * [bw2parameters.errors](bw2parameters/errors/index.html) * [bw2parameters.interpreter](bw2parameters/interpreter/index.html) * [bw2parameters.mangling](bw2parameters/mangling/index.html) * [bw2parameters.parameter\_set](bw2parameters/parameter_set/index.html) * [bw2parameters.pint](bw2parameters/pint/index.html) * [bw2parameters.utils](bw2parameters/utils/index.html) [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/api/index.rst) ### This Page * [Show Source](../../_sources/content/api/index.rst.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Installation — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Installation[#](#installation "Link to this heading") ====================================================== Brightway can be installed using the [Python package installer `pip`](https://pypi.org/project/pip/) or the multi-language package management system [conda](https://docs.conda.io/en/latest/) and its friend [mamba](https://mamba.readthedocs.io/en/latest/) . Note Brightway supports Python >=3.9. This guide is for the current stable Brightway 2.5 release; see the [difference between `brightway2` and `brightway 25`](../faq/brightway.html) . Installing Brightway using `pip`[#](#installing-brightway-using-pip "Link to this heading") -------------------------------------------------------------------------------------------- Linux, Windows, or MacOS (x64) 1. Install `python` from [the website](https://www.python.org/downloads/) , your system package manager, or [Homebrew](https://docs.brew.sh/Homebrew-and-Python) . 2. Create a directory for your virtual environments, such as `C:/Users/me/virtualenvs/` 3. In a console or terminal window, create a new virtual environment.: python -m venv C:/Users/me/virtualenvs/brightway 4. Activate the virtual environment. The exact syntax depends on your operating system; it will look something like: source C:/Users/me/virtualenvs/brightway/bin/activate 5. Install Brightway: pip install brightway25 pypardiso Note that `brightway25` is just an easy way to install libraries; it doesn’t provide any functionality, and you shouldn’t import it in Python scripts. You can also use pip to install useful libraries like `jupyterlab`. MacOS (Apple Silicon/ARM) Note Due to [an upstream bug](https://github.com/scikit-umfpack/scikit-umfpack/issues/98) , there is currently no reliable way to install the fast sparse library `umfpack` on Apple Silicon using `pip`, and the `pypardiso` library is only for x64 systems. If you are doing computationally-intensive workflows, we recommend installing Brightway using `conda` or `mamba` for now. If you are doing fewer calculations or software development installation via `pip` is fine. 1. Install `python` from [the website](https://www.python.org/downloads/) , your system package manager, or [Homebrew](https://docs.brew.sh/Homebrew-and-Python) . 2. In a terminal window, create a directory for your virtual environments. This can be anywhere; we will use the home directory here as an example: cd mkdir virtualenvs 3. Create and activate a virtualenv: python -m venv virtualenvs/brightway source virtualenvs/brightway/bin/activate 4. Install Brightway: pip install brightway25 Note that `brightway25` is just an easy way to install libraries; it doesn’t provide any functionality, and you shouldn’t import it in Python scripts. You can also use pip to install useful libraries like `jupyterlab`. Installing Brightway using `conda` or `mamba`[#](#installing-brightway-using-conda-or-mamba "Link to this heading") -------------------------------------------------------------------------------------------------------------------- Prerequisites 1. A working installation of [`conda`](https://docs.conda.io/en/latest/) or `mamba`. If you are using `conda`, we recommend installing the [libmamba solver](https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community) . 2. Basic knowledge of [Conda environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) Linux, Windows, or MacOS (x64) 1. Create a new Conda environment (in this example named `brightway`): conda create -n brightway -c conda-forge -c cmutel brightway25 2. Activate the environment: conda activate brightway 3. (Optional but recommended) You can also use conda to install useful libraries like `jupyterlab`: conda install -c conda-forge jupyterlab macOS (Apple Silicon/ARM) Note Brightway runs on the new Apple Silicon ARM architecture. However, the super-fast linear algebra software library `pypardiso` is not compatible with the ARM processor architecture. To avoid critical errors during instruction that would break core functionality, a different version of Brightway (`brightway25_nosolver`) and a a different linear algebra software library (`scikit-umfpack`) must be installed. 1. Create a new Conda environment (in this example named `brightway`): conda create \-n brightway \-c conda\-forge \-c cmutel brightway25\_nosolver scikit\-umfpack numpy"<1.25" 2. Activate the environment: conda activate brightway 3. (Optional but recommended) You can also use conda to install useful libraries like `jupyterlab`: conda install -c conda-forge jupyterlab On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/installation/index.md) ### This Page * [Show Source](../../_sources/content/installation/index.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Contributing — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Contributing[#](#contributing "Link to this heading") ====================================================== This section contains contains information on how to contribute to Brightway. This might be reporting specific errors or bugs, or contributing directly to the source code. It also specifies the style in which documentation and code should be written. See also If you have questions that the documentation cannot answer, you can [get in touch with the Brightway community or the Brightway developers](../contact/contact.html) . [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/contributing/index.md) ### This Page * [Show Source](../../_sources/content/contributing/index.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Credits & License — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Credits & License[#](#credits-license "Link to this heading") ============================================================== Brightway was originally developed by [Chris Mutel](https://mutel.org/) during his doctoral research project. Brightway would have been possible without the incredibly generous support of [Professor Stefanie Hellweg](http://www.esd.ifu.ethz.ch/the-group/people/person-detail.html?persid=63817) of ETH Zürich. Today, Brightway is a highly active software ecosystem maintained by developers and life-cycle practitioners from academia and industry. Citation[#](#citation "Link to this heading") ---------------------------------------------- If you use Brighway in your academic research, please cite the [primary publication in the Journal of Open Source Software](https://joss.theoj.org/papers/10.21105/joss.00236) : [![DOI](https://img.shields.io/badge/JOSS-10.21105%2Fjoss.00236-orange.svg?style=flat&logo=Open%20Access&logoColor=white)](https://doi.org/10.21105/joss.00236) > Mutel, C. 2017. Brightway: An open source framework for Life Cycle Assessment. Journal of Open Source Software, 12:2. https://doi.org/10.21105%2Fjoss.00236. Authors[#](#authors "Link to this heading") -------------------------------------------- | Name | Contributions | | --- | --- | | [Chris Mutel](http://chris.mutel.org/) | [creator](https://en.wikipedia.org/wiki/Benevolent_dictator_for_life)
[of `brightway-lca`](https://github.com/brightway-lca) | | [Adrian Haas](https://www.ethz.ch/content/specialinterest/baug/institute-ifu/institute-ifu/en/das-institut/personen/personen-detail.html?persid=171851) | | | [Giuseppe Cardellini](http://www.kuleuven.be/wieiswie/en/person/90387) | | | Andreas Froemelt | | | [Niko Heeren](https://environment.yale.edu/profile/niko-heeren/) | | | Aurelian Jaggi | | | Maghimai Marcus | | | [Marie de Saxcé](http://lca-net.com/about/who-we-are/) | | | [Low Kian Seong](https://bitbucket.org/lowks) | | | [Bernhard Steubing](https://www.researchgate.net/profile/Maghimai_Marcus2) | | | [Pascal Lesage](http://www.polymtl.ca/recherche/rc/en/professeurs/details.php?NoProf=551) | | | [Manuel Klarmann](https://twitter.com/mklarmann) | | | [Tomás Navarrete Gutiérrez](https://www.linkedin.com/in/tom4m3) | | | Guillaume Audard | | | [Benjamin Portner](https://www.researchgate.net/profile/Benjamin_Portner) | | | Jan Machacek | | | Paul Baustert | | | Aleksandra Kim | | | [Michael Weinold](https://michael.weinold.ch) | [`brightway-documentation`](https://github.com/brightway-lca/brightway-documentation)

[`brightway-live`](https://github.com/brightway-lca/brightway-live)

[`brightway-book`](https://github.com/brightway-lca/brightway-book) | License[#](#license "Link to this heading") -------------------------------------------- Different parts of the Brightway software are licensed under variations of the the [BSD license](http://opensource.org/licenses/BSD-3-Clause) . For more information, compare the license files in the respective repositories. The most recent general license terms: Copyright © 2024, Brightway Developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of ETH Zurich or Paul Scherrer Institute nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/other/credits.md) ### This Page * [Show Source](../../_sources/content/other/credits.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Glossary — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Glossary[#](#glossary "Link to this heading") ============================================== LCA Terms[#](#lca-terms "Link to this heading") ------------------------------------------------ Activity[#](#term-Activity "Link to this term") An `activity` in Brightway is the name used for both processes and elementary flows. Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `activity` | | ISO | `(unit) process` or `elementary flow`[\[1\]](#id5) | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | `Activity` | Production Exchange[#](#term-Production-Exchange "Link to this term") This is what is produced or supplied by the `activity` (e.g. manufacturing of a product, provisioning of waste treatment services, etc.). Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `production exchange` | | ISO | `product`[\[2\]](#id6) | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | `Determining Flow` | Technosphere Exchange[#](#term-Technosphere-Exchange "Link to this term") An exchange between two technosphere `activities`. Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `technosphere exchange` | | ISO | `intermediate flow` | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | `Flow` | Characterization Factor[#](#term-Characterization-Factor "Link to this term") A biosphere `exchange` characterized (scaled) to a unit. Impact Assessment Method[#](#term-Impact-Assessment-Method "Link to this term") A set of `characterization factors`. Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `method` | | ISO | `impact category` | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | N/A | LCI[#](#term-LCI "Link to this term") Life Cycle Inventory. Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `LCA` | | ISO | `LCI` | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | N/A | Demand[#](#term-Demand "Link to this term") The demand from the system to calculate for (e.g. “one kilogram of steel”, etc.). Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `demand` | | ISO | `functional unit` | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | `Reference Unit` | Graph[#](#graph "Link to this heading") ---------------------------------------- Project[#](#term-Project "Link to this term") A Brightway project is an isolated set of data sufficient to do LCA calculations. In the core Brightway libraries, each project is implemented as a separate subdirectory with a SQLite3 database and directory for datapackages. Graph[#](#term-Graph "Link to this term") A graph is a collection of nodes, and edges which connect those nodes. Brightway uses the graph to store inventory and impact assessment information, and allows you to store additional information via the use of custom nodes. Node[#](#term-Node "Link to this term") The nouns in a graph. Nodes can have any type, but are normally processes, products, biosphere flows, and impact categories. There can be special kinds of process nodes, such as “multifunctional” and “process\_with\_reference\_product”. The _type_ of the node determines what fields are required in that node. You can add custom node types to store arbitrary data in the graph. Edge[#](#term-Edge "Link to this term") The verbs in a graph. In Brightway, all edges have directed, i.e. they have a source and a target. Inventory and impact assessment edges must be numeric, but custom edges don’t need to be. Functional edge[#](#term-Functional-edge "Link to this term") A functional edge is an edge which expresses the function of the process to which it is attached. As practitioners, we make an active choice to model some processes and not others - we need to choose what is included, what is excluded, and the level of granularity needed to reflect physical reality. We choose to model certain activities because they achieve a certain function - either the production of a good, or the handling of a waste. A functional edge can therefore be an input _or_ an output of a process, and functionality is attached to the edge, as products can be functional in some contexts but not in others. In other words, one process may produce a waste (non-functional - not the intended purpose of that process, nor the main reason to model it), and the edge from the process to the waste product edge is non-functional. The waste needs to go somewhere, and the edge from waste product to the treatment process _is_ functional, even though it is an input to the waste treatment process. Processes can have more than one functional edge. Database[#](#term-Database "Link to this term") A Brightway database is a container for inventory nodes. Databases are primarily organization tools, and their precise boundaries are determined by practitioners. Nodes must be associated with one and only one database, but edges can and often do cross from one database to another. Brightway does not make a distinction between foreground and background databases. Process[#](#term-Process "Link to this term") An `process` in Brightway is the name used for both processes and elementary flows. Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `activity` | | ISO | `(unit) process` or `elementary flow`[\[1\]](#id5) | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | `Activity` | Multifunctional process[#](#term-Multifunctional-process "Link to this term") A process which has more than one functional edge. Impact Category[#](#term-Impact-Category "Link to this term") A set of `characterization factors` and associated metadata. The Brightway class name is `Method`, but this is not technically correct, does not follow ISO, and we encourage and will use the term “Impact Category”. Other terms used frequently: Calculations[#](#calculations "Link to this heading") ------------------------------------------------------ Functional unit[#](#term-Functional-unit "Link to this term") The demand of goods and services used in a given calculation. A functional unit is made up of products, not processes, although it can include chimaera process+product objects when they act as a product. Functional units can have more than one product. Datapackage[#](#term-Datapackage "Link to this term") The numerical data in a `Database`, `Impact Category`, `Normalization`, or `Weighting` written as [numpy](https://numpy.org/) arrays and [record arrays](https://numpy.org/doc/stable/user/basics.rec.html) . Follows the Open Knowledge Foundation’s [datapackage standard](https://datapackage.org/) , and includes metadata like author, license, and version. Can optionally include metadata on the graph. A datapackage contains all information needed to do matrix calculations. They can also represent uncertainty and scenarios in powerful but complex ways which open a lot of modelling flexibility. Technosphere Exchange[#](#term-0 "Link to this term") An exchange between two technosphere `activities`. Other terms used frequently: | Source | Terminology | | --- | --- | | Brightway | `technosphere exchange` | | ISO | `intermediate flow` | | [Ghose et al. (2021)](https://doi.org/10.1111/jiec.13220) | `Flow` | * * * On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/glossary.md) ### This Page * [Show Source](../../_sources/content/overview/glossary.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Unknown \# Brightway LCA Software Framework ## What is Brightway? Brightway is an open-source software package for \[life cycle assessment\](https://en.wikipedia.org/wiki/Life-cycle\_assessment) (LCA) written in Python. LCA is a method for evaluating the environmental impacts of a good or service. It involves analyzing all of the inputs and outputs of a the product's supply chain, including raw materials, energy use, and waste products, and quantifying the environmental impacts of these inputs and outputs over its life cycle. Brightway is designed to make it easy to work with large datasets and perform LCA calculations quickly and accurately. It focuses on flexibility and performance, and offers many possibilities to break the limits of conventional LCA. Brightway has a strong user community in academia, and is increasingly gaining power users from industry and consulting. ## How can I learn Brightway? ::::{grid} 1 1 3 3 :gutter: 3 :::{grid-item-card} 📚 Read the Docs! Brightway has extensive documentation. This includes the theory of life-cycle assessment the the Brightway software framework. +++ You are here! ::: :::{grid-item-card} 👨‍🏫 Learn it! :link: https://learn.brightway.dev/ :link-type: url Brightway has step-by-step tutorials for beginners and experts alike. Learn how to use Brightway to do life-cycle assessment. +++ Learn more {fas}\`arrow-right\` ::: :::{grid-item-card} 💻 Try it! :link: https://docs.brightway.dev/projects/live :link-type: url Brightway has a live demo in a JupyterLite development environment where you can try out Brightway without installing anything. +++ Learn more {fas}\`arrow-right\` ::: :::: ## What's New? \_\_October 2024\_\_: New AI-powered \[Algolia/DocSearch\](https://docsearch.algolia.com) search engine. Thank you, @\[michaelweinold\](https://github.com/michaelweinold)! \\ \_\_September 2024\_\_: Updated \[Cheat Sheet\](./content/cheatsheet/index.md) with all common Brightway commands. Thank you, @\[cmutel\](https://github.com/cmutel)! \\ \_\_May 2024\_\_: Initial \[Cheat Sheet\](./content/cheatsheet/index.md) with some common Brightway commands. Thank you, @\[KarinTreyer\](https://github.com/KarinTreyer) and @\[michaelweinold\](https://github.com/michaelweinold)! \\ \_\_April 2024\_\_: New \[Glossay\](./content/overview/glossary.md) page explaining the most important Brightway terms. Thank you, @\[marc-vdm\](https://github.com/marc-vdm)! \`\`\`{toctree} --- hidden: maxdepth: 1 --- content/installation/index content/cheatsheet/index content/overview/index content/examples/index content/faq/index content/api/index content/contact/contact content/contributing/index content/other/framework content/other/support content/other/credits content/changelog/index \`\`\` --- # Brightway (Versions, Compatibility, etc.) — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Brightway (Versions, Compatibility, etc.)[#](#brightway-versions-compatibility-etc "Link to this heading") =========================================================================================================== Versions and Compatibility[#](#versions-and-compatibility "Link to this heading") ---------------------------------------------------------------------------------- ### Versions[#](#versions "Link to this heading") #### Brightway 1[#](#brightway-1 "Link to this heading") Brightway (originally without a version number, here referred to as version 1) was originally developed by Chris Mutel as part of his doctoral research in [the group of Prof. Stefanie Hellweg](https://ifu.ethz.ch/) [\[1\]](#id2) . It is no longer available for download. #### Brightway 2 (`Brightway2`)[#](#brightway-2-brightway2 "Link to this heading") Note Learn about upgrading your Brightway 1 projects to Brightway 2 [here](#../setup/upgrading.md) . Brightway2 was a complete rewrite of the oBrightway 1. It is the most widely used version of Brightway. Warning Brightway2 is currently the _only_ version of Brightway that is compatible with the [ActivityBrowser graphical user interface](#../setup/ui.md) . #### Brightway 2.5 (`Brightway25`)[#](#brightway-2-5-brightway25 "Link to this heading") Note Learn about upgrading your Brightway 2 projects to Brightway 2.5 [here](#../setup/upgrading.md) . > Brightway 2.5 is the next generation of the [Brightway2](https://brightway.dev/) > framework for life cycle assessment. It provides new capabilities for cloud computing and model interaction, with the use of a new [processed data library](https://github.com/brightway-lca/bw_processing) > and a separation between the calculation library and a library for [matrix construction and manipulation](https://github.com/brightway-lca/matrix_utils) > . – from the [Brightway 2.5 repository readme file](https://github.com/brightway-lca/brightway25) Brightway 2.5 is the next step on the way to the next version of Brightway, as detailed in the [Brightway Strategic Development Plan](https://github.com/brightway-lca/enhancement-proposals/blob/main/Brightway%20strategic%20development%20plan.md) . In practice, this means that the meta-packages `brightway-lca/brightway2` and `brightway-lca/brightway25` will install different versions of the Brightway packages. For instance: | package | Brightway 2 version | Brightway 2.5 version | | --- | --- | --- | | `bw2analyzer` | < 0.10.99 | \>= 0.11.1 | | `bw2calc` | < 1.8.1 | \>= 2.0.dev5 | | `bw2data` | < 3.99 | \>= 4.0.dev11 | | `bw2io` | < 0.8.9 | \>= 0.9.dev6 | This is specified in the respective `setup.py` files: [Brightway25 packages](https://github.com/brightway-lca/brightway25/blob/main/setup.py) and [Brightway2 packages](https://github.com/brightway-lca/brightway2/blob/master/setup.py) . Technical Stack[#](#technical-stack "Link to this heading") ------------------------------------------------------------ ### Storing Python objects in a SQLite3 database is silly! Why not use _X_ document database?[#](#storing-python-objects-in-a-sqlite3-database-is-silly-why-not-use-x-document-database "Link to this heading") Where _X_ is one of [MongoDB](https://www.mongodb.com) , [CouchDB](http://couchdb.apache.org/) , [UnQLite](https://unqlite-python.readthedocs.io/en/latest/) , [Vedis](https://vedis-python.readthedocs.io/en/latest/) , [CDB](https://cr.yp.to/cdb.html) , [TinyDB](http://tinydb.readthedocs.io/en/latest/intro.html) , etc. This approach may seem strange at first, but is the result of coding, evaluating, and ultimately rejecting several alternatives. Most document databases can’t store all Python objects directly, because they use JSON or some other serialization. We have actually built and tested database backends built on pickle files, JSON files, MongoDB CodernityDB and BlitzDB. SQLite3 also has several real advantages: * Most importantly, it is included with Python, no new dependencies or installation steps are required. * It is famous for being well tested, and is completely cross-platform. * It is also more than fast enough. For example, loading every activity from ecoinvent 3+ takes only a few seconds. * * * On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/brightway.md) ### This Page * [Show Source](../../_sources/content/faq/brightway.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Brightway LCA Software Framework — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Brightway LCA Software Framework[#](#brightway-lca-software-framework "Link to this heading") ============================================================================================== What is Brightway?[#](#what-is-brightway "Link to this heading") ----------------------------------------------------------------- Brightway is an open-source software package for [life cycle assessment](https://en.wikipedia.org/wiki/Life-cycle_assessment) (LCA) written in Python. LCA is a method for evaluating the environmental impacts of a good or service. It involves analyzing all of the inputs and outputs of a the product’s supply chain, including raw materials, energy use, and waste products, and quantifying the environmental impacts of these inputs and outputs over its life cycle. Brightway is designed to make it easy to work with large datasets and perform LCA calculations quickly and accurately. It focuses on flexibility and performance, and offers many possibilities to break the limits of conventional LCA. Brightway has a strong user community in academia, and is increasingly gaining power users from industry and consulting. How can I learn Brightway?[#](#how-can-i-learn-brightway "Link to this heading") --------------------------------------------------------------------------------- 📚 Read the Docs! Brightway has extensive documentation. This includes the theory of life-cycle assessment the the Brightway software framework. You are here! 👨‍🏫 Learn it! Brightway has step-by-step tutorials for beginners and experts alike. Learn how to use Brightway to do life-cycle assessment. Learn more [https://learn.brightway.dev/](https://learn.brightway.dev/) 💻 Try it! Brightway has a live demo in a JupyterLite development environment where you can try out Brightway without installing anything. Learn more [https://docs.brightway.dev/projects/live](https://docs.brightway.dev/projects/live) What’s New?[#](#what-s-new "Link to this heading") --------------------------------------------------- **October 2024**: New AI-powered [Algolia/DocSearch](https://docsearch.algolia.com) search engine. Thank you, @[michaelweinold](https://github.com/michaelweinold) ! **September 2024**: Updated [Cheat Sheet](content/cheatsheet/index.html) with all common Brightway commands. Thank you, @[cmutel](https://github.com/cmutel) ! **May 2024**: Initial [Cheat Sheet](content/cheatsheet/index.html) with some common Brightway commands. Thank you, @[KarinTreyer](https://github.com/KarinTreyer) and @[michaelweinold](https://github.com/michaelweinold) ! **April 2024**: New [Glossay](content/overview/glossary.html) page explaining the most important Brightway terms. Thank you, @[marc-vdm](https://github.com/marc-vdm) ! On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/index.md) ### This Page * [Show Source](_sources/index.md.txt) [Support Brightway](latest/../content/other/support.html) --- # Projects — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Projects[#](#projects "Link to this heading") ============================================== Project Activation and Manipulation[#](#project-activation-and-manipulation "Link to this heading") ---------------------------------------------------------------------------------------------------- ### How do I see the currently active project?[#](#how-do-i-see-the-currently-active-project "Link to this heading") bd.projects.current ### How do I activate a project?[#](#how-do-i-activate-a-project "Link to this heading") bd.projects.set\_current(name\='') ### How do I copy the currently active project?[#](#how-do-i-copy-the-currently-active-project "Link to this heading") bd.projects.copy\_project(name\='') ### How do I delete a project?[#](#how-do-i-delete-a-project "Link to this heading") bd.projects.delete\_project(name\='', delete\_dir\=True or False) `delete_dir` will delete the project’s data; if `False`, then we remove the project name from the list of project names, but you can still switch back to the project and use the saved data. ### How do I list all my projects?[#](#how-do-i-list-all-my-projects "Link to this heading") sorted(bd.projects) ### How do I rename an existing project?[#](#how-do-i-rename-an-existing-project "Link to this heading") bd.projects.rename("") Creating Initial Project Data[#](#creating-initial-project-data "Link to this heading") ---------------------------------------------------------------------------------------- ### How do I create a new project with basic data on elementary flows and LCIA?[#](#how-do-i-create-a-new-project-with-basic-data-on-elementary-flows-and-lcia "Link to this heading") To create a new project with some basic data: bi.remote.install\_project('', '') Where `` is one of: * ecoinvent-3.10-biosphere * ecoinvent-3.8-biosphere * ecoinvent-3.9.1-biosphere * forwast * USEEIO-1.1 The ecoinvent biosphere projects also include LCIA impact categories. We welcome the contribution of other taxonomies and data! Warning The setup function `bw2setup()` is deprecated and should no longer be used. Archiving, Restoring, and Sharing Projects[#](#archiving-restoring-and-sharing-projects "Link to this heading") ---------------------------------------------------------------------------------------------------------------- ### How do I backup an existing project?[#](#how-do-i-backup-an-existing-project "Link to this heading") bi.backup.backup\_project\_directory( project\='', dir\_backup\='' ) See [`bw2io.backup.backup_project_directory`](../api/bw2io/backup/index.html#bw2io.backup.backup_project_directory "bw2io.backup.backup_project_directory") for more information. ### How do I restore a project from a backup?[#](#how-do-i-restore-a-project-from-a-backup "Link to this heading") bi.backup.restore\_project\_directory( fp\='', project\_name\='' ) See [`bw2io.backup.restore_project_directory`](../api/bw2io/backup/index.html#bw2io.backup.restore_project_directory "bw2io.backup.restore_project_directory") for more information and customization options. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/cheatsheet/projects.md) ### This Page * [Show Source](../../_sources/content/cheatsheet/projects.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Brightway Structure — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Brightway Structure[#](#brightway-structure "Link to this heading") ==================================================================== Brightway Objects[#](#brightway-objects "Link to this heading") ---------------------------------------------------------------- Data in Brightway is structured in a hierarchy. At the top level, we have projects. A project is self-contained, with its own copy of data, LCIA methods, calculations, assumptions, and any other data you need. Each project is completely independent of other projects.Projects are saved as subdirectories in the file system. Inside a project we have a number of objects that store data. The most common data objects are inventory _databases_ and impact assessment _methods_. However, non-LCA data can also be included. For example, a set of vehicle registrations and lifetimes could also be stored in a project, and used to generate fleet-based scenarios for sustainability assessment of mobility services. ![image](../../_images/org-scheme.png) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/structure.md) ### This Page * [Show Source](../../_sources/content/overview/structure.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Error Messages — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Error Messages[#](#error-messages "Link to this heading") ========================================================== How do I resolve Unicode Errors?[#](#how-do-i-resolve-unicode-errors "Link to this heading") --------------------------------------------------------------------------------------------- A typical error message is: UnicodeEncodeError: 'ascii' codec can't encode character u'\\xe1' in position 426: ordinal not in range(128) All strings should be unicode. In Python 2.7, they have a `u` in front of the string, like `u"foo"`; in Python 3, all strings are unicode. If you are careful to make sure your data is unicode, you shouldn’t have this problem. Also, unless you are reading this in 2019 or earlier, you should not be using Python 2. You can specify the encoding of text in your python files as UTF-8 by putting the following as the _first line_ in each file: `# -*- coding: utf-8 -*-` On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/error_messages.md) ### This Page * [Show Source](../../_sources/content/faq/error_messages.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Inventory Data — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Inventory Data[#](#inventory-data "Link to this heading") ========================================================== Processes, Products, and Something in Between[#](#processes-products-and-something-in-between "Link to this heading") ---------------------------------------------------------------------------------------------------------------------- At its heart, Brightway uses a graph data schema with nodes and edges. We are eventually moving towards storing everything in the graph, including databases and LCIA data, but for now our graph just has inventory data. There are two main ways to model inventory data as nodes and edges. The ideal way would be to have a clean separation between products (goods and services) and processes. One way to think of this difference is that processes are verbs, doing activities in the economy, and products are nouns, concrete manifestations which can be measured. For example, a process could consume some raw materials and energy, and produce something useful and some waste. Each of these inputs and outputs are products. It’s important to bear in mind that both input and output edges can be functional. A functional edge is the purpose of modelling the process in the first place. Creating a process is a conscious decision, where a practitioner chooses that this process is a necessary and discrete part of a value chain, and is located in a particular spatial, temporal, and technological context. A waste treatment process can have a functional input edge, as this is the main function of that activity. Here is an example of what such a graph would look like and the corresponding Brightway objects: ![image](../../_images/split-graph.png) It’s interesting to think about the implications of this paradigm. Processes separated from products do not have units, for example. Their input and output amounts are defined in proportion to their functional edges. Because processes can have more than one functional edge, they do not necessarily have a “reference product”, so your code shouldn’t assume this attribute is present. When it comes to matrix construction, there is also no expectation of values being on the diagonal of the technosphere matrix, or any meaning to that diagonal - the ordering of processes and products is arbitrary and independent of one another. The only real constraint on processes and products is that the matrix produced from the entirety of the data is non-singular. However, many databases we build on do not make a clean distinction between products and processes. In this case, to accurately reflect the data schema of the imported data, and to simplify graph traversal, we can create a chimaera node which is [both process and reference product](https://github.com/brightway-lca/bw_interface_schemas/blob/5fb1d40587aec2a4bb2248505550fc883a91c355/bw_interface_schemas/lci.py#L83) . In this case, a process produces itself, as it is both a process and a product. Because the product and process are bound together, these processes can only have one functional edge. These chimaera nodes have the data of both the process and the product, and the information of the (reference) product is given in Brightway by: * `unit`: The unit of the product produced * `reference product`: The name of the product produced Here is an example of what such this graph would look like: ![image](../../_images/chimaera-graph.png) The first approach is preferred in theory, and is what we encourage, but the second approach is more widely used in practice. Either approach works with biosphere flow edges - they can be linked to both processes and and chimaera process+product nodes. However, biosphere flows _should not_ be linked to separate products, as this makes no sense, and this information will be ignored in matrix construction. Data Schema[#](#data-schema "Link to this heading") ---------------------------------------------------- ### Processes[#](#processes "Link to this heading") The data schema for process nodes is a dictionary. It has some required attributes: name: str unit: str location: str code: str database: str type: str = "process" exchanges: list\[Edge\] = \[\] And recommends the following attribute labels: created: datetime modified: datetime comment: Union\[str, dict\[str, str\]\] tags: dict\[str, str\] properties: dict\[str, float\] These attributes are not exclusive - you can add any additional attributes you want to a process node. * See [Matrix construction](matrix.html) for how the `type` value is used. * See [Creating initial project data](#identifying-nodes) for an explanation of how to create and use the `code` value. * `comment` can be a dictionary, like `{'main comment': 'text here', 'something else': 'hi mom!'}`. Tags are used for discrete choices, usually from a pre-defined list of options. This can be used, for example, for classification systems. Properties are always numeric. ### Uniquely Identifying Nodes[#](#uniquely-identifying-nodes "Link to this heading") Linking nodes within and between databases requires a way to uniquely identify each node object. Brightway won’t stop you from creating two nodes with the same attributes, so we can’t count on any field or combination of fields to be unique. The field we use which is guaranteed to be unique is the database primary key integer `id`. It can be convenient to have a field which summarizes the most important dataset attributes. For example, if you create a copy of a database, modify it, and the datasets in the copy share this same summary field, then it’s very easy to compare the original LCA results versus the copy. That’s what the `code` field is for. This is often made up by [hashing](http://en.wikipedia.org/wiki/MD5) the attributes of a node, but doesn’t have to be. When you create datasets manually, you can assign each dataset a code. When you import a database, the codes will be automatically generated for you. ### Products[#](#products "Link to this heading") The data schema for product nodes is a dictionary. It has some required attributes: name: str unit: str location: Optional\[str\] code: str database: str type: str = "product" And recommends the following attribute labels: created: datetime modified: datetime comment: Union\[str, dict\[str, str\]\] tags: dict\[str, str\] properties: dict\[str, float\] These attributes are not exclusive - you can add any additional attributes you want to a product node. Warning You should not define edges on product nodes. Edges, both input and output, should only be defined on process and process+product nodes. `location` is not needed on products which are the same globally, but sometimes products have properties which vary over time and space, in which case the `location` can be specified. Tags and properties work the same way as they do for processes. ### Chimaera Processes with Single Reference Products[#](#chimaera-processes-with-single-reference-products "Link to this heading") [Chimaera processes](#chimaera) act as both a process and a product at the same time. The data schema for these nodes is a dictionary. It is the same as for processes, but also requires: reference product: str And you can specify: production\_amount: float Note that the `production_amount` is not used in calculations, it is only for your convenience. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/inventory.md) ### This Page * [Show Source](../../_sources/content/overview/inventory.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Databases — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Databases[#](#databases "Link to this heading") ================================================ Basic Operations[#](#basic-operations "Link to this heading") -------------------------------------------------------------- ### How do I list all databases?[#](#how-do-i-list-all-databases "Link to this heading") sorted(bd.databases) ### How do I test if a given database is installed?[#](#how-do-i-test-if-a-given-database-is-installed "Link to this heading") '' in bd.databases ### How do I instantiate a `Database` object?[#](#how-do-i-instantiate-a-database-object "Link to this heading") my\_db \= bd.Database('') ### How do I copy a `Database`?[#](#how-do-i-copy-a-database "Link to this heading") copied\_database \= bd.Database('').copy('') ### How do I rename a `Database`?[#](#how-do-i-rename-a-database "Link to this heading") new\_database \= bd.Database('').rename('') ### How do I delete a `Database`?[#](#how-do-i-delete-a-database "Link to this heading") del bd.databases\[''\] Metadata[#](#metadata "Link to this heading") ---------------------------------------------- ### How do I see the `Database` metadata?[#](#how-do-i-see-the-database-metadata "Link to this heading") bd.Database('').metadata ### How do I change the `Database` metadata?[#](#how-do-i-change-the-database-metadata "Link to this heading") bd.Database('').metadata\[''\] \= '' ### How do I see which other databases this `Database` refers to?[#](#how-do-i-see-which-other-databases-this-database-refers-to "Link to this heading") bd.Database('').metadata\['depends'\] ### How can I see what kind of modelling paradigm and storage engine a `Database` uses?[#](#how-can-i-see-what-kind-of-modelling-paradigm-and-storage-engine-a-database-uses "Link to this heading") This information is given to a limited degree by the database backend: bd.Database('').metadata\['backend'\] There are three backends in a normal Brightway installation: * `sqlite`: The default backend. Uses SQLite like a graph database. * `iotable`: Uses the SQLite database for nodes, but stores edges only in datapackages. Limits edges to a single numerical value without uncertainty, but gives better performance for large IO data. * `multifunctional`: Stores `multifunctional` processes as a custom node type, and automatically allocates following the given database or process preferences when creating datapackages. Searching[#](#searching "Link to this heading") ------------------------------------------------ ### How do I search a `Database`?[#](#how-do-i-search-a-database "Link to this heading") bd.Database('').search('') See [`bw2data.backends.base.SQLiteBackend.search`](../api/bw2data/backends/base/index.html#bw2data.backends.base.SQLiteBackend.search "bw2data.backends.base.SQLiteBackend.search") for documentation and function options. Datapackages[#](#datapackages "Link to this heading") ------------------------------------------------------ ### How do I get the `bw_processing` datapackage for this `Database`?[#](#how-do-i-get-the-bw-processing-datapackage-for-this-database "Link to this heading") bd.Database('').datapackage() On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/cheatsheet/databases.md) ### This Page * [Show Source](../../_sources/content/cheatsheet/databases.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Brightway Software Ecosystem — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Brightway Software Ecosystem[#](#brightway-software-ecosystem "Link to this heading") ====================================================================================== The ![Brightway](https://img.shields.io/static/v1?label=Brightway&message=Framework&color=45bfb0&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTA2NSIgaGVpZ2h0PSI2OTAiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDEwNjUgNjkwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogPGRlZnM+CiAgPGNsaXBQYXRoIGlkPSJjbGlwUGF0aDIxNzMiPgogICA8cGF0aCBkPSJtLTU5NSA0NDBoMWUzdi0xZTNoLTFlM3oiLz4KICA8L2NsaXBQYXRoPgogPC9kZWZzPgogPGcgdHJhbnNmb3JtPSJtYXRyaXgoMS4zIDAgMCAtMS4zIDY1MyA0MDMpIiBjbGlwLXBhdGg9InVybCgjY2xpcFBhdGgyMTczKSIgZmlsbD0iI2ZmZiI+CiAgPHBhdGggZD0ibTAgMGMwLTEuMi0xLjUtMy40LTAuNDctNS4yIDEuMy0yLjQgNS40LTEuNSA1LjgtM3YtMC4wMThsLTQuNy0wLjA1NC0yLTQuMWMtMS45IDAuNzEtMi40IDMuMi0zLjIgNi42LTAuNDQgMi0wLjcxIDMuNCAwLjA4OSA0LjctMTQtMy4zLTMwLTUuNC00NS01LjQtNDkgMC4wMzYtNzEgMTctMTA3IDI0IDEuNS0xLjEgMi43LTMuMyAyLjEtNC45bC02LjEgMi4yLTQtMy4xYy0xLjQgMS40LTAuNTggMi44LTIuMiA0LjgtMi4xIDIuNS01LjMgMi42LTUuMiAzIDAuODctMC4wNzIgMS43LTAuMTQgMi42LTAuMjItMS42IDAuMjQtMi41IDAuNC0yLjYgMC4yMi0zLjkgMC4zMS04IDAuNDktMTIgMC41MS02NiAwLjIyLTEwMi00Mi0xMjItNzkgMy42IDIuOSA4LjcgMS41IDEwIDEuMSA0LjItMS4xIDguOC00LjEgOC40LTYuMWwtNC41LTEuNSAwLjUyLTAuNTRjLTAuMjItMC4wMTktMC40My0wLjAxOS0wLjY1LTAuMDE5LTQuMiAwLjA1NS01LjEgMy45LTkuMiA0LjItMy44IDAuMjktNi40LTIuNy03LjItMS45LTEzLTI3LTE4LTUwLTE4LTUwaC0zNHM2LjcgMzQgMzAgNjhjLTEuNiAxIDEgNS0xLjEgOC4zLTIuNSAzLjgtOC40IDIuNC04LjggNC41LTAuMDE4IDAuMTMtMC4wMzYgMC4yNSAwIDAuMzhsNy4yLTAuNTIgMi41IDUuNWMxLjEtMC40IDItMS43IDMuOS00LjIgMS40LTEuOCAyLjQtMy4yIDMuMS00LjMgMjYgMzQgNjkgNjcgMTM5IDY3IDIuNSAwIDUtMC4wNzMgNy40LTAuMi0wLjU4IDIuMSA1IDMuNSA1LjcgOC4xIDAuNzQgNC44LTQuNyA3LjgtMy40IDEwIDAuMDE4IDAuMDE4IDAuMDM2IDAuMDU0IDAuMDU0IDAuMDcybDUuOC00LjQgNC43IDMuMWMwLjU2LTAuODcgMC42My0xLjctMC40NS04LTEuNC04LjItMS45LTktMi43LTkuNyA0MS01LjIgNjgtMjggMTE4LTI5IDE1LTAuNTQgMzAgMC43OCA0NCAzLjEtMC4yNyAwLjE2LTAuNTIgMC4zNi0wLjc2IDAuNjItMSAxLjEtMS4xIDMuMS0xLjQgNy4xLTAuMjUgNC4zLTAuNCA2LjYgMC40MiA3LjdsMi44LTMuMiAzLjIgMS4yYzAuMDM2LTAuMDcyIDAuMDU0LTAuMTYgMC4wNzItMC4yNCAwLjQ0LTEuOC0xLjEtMi43LTEuMS01LjYgMC0zLjUgMi4zLTQuOSAxLjgtNi41LTAuMDM2LTAuMDktMC4wNzItMC4xOC0wLjExLTAuMjUgNDUgOC43IDc4IDI4IDc5IDI4IDAtMC42My0zNS0yMi03OS0zM20tMzMyLTMwLTU1IDQuMS0zNSA0MC0xNyAyOC0xNSAyNC05LjcgMjctMjYgMTYgMzgtOS40IDM5LTI0IDMxLTI4IDI3LTM5IDE5LTMzem00MTEgNjUgMTEgNzkgNTcgNDYgNjggOS4zIDQ1LTAuMzkgNDcgMTYtMTYtMzYtMTMtMzQtMjQtNTgtMzItNDktMzktMjAtNDMgMy43em04OC0yNDktMTggMzItMjEgMjYtMzUgMzQtMjEgMjYtMjAgMjItMzcgNDgtMTcgMjAgNzAgMC44NyA1Ni00OSAyMi00MCAxNS0zNyAyLjgtMzJ6bTAgMC0xNyAxNy0zOSA2LjItNDQgMTMtNTAgMzMtMzAgNTUtMy4zIDUzIDEzIDI3IDEuOSAzLjcgMTctMjAgMzctNDggMjAtMjIgMjEtMjYgMzUtMzQgMjEtMjZ6bS05MSAzNDgtMTYtNTctMzEtNDYtMzMtMTIgMC4xNSAzLjkgMS42IDQ0IDQuNCAzNiA1LjEgMzQgNC4zIDQwIDIgMzQgMi4zIDM2IDEzIDQyIDQuNS0zNyAxNi0yMiAyMC0zN3ptLTQ3IDE1NC0xMy00Mi0yLjMtMzYtMi0zNC00LjMtNDAtNS4xLTM0LTQuNC0zNi0xLjYtNDQtMC4xNS0zLjktMi44IDMuMi00OCA1NS03LjIgMzcgMC43OCA2NCAyNiA0OCAzMyAyOXptLTE0NS0zOTktMjAgNDMtMTIgNDEtNi4xIDI0LTYuNyAyMCA1OC0yMSAxNS0yNiAxNi00NC00LjItMzctMTItNjEtNS4yIDI0em0yOC02MS0yNyAxOS0yMCAxMS0yOCAyMC0zMSAzMC02LjggNDggMTcgNDIgMjQgMTggMS41LTQuNiA1LjItMTYgNi4xLTI0IDEyLTQxIDIwLTQzIDIyLTM3em0tMTEgMzA1LTE4LTUxLTUyLTM0LTAuMjUgNS44LTAuODMgMTkgMS4yIDM5LTMuMSA0My02LjcgMzgtMTEgNDYtMTUgNjMgMjAtMjUgNDMtNDEgMzAtNDl6bS03MC03OSAwLjI1LTUuOC01NiA0Mi0xNyA2NSAyLjcgNTAgOS40IDQwIDE2IDE3IDguNCA0MCAxNS02MyAxMS00NiA2LjctMzggMy4xLTQzLTEuMi0zOXptLTU0LTE5NC0xMiAyMC0yMiAyNi0xOCAxNS0xNyAxNy0wLjEzLTAuNTYtOS43LTQ1IDIxLTM0IDIzLTEzIDIxLTguMiAzNy0xOS0xNSAxM3ptMjQtNDEtMTUgMTMtOC4zIDI4LTEyIDIwLTIyIDI2LTE4IDE1LTE3IDE3IDQyIDE0IDI0LTQuOCAxNS0xNiA4LjYtMzMgMS41LTI4LTMuNC0yMHptLTExMCAyMDItMjMtNTEtMi44IDQuOS0xOSAzMy0yNyAzOS0zMSAyOC0zOSAyNC0zOCA5LjQgMzIgMS4zIDMxIDEuNiAzMC0wLjI5IDQzLTE2IDMwLTMweiIvPgogPC9nPgo8L3N2Zz4K) is growing larger every year! This page lists different Brightway packages. If you would like to add your own project, simply add it to this page [by opening a pull request](https://github.com/brightway-lca/brightway-documentation/blob/main/sphinx/source/other/ecosystem.md) . mindmap root((🌿 Brightway)) id(📈 VISUALIZATION) bw2analyzer polyviz id(🧮 ASSESSMENT) bw2calc bw\_temporalis bw2regional lca\_algebraic pathways id(💿 DATABASE) bw2data bw\_processing ScenarioLink id(🧩 INVENTORY) ocelot wurst futura premise id(🖋️ IN/OUT) bw2io ecoinvent\_interface brightpath unfold id(💻 WebApp) Panel WebApp id(🖥️ USER INTERFACE) Activity Browser Core Brightway Libraries[#](#core-brightway-libraries "Link to this heading") ------------------------------------------------------------------------------ | Project | Description | | --- | --- | | [`bw2data`](https://github.com/brightway-lca/brightway2-data) | Project management, graph storage and ORM using SQLite, search | | [`bw2calc`](https://github.com/brightway-lca/brightway2-calc) | Matrix-based calculations | | [`bw2io`](https://github.com/brightway-lca/brightway2-io) | [ETL](https://en.wikipedia.org/wiki/Extract,_transform,_load)
for LCA data | | [`bw2analyzer`](https://github.com/brightway-lca/brightway2-analyzer) | Analyze inventory data and LCA results | Supporting Brightway Libraries[#](#supporting-brightway-libraries "Link to this heading") ------------------------------------------------------------------------------------------ | Project | Description | | --- | --- | | [`bw2parameters`](https://github.com/brightway-lca/brightway2-parameters) | Library for storing, validating, and calculating with parameters | | [`bw_graph_tools`](https://docs.brightway.dev/projects/graphtools/) | [Path traversal](https://en.wikipedia.org/wiki/Graph_traversal)
and graph manipulation | | [`bw_interface_schemas`](https://github.com/brightway-lca/bw_interface_schemas/) | Interface schemas for data transfer in Brightway | | [`bw_parameters`](https://github.com/brightway-lca/bw_processing) | Tools to create datapackages in a common format | | [`bw_simapro_csv`](https://docs.brightway.dev/projects/bw-simapro-csv/) | Importing [SimaPro](http://simapro.com)
CSV files into Brightway | | [`ecoinvent_migrate`](https://github.com/brightway-lca/ecoinvent_migrate) | Code to generate Randonneur migration files for ecoinvent releases | | [`ecoinvent_interface`](https://github.com/brightway-lca/ecoinvent_interface) | Unofficial python interface to ecoinvent data | | [`matrix_utils`](https://github.com/brightway-lca/matrix_utils) | Build and iterate on matrices using datapackages | | [`multifunctional`](https://github.com/brightway-lca/multifunctional) | Multifunctional activities in Brightway | | [`pyecospold`](https://github.com/brightway-lca/pyecospold) | Read and write `ecospold` XML versions 1 and 2 | | [`randonneur_data`](https://github.com/brightway-lca/randonneur_data) | Data for the randonneur ETL library and specification | | [`randonneur`](https://github.com/brightway-lca/randonneur) | Library to apply flexible changes to datasets | | [`stats_arrays`](https://github.com/brightway-lca/stats_arrays/) | NumPy array interface for defining uncertain parameters | Major Community Projects[#](#major-community-projects "Link to this heading") ------------------------------------------------------------------------------ | Project | Description | | --- | --- | | [`bw_hestia_bridge`](https://docs.brightway.dev/projects/hestiabridge/) | Importing [Hestia](https://www.hestia.earth)
data into Brightway | | [`bw_graph_tools`](https://docs.brightway.dev/projects/graphtools/) | [Path traversal](https://en.wikipedia.org/wiki/Graph_traversal)
and graph manipulation in Brightway | | [`bw_simapro_csv`](https://docs.brightway.dev/projects/bw-simapro-csv/) | Importing [SimaPro](http://simapro.com)
CSV files into Brightway | | [`bw_processing`](https://docs.brightway.dev/projects/bw-processing/) | Creation of structured arrays in a common format | | [`bw_temporalis`](https://docs.brightway.dev/projects/bw-temporalis/) | [Dynamic LCA](https://doi.org/10.1021/es9030003)
, considering time in both inventory and impact assessment | | [`bw_timex`](https://docs.brightway.dev/projects/bw-timex/) | Dynamic LCA with automatic temporal linking to prospective LCIs | | [`bw_aggregation`](https://docs.brightway.dev/projects/bw_aggregation) | Flexibly use aggregated unit processes for faster calculations | | [`bw_regional`](https://docs.brightway.dev/projects/bw-regional/) | Regionalized LCA calculations | Other Community Projects[#](#other-community-projects "Link to this heading") ------------------------------------------------------------------------------ ### Projects _extending_ Brightway[#](#projects-extending-brightway "Link to this heading") | Project | Authors | Development | Contributors | Stargazers | | --- | --- | --- | --- | --- | | [Activity Browser](https://github.com/LCA-ActivityBrowser/activity-browser) | [Activity Browser team](https://github.com/LCA-ActivityBrowser/activity-browser/graphs/contributors) | ![GitHub last commit](https://img.shields.io/github/last-commit/LCA-ActivityBrowser/activity-browser?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/LCA-ActivityBrowser/activity-browser?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/LCA-ActivityBrowser/activity-browser?style=social) | | [`presamples`](https://presamples.readthedocs.io/en/latest/) | [Pascal Lesage](https://github.com/PascalLesage/) | ![GitHub last commit](https://img.shields.io/github/last-commit/PascalLesage/presamples?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/PascalLesage/presamples?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/PascalLesage/presamples?style=social) | | [`brightway2-aggregated`](https://brightway2-aggregated.readthedocs.io/en/latest/) | [CIRAIG](https://github.com/CIRAIG) | ![GitHub last commit](https://img.shields.io/github/last-commit/CIRAIG/brightway2-aggregated?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/CIRAIG/brightway2-aggregated?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/CIRAIG/brightway2-aggregated?style=social) | | [`bw2landbalancer`](https://github.com/CIRAIG/bw2landbalancer) | [CIRAIG](https://github.com/CIRAIG) | ![GitHub last commit](https://img.shields.io/github/last-commit/CIRAIG/bw2landbalancer?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/CIRAIG/bw2landbalancer?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/CIRAIG/bw2landbalancer?style=social) | | [`bw2waterbalancer`](https://github.com/CIRAIG/bw2waterbalancer) | [CIRAIG](https://github.com/CIRAIG) | ![GitHub last commit](https://img.shields.io/github/last-commit/CIRAIG/bw2waterbalancer?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/CIRAIG/bw2waterbalancer?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/CIRAIG/bw2waterbalancer?style=social) | | [`lca_algebraic`](https://github.com/oie-mines-paristech/lca_algebraic) | [oie-mines-paristech](https://github.com/oie-mines-paristech) | ![GitHub last commit](https://img.shields.io/github/last-commit/oie-mines-paristech/lca_algebraic?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/oie-mines-paristech/lca_algebraic?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/oie-mines-paristech/lca_algebraic?style=social) | | [`premise`](https://github.com/polca/premise) | [Romain Sacchi](https://github.com/romainsacchi) | ![GitHub last commit](https://img.shields.io/github/last-commit/polca/premise?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/polca/premise?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/polca/premise?style=social) | | [`polyviz`](https://github.com/romainsacchi/polyviz) | [Romain Sacchi](https://github.com/romainsacchi) | ![GitHub last commit](https://img.shields.io/github/last-commit/romainsacchi/polyviz?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/romainsacchi/polyviz?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/romainsacchi/polyviz?style=social) | | [`wurst`](https://github.com/polca/wurst) | [Chris Mutel](https://github.com/cmutel)
et al. | ![GitHub last commit](https://img.shields.io/github/last-commit/polca/wurst?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/polca/wurst?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/polca/wurst?style=social) | ### Projects _using_ Brightway[#](#projects-using-brightway "Link to this heading") | Project | Authors | Development | Contributors | Stargazers | | --- | --- | --- | --- | --- | | [`lca-global-sensitivity-analysis`](https://github.com/bsteubing/lca-global-sensitivity-analysis) | [bsteubing](https://github.com/bsteubing) | ![GitHub last commit](https://img.shields.io/github/last-commit/bsteubing/lca-global-sensitivity-analysis?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/bsteubing/lca-global-sensitivity-analysis?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/bsteubing/lca-global-sensitivity-analysis?style=social) | | [`modular-lca`](https://github.com/bsteubing/modular-lca) | [bsteubing](https://github.com/bsteubing) | ![GitHub last commit](https://img.shields.io/github/last-commit/bsteubing/modular-lca?logo=GitHub) | ![GitHub contributors](https://img.shields.io/github/contributors/bsteubing/modular-lca?logo=GitHub) | ![GitHub Repo stars](https://img.shields.io/github/stars/bsteubing/modular-lca?style=social) | On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/ecosystem.md) ### This Page * [Show Source](../../_sources/content/overview/ecosystem.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Compatibility — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Compatibility[#](#compatibility "Link to this heading") ======================================================== I want to work with Brightway25 and the Activity Browser[#](#i-want-to-work-with-brightway25-and-the-activity-browser "Link to this heading") ---------------------------------------------------------------------------------------------------------------------------------------------- This is currently not possible. The Activity Browser supports only the legacy Brightway2 framework. If you would like to voice your support for the Activity Browser to be updated to support Brightway25, check out [this discussion](https://github.com/LCA-ActivityBrowser/activity-browser/discussions/1174) . On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/compatibility.md) ### This Page * [Show Source](../../_sources/content/faq/compatibility.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Impact Assessment — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Impact Assessment[#](#impact-assessment "Link to this heading") ================================================================ Impact Categories (`Method`)[#](#impact-categories-method "Link to this heading") ---------------------------------------------------------------------------------- ### How do I list the installed impact categories?[#](#how-do-i-list-the-installed-impact-categories "Link to this heading") sorted(bd.methods) ### How do I test if a given impact category is installed?[#](#how-do-i-test-if-a-given-impact-category-is-installed "Link to this heading") ('', '') in bd.methods ### How can I get a random impact category?[#](#how-can-i-get-a-random-impact-category "Link to this heading") bd.methods.random() ### How do I search for an impact category using list comprehensions?[#](#how-do-i-search-for-an-impact-category-using-list-comprehensions "Link to this heading") \[\ method for method in bd.methods\ if 'ilcd 2.0' in method\[0\].lower()\ and 'LT' not in method\[2\]\ \] ### How do I see the data in a given impact category?[#](#how-do-i-see-the-data-in-a-given-impact-category "Link to this heading") my\_method\_object \= bd.Method(('', '')) list(my\_method\_object) ### How is the data in impact categories structured?[#](#how-is-the-data-in-impact-categories-structured "Link to this heading") Iterating over a `Method` object yields tuples. * The first element in the tuple will be the biosphere `Node` * The second element will be the characterization factor, either as a number, or as a dictionary which includes uncertainty information * There could be a third element, which gives the _location_ for the characterization factor. This third element is not required. ### How do I interpret the uncertainty dictionary?[#](#how-do-i-interpret-the-uncertainty-dictionary "Link to this heading") See the [`stats_arrays` documentation](https://stats-arrays.readthedocs.io/en/latest/#mapping-parameter-array-columns-to-uncertainty-distributions) . ### How do I create a new impact category?[#](#how-do-i-create-a-new-impact-category "Link to this heading") Start by defining characterization data following the tuple format defined in `How is the data in impact categories structured?`: import stats\_arrays as sa my\_cf\_data \= \[\ (biosphere\_node\_1, 42),\ (biosphere\_node\_1, 23, 'BR'),\ (biosphere\_node\_2, {\ 'uncertainty\_type': sa.TriangularUncertainty.id,\ 'amount': 7,\ 'loc': 7,\ 'maximum': 21\ })\ \] Then write the characterization factor to the `Method`: bd.Method(('', '')).write(my\_cf\_data) ### How do I see the impact category metadata?[#](#how-do-i-see-the-impact-category-metadata "Link to this heading") bd.Method(('', '')).metadata ### How do I change the impact category metadata?[#](#how-do-i-change-the-impact-category-metadata "Link to this heading") bd.Method(('', '')).metadata\[''\] \= '' On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/cheatsheet/ia.md) ### This Page * [Show Source](../../_sources/content/cheatsheet/ia.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Inventory Graph — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Inventory Graph[#](#inventory-graph "Link to this heading") ============================================================ Nodes (=Activities)[#](#nodes-activities "Link to this heading") ----------------------------------------------------------------- ### How do I iterate over nodes in a `Database`?[#](#how-do-i-iterate-over-nodes-in-a-database "Link to this heading") for node in bd.Database(''): do\_something(node) Iteration over nodes is helpful for complicated filter cases: \[\ node for node in bd.Database('')\ if 'electricity production' in node\['name'\]\ and 'coal' in node\['name'\]\ and node\['location'\].lower() \== 'de'\ \] ### How do I get a random node from a `Database`?[#](#how-do-i-get-a-random-node-from-a-database "Link to this heading") bd.Database('').random() ### How do I get a specific node?[#](#how-do-i-get-a-specific-node "Link to this heading") my\_node \= bd.get\_node(my\_attr\="") You can pass in any attribute value, including “database” and “code”. Combine multiple filters with commas, e.g. `bd.get_node(name="", location="bar")`. To search for attribute keys with spaces, use a dictionary: `bd.get_node(**{"some value with spaces": True})`. ### How do I create a new node?[#](#how-do-i-create-a-new-node "Link to this heading") my\_node \= bd.Database('').new\_node(\*\*attributes) my\_node.save() Where `attributes` is a dictionary of the desired node attributes. ### How do I get all the data attributes of a node?[#](#how-do-i-get-all-the-data-attributes-of-a-node "Link to this heading") my\_node.as\_dict() ### How do I change data attributes of a node?[#](#how-do-i-change-data-attributes-of-a-node "Link to this heading") my\_node\[''\] \= "" my\_node.save() Edges (=Exchanges)[#](#edges-exchanges "Link to this heading") --------------------------------------------------------------- ### How do I list edges of a process where inputs are consumed?[#](#how-do-i-list-edges-of-a-process-where-inputs-are-consumed "Link to this heading") list(my\_node.technosphere()) ### How do I list edges of a process where outputs are produced?[#](#how-do-i-list-edges-of-a-process-where-outputs-are-produced "Link to this heading") list(my\_node.production()) ### How do I list all edges which consume the node `my_node`?[#](#how-do-i-list-all-edges-which-consume-the-node-my-node "Link to this heading") list(my\_node.consumers()) ### How do I list all biosphere edges of a process?[#](#how-do-i-list-all-biosphere-edges-of-a-process "Link to this heading") list(my\_node.biosphere()) ### How do I list all edges defined on a process?[#](#how-do-i-list-all-edges-defined-on-a-process "Link to this heading") list(my\_node.edges()) You can use a [list comprehension](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) to iterate over the edges to do more complex filtering: \[\ edge for edge in my\_node.edges()\ if 'car' in edge.input\['name'\]\ \] ### How do I delete an edge?[#](#how-do-i-delete-an-edge "Link to this heading") my\_edge.delete() ### How do I get all the data attributes of an edge?[#](#how-do-i-get-all-the-data-attributes-of-an-edge "Link to this heading") my\_edge.as\_dict() ### How do I access the input and output nodes of an edge?[#](#how-do-i-access-the-input-and-output-nodes-of-an-edge "Link to this heading") my\_edge.input my\_edge.output ### How do I change the input or output of an edge?[#](#how-do-i-change-the-input-or-output-of-an-edge "Link to this heading") my\_edge.input \= new\_node my\_edge.output \= new\_node my\_edge.save() ### How do I change data attributes of an edge?[#](#how-do-i-change-data-attributes-of-an-edge "Link to this heading") my\_edge\[''\] \= "" my\_edge.save() ### How do I create a new edge?[#](#how-do-i-create-a-new-edge "Link to this heading") my\_edge \= my\_node.new\_edge(\*\*attributes) my\_edge.save() Where `attributes` are the desired attributes of the edge; must include `type`, `amount`, and `input`. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/cheatsheet/inventory.md) ### This Page * [Show Source](../../_sources/content/cheatsheet/inventory.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Data Management — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Data Management[#](#data-management "Link to this heading") ============================================================ Where is my data saved?[#](#where-is-my-data-saved "Link to this heading") --------------------------------------------------------------------------- You can find the current project data directory with the command `projects.dir`. Everything is stored in this folder or a subdirectory. Similarly, you can find the logs directory with the command `projects.logs_dir`. Brightway uses a Python library to select an appropriate, platform-specific path, namely: Windows C:\\Documents and Settings\\\\Application Data\\Local Settings\\pylca\\Brightway3 macOS /Users//Library/Application Support/Brightway3 Linux /home//.local/share/Brightway3 How do I change my data directory?[#](#how-do-i-change-my-data-directory "Link to this heading") ------------------------------------------------------------------------------------------------- You can specify a custom data directory path by setting the environment variable `BRIGHTWAY2_DIR`. Brightway will raise an `OSError` if this is not a writable directory. Warning This is not recommended for use by beginners, but if you have multiple or non-standard installations of Brightway it might be useful. Unix (Z Shell) To change the storage location of Brightway data to a directory of your choice, set an environment variable in the default shell of your Unix system. Note Replace `` with your desired absolute directory path and restart the shell. echo 'export BRIGHTWAY2\_DIR=' \>> ~/.zshenv Windows (Power Shell) To change the storage location of Brightway data to a directory of your choice, set an environment variable using the Windows Power Shell. Note Replace `` with your desired absolute directory path and restart the shell. \[Environment\]::SetEnvironmentVariable("BRIGHTWAY2\_DIR", "", "User") How do I change my data directory in a Conda environment?[#](#how-do-i-change-my-data-directory-in-a-conda-environment "Link to this heading") ----------------------------------------------------------------------------------------------------------------------------------------------- When you create a [Conda environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#managing-environments) , it lives in a directory located at: `/envs/` When Conda activates or deactivates an environment, it looks for additional scripts in the two subfolders `etc/conda/activate.d` and `etc/conda/deactivate.d` _within this directory_. To set persistent environment variables [(like `BRIGHTWAY2_DIR`)](#brightway2-dir) in your Conda environment: Unix (Z Shell) 1. Navigate to your Conda environment directory: cd /envs/ 2. If not already present, create two directories `etc/conda/activate.d` and `etc/conda/deactivate.d` mkdir \-p etc/conda/activate.d mkdir \-p etc/conda/deactivate.d 4. Create scripts in the folders that _set_ and _unset_ the environment variables (in this case `BRIGHTWAY2_DIR`). The names of the files don’t matter, but the file extensions do. Inside the folder `activate.d` create the file ``. Inside the folder `deactivate.d` create the file `.sh chmod +x etc/conda/deactivate.d/.sh Windows (Power Shell) 1. Navigate to your Conda environment directory: cd /envs/ 2. If not already present, create two directories `etc/conda/activate.d` and `etc/conda/deactivate.d` 3. Create scripts in the folders that set and unset the environment variables (in this case `BRIGHTWAY2_DIR`). The names of the files don’t matter, but the file extensions do. Inside the folder `activate.d` create the file ``. Inside the folder `deactivate.d` create the file `` with the name of the environment you want to save. Replace `` with the name you want to give the file. Replace `` with the path to the file you want to save the environment to. conda activate conda env export \--from-history \> "/.yml" This will create a file called `.yml` at the location you specified. The `--from-history` flag ensures that only those packages are included that you installed into the environment (and not all their dependencies). You can then use this file to recreate the environment at a later point using the following shell command: Note Replace `` with the name of the environment you want to restore. conda env create \-f "/environment.yml" On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/environment_management.md) ### This Page * [Show Source](../../_sources/content/faq/environment_management.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Matrix Construction — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Matrix Construction[#](#matrix-construction "Link to this heading") ==================================================================== We normally use Brightway to do life cycle assessment calculations using matrices. This section describes how matrices are constructed. In a standard calculation, we would have three matrices: * `technosphere` matrix: Our model of the supply chain. It has columns of processes, and rows of products. Chimaera process+product nodes will have both a row and a column. * `biosphere` matrix: The interactions our processes have with the natural environment - either consumption of resources, or emissions to the natural environment. It has columns of processes (in the same order and dimension as the `technosphere` matrix), and rows of biosphere flows. * `characterization` matrix: The unit conversion from physical amounts of biosphere flows to the unit of damage. It has columns and rows of biosphere flows (same order and dimension as the `biosphere` matrix), and only has values along the diagonal. Processed Datapackages[#](#processed-datapackages "Link to this heading") -------------------------------------------------------------------------- To speed up calculations, Brightway maintains a separate cache of the numerical data. When a change is made to a `Database`, it is marked as `dirty` in its metadata. When a calculation is initiated, the cache of all dirty databases is refreshed from the relational data store. Positive and Negative Values in the `technosphere`[#](#positive-and-negative-values-in-the-technosphere "Link to this heading") -------------------------------------------------------------------------------------------------------------------------------- Technosphere Matrix Normalization You may have seen the following matrix equation for IO or LCA: \\(h = (I - A)^{-1}f\\). Brightway **does not** use this equation - instead, we use the following: \\(h = A^{-1}f\\). We do not assume that each column in our technosphere matrix (**A**) is [normalized to one unit of production](../faq/negative_results.html#production-normalization) , nor do we assume that rows are in the same order as columns. These are [unnecessary and arbitrary restrictions](https://doi.org/10.1111/jiec.13323) , and Brightway does not like arbitrary restrictions. So we choose to manually construct the technosphere matrix, and choose which numbers are positive and which are negative.\`\`\` The sign convention in Brightway is: * Positive numbers in the technosphere are products (goods and services) being _produced_ by a process. This can include waste. * Negative numbers in the technosphere are products (goods and services) being _consumed_ by a process. This can include waste. Remember, in the technosphere matrix products are rows, processes are columns, but sometimes we have chimaera nodes which act as both products and processes. The _sign_ of an edge numeric value is not related to whether or not that edge is _functional_. Wastes can be produced (positive value), but producing waste is never the function of a process. Brightway will automatically insert the correct numerical sign based on the `Node` and `Edge` types you provide. Positive and Negative Values in the `biosphere` and LCIA Matrices[#](#positive-and-negative-values-in-the-biosphere-and-lcia-matrices "Link to this heading") -------------------------------------------------------------------------------------------------------------------------------------------------------------- The convention in almost all parts of the LCA community is for characterization factors to be positive numbers, representing the _production_ of environmental damage. This is true even if the characterization factors are for resource consumption, which is the net removal of a resource from its reserve. Similarly, every database that we are aware of gives positive values in the biosphere matrx, even if the biosphere flow is the consumption of natural resources. A more logical sign convention would be consistency with the technosphere, where consumption is negative and production is positive. Brightway does not take a position on this debate - the signs of values in biosphere and characterization (and normalization and weighting) edges are entered into those matrices without change. Brightway does allow you to follow this more logical sign convention, but does not implement it when importing common databases and LCIA methods, as we prefer to not modify imported data (at least most of the time 😉), and because trying to fix things could easily lead to mistakes. Whatever sign convention you do follow, make sure that both the biosphere edges and any LCIA data you use are consistent with each other. What Data Enters the `technosphere` Matrix?[#](#what-data-enters-the-technosphere-matrix "Link to this heading") ----------------------------------------------------------------------------------------------------------------- Brightway uses a combination of the node and edge _types_ to determine where to put edge data in the technosphere and biosphere matrices. These type filter values are configurable, and can be customized if needed. Here are the rules Brightway follows: 1. If an edge (exchange on a `Node` instance) has a type in `bw2data.labels.technosphere_positive_edge_types`, and the edge _output_ `Node` has a type in `bw2data.labels.process_node_types`, then the numeric amount of the edge will be added to the _technosphere_ matrix without modification, with a row index derived from the edge _input_ and a column index derived from the edge _output_. That was a mouthful! Let’s break it down: * We want to be able to put additional data in the graph data store and not have it be used in matrix construction. For example, we could create a `Node` which gives data lineage, or revision history, or review comments, or links to external models. These nodes would have a `type` value like “ignore me please”, and this _process node type_ is not in `bw2data.labels.process_node_types` (which defaults to “process”, “processwithreferenceproduct”, and a missing type value), so this node and its edges would not be used in matrix construction. * Every section in `bw2data.labels` is a list, and can be appended to or even replaced completely, if you want to use different labels. * We will put both positive numbers and negative numbers into the technosphere matrix, and the meaning of positive and negative values is given above. If the edge type is in `bw2data.labels.technosphere_positive_edge_types` (which defaults to “production” and “substitution”), then we know the numeric value should be entered without modification. * Why did I just say “without modification” instead of with a positive value? Because maybe you chose to put in a negative amount in your production edge. Brightway won’t judge, it just does what you tell it to. In general, this isn’t the greatest idea (why model it as a negative production instead of a consumption edge?), but it will work. * We have an exchange data model for inputs and outputs which **doesn’t make sense**, because it needs to labels the products being produced by the process as an _input_ to that process, even though it is definitely an _output_ of the physical process. Sorry about that, we will fix this, but for now follow this rule: Important The terms `input` and `output` in the Brightway data schema do no indicate directionality. Products and biosphere flows always need to be edge _inputs_ in Brightway, even if they are _outputs_ in the real world. Edge _outputs_ should always be processes. When using chimaera process+product nodes there is no distinction between a process and a product, so you don’t need to think about any of this - that’s how this weird design choice came into Brightway in the first place. 2. If an edge (exchange on a `Node` instance) has a type in `bw2data.labels.technosphere_negative_edge_types`, and the edge _output_ `Node` has a type in `bw2data.labels.process_node_types`, then the numeric amount of the edge will be added to the _technosphere_ matrix after mutiplication be `-1`, with a row index derived from the edge _input_ and a column index derived from the edge _output_. Very similiar to the first rule, but with different edge types - `bw2data.labels.technosphere_negative_edge_types`, which defaults to “technosphere”, and a multiplication of the numeric amount by `-1`. Remember that this doesn’t mean the number is negative, just that its sign is flipped. 3. If an edge (exchange on a `Node` instance) has a type in `bw2data.labels.biosphere_edge_types`, and the edge _output_ `Node` has a type in `bw2data.labels.process_node_types`, then the numeric amount of the edge will be added to the _biosphere_ matrix without modification, with a row index derived from the edge _input_ and a column index derived from the edge _output_. What Data Enters the `biosphere` Matrix?[#](#what-data-enters-the-biosphere-matrix "Link to this heading") ----------------------------------------------------------------------------------------------------------- When building the `biosphere` matrix, Brightway iterates over all process nodes present in the `technosphere`; for each edge attached to one of those process nodes, we check: 1. The edge `type`; it must be in `bw2data.labels.biosphere_edge_types`, which has a default of `["biosphere"]`. That’s it! This single rule means that we **don’t check the biosphere node `type`** - the only way we determine what biosphere flows we have in our matrix are whether they are refenced by an edge with a biosphere edge type. We can therefore do a better job reflecting the real world, where the distinction between products in the technosphere and biosphere flows breaks down upon examination. Think of pesticides or other agricultural chemicals, which are both produced but then applied and have environmental effects, or industrial gases including \\(CO\_{2}\\) which are used in the technosphere but also released and cause impacts. In Brightway, you could use the same `Node` as a product in the technosphere matrix _and_ as a biosphere flow in the biosphere matrix. What Data Enters the `characterization`, `normalization`, and `weighting` Matrices?[#](#what-data-enters-the-characterization-normalization-and-weighting-matrices "Link to this heading") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Any biosphere flows returned [when iterating over LCIA objects](../cheatsheet/ia.html#iterate-lcia-method) which **are also in the biosphere matrix** are used to construct these LCIA matrices. In non-regionalized LCIA, we also remove region-specific characterization factors. The characterization factor [data schema](../cheatsheet/ia.html#lcia-tuple-structure) allows for an optional “location” third element. In non-regionalized LCIA, we only use characterization factors who don’t have a “location” element, or whose “location” element is equal to `bw2data.config.global_location`. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/matrix.md) ### This Page * [Show Source](../../_sources/content/overview/matrix.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # LCA Calculations — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") LCA Calculations[#](#lca-calculations "Link to this heading") ============================================================== Single Functional Unit and LCIA Set[#](#single-functional-unit-and-lcia-set "Link to this heading") ---------------------------------------------------------------------------------------------------- ### How do I define a functional unit?[#](#how-do-i-define-a-functional-unit "Link to this heading") A functional unit is some amount of one or more products. Because chimaera process+products act like products (see the overview documentation), they can also be used as functional units. Brightway wants functional units to be provided as a dictionary, with keys given the product `Nodes`, and values giving the amount of each product. A single functional unit can have one or more products. {my\_node: 42, my\_other\_node: 7} ### How do I calculate an life cycle inventory?[#](#how-do-i-calculate-an-life-cycle-inventory "Link to this heading") my\_functional\_unit, data\_objs, \_ \= bd.prepare\_lca\_inputs({my\_node: 42}) my\_lca \= bc.LCA(demand\=my\_functional\_unit, data\_objs\=data\_objs) my\_lca.lci() This will create `my_lca.inventory`, a matrix with the life cycle inventory data, with rows of biosphere flows and columns of processes. ### How do I calculate a characterized inventory?[#](#how-do-i-calculate-a-characterized-inventory "Link to this heading") my\_functional\_unit, data\_objs, \_ \= bd.prepare\_lca\_inputs( {my\_node: 42}, method\=('', '') ) my\_lca \= bc.LCA(demand\=my\_functional\_unit, data\_objs\=data\_objs) my\_lca.lci() my\_lca.lcia() This will create `my_lca.characterized_inventory`, a matrix with the life cycle inventory data, with rows or biosphere flows and columns of processes. ### How do I calculate a normalized inventory?[#](#how-do-i-calculate-a-normalized-inventory "Link to this heading") my\_functional\_unit, data\_objs, \_ \= bd.prepare\_lca\_inputs( {my\_node: 42}, method\=('', ''), normalization\=('', '') ) my\_lca \= bc.LCA(demand\=my\_functional\_unit, data\_objs\=data\_objs) my\_lca.lci() my\_lca.lcia() This will create `my_lca.normalized_inventory`, a matrix with the normalized life cycle inventory data, with rows or biosphere flows and columns of processes. ### How do I calculate a weighted inventory?[#](#how-do-i-calculate-a-weighted-inventory "Link to this heading") my\_functional\_unit, data\_objs, \_ \= bd.prepare\_lca\_inputs( {my\_node: 42}, method\=('', ''), weighting\=('', '') ) my\_lca \= bc.LCA(demand\=my\_functional\_unit, data\_objs\=data\_objs) my\_lca.lci() my\_lca.lcia() This will create `my_lca.weighted_inventory`, a matrix with the weighted life cycle inventory data, with rows or biosphere flows and columns of processes. Weighting can be done with normalization, but does not require normalization. ### How do I get the LCA score after calculating a characterized inventory, possibly including normalization and/or weighting?[#](#how-do-i-get-the-lca-score-after-calculating-a-characterized-inventory-possibly-including-normalization-and-or-weighting "Link to this heading") my\_lca.score ### How do I see the most important elements in the result matrix?[#](#how-do-i-see-the-most-important-elements-in-the-result-matrix "Link to this heading") my\_lca.to\_dataframe(matrix\_label\="characterized\_inventory") See [`bw2calc.lca.LCA.to_dataframe`](../api/bw2calc/lca/index.html#bw2calc.lca.LCA.to_dataframe "bw2calc.lca.LCA.to_dataframe") for more information on this functionality. ### How do I filter down to a row in the `inventory` or `_inventory` matrix?[#](#how-do-i-filter-down-to-a-row-in-the-inventory-or-any-inventory-matrix "Link to this heading") Rows in these matrices are biosphere flows. row\_index \= lca.dicts.biosphere\[my\_biosphere\_flow\_node.id\] filtered\_matrix \= lca.inventory\[row\_index, :\] filtered\_matrix \= lca.characterized\_inventory\[row\_index, :\] filtered\_matrix \= lca.normalized\_inventory\[row\_index, :\] filtered\_matrix \= lca.weighted\_inventory\[row\_index, :\] ### How do I filter down to a column in the `inventory` or `characterized_inventory` matrix?[#](#how-do-i-filter-down-to-a-column-in-the-inventory-or-characterized-inventory-matrix "Link to this heading") Columns in these matrices are processes. col\_index \= lca.dicts.activity\[my\_process\_node.id\] filtered\_matrix \= lca.inventory\[:, col\_index\] filtered\_matrix \= lca.characterized\_inventory\[:, col\_index\] filtered\_matrix \= lca.normalized\_inventory\[:, col\_index\] filtered\_matrix \= lca.weighted\_inventory\[:, col\_index\] ### How do I go from matrix indices to `Node` objects?[#](#how-do-i-go-from-matrix-indices-to-node-objects "Link to this heading") First, you need to find out what kind of object you need to look up. Assuming you have created an LCA instance `lca_instance`: * In the `technosphere_matrix`, `inventory`, and all `_inventory` matrices, columns are processes. Use `lca_instance.dicts.activity`. * In the `technosphere_matrix`, and in the `demand_array`, rows are products. Use `lca_instance.dicts.product`. * In the `biosphere_matrix`, `inventory`, and all `_inventory` matrices, rows are biosphere flows. Use `lca_instance.dicts.biosphere`. * The `characterization_matrix`, `normalization_matrix`, and `weighting_matrix` are all [diagonal matrices](https://en.wikipedia.org/wiki/Diagonal_matrix) , with both rows and columns being biosphere flows. Use `lca_instance.dicts.biosphere`. You can then use `dicts..reversed` to go from row or column indices to `Nodes`: bd.get\_node(id\=my\_lca.dicts.activity.reversed\[my\_column\_index\]) bd.get\_node(id\=my\_lca.dicts.product.reversed\[my\_row\_index\]) Multiple Functional Units and LCIA Sets[#](#multiple-functional-units-and-lcia-sets "Link to this heading") ------------------------------------------------------------------------------------------------------------ ### How do I calculate an life cycle inventory for multiple functional units?[#](#how-do-i-calculate-an-life-cycle-inventory-for-multiple-functional-units "Link to this heading") For the `MultiLCA` class, we need to _label_ each functional unit: functional\_units \= { "γ": {node\_1.id: 3.9}, "ε": {node\_2.id: 6.2}, } data\_objs \= bd.get\_multilca\_data\_objs(functional\_units, {}) lca \= bc.MultiLCA( demands\=functional\_units, method\_config\={}, data\_objs\=data\_objs, ) lca.lci() Functional unit data types In `MultiLCA` functional units, the keys must be integer ids, not `Node` instances If your functional units will only have a single product node, you can use the `Node` object itself as the dictionary key: functional\_units \= { node\_1: {node\_1.id: 4.88}, node\_2: {node\_2.id: 11}, } This will create `lca.inventories`, a dictionary which gives inventory matrices for each combination of functional unit label and impact category. { ("γ",): sparse\_matrix, ("ε",): sparse\_matrix, } ### How do I calculate a life cycle impact assessment for multiple functional units and a combination of LCIA impact categories, normalizations, and weightings?[#](#how-do-i-calculate-a-life-cycle-impact-assessment-for-multiple-functional-units-and-a-combination-of-lcia-impact-categories-normalizations-and-weightings "Link to this heading") We start by describing how the impact categories, normalization, and weightings are related. The safest way to do this is by creating an instance of `bw2calc.MethodConfig`; the [`bw2calc.method_config.MethodConfig`](../api/bw2calc/method_config/index.html#bw2calc.method_config.MethodConfig "bw2calc.method_config.MethodConfig") documentation describes how to provide this data. method\_config \= bc.MethodConfig() For the `MultiLCA` class, we need to _label_ each functional unit in a dictionary: functional\_units \= { "γ": {node\_1.id: 1}, "ε": {node\_2.id: 2}, } Finally, we need to get the datapackages needed for all inventory databases and LCIA steps. We can then create a `MultiLCA` instance: data\_objs \= bd.get\_multilca\_data\_objs(functional\_units, method\_config) lca \= bc.MultiLCA( demands\=functional\_units, method\_config\=impact\_categories, data\_objs\=data\_objs, ) lca.lci() lca.lcia() You should also do `lca.normalization()` and `lca.weighting()` if those steps have data given in `method_config`. The results are provided as dictionaries, with keys showing which weighting, normalization, and characterization methods were applied for each functional unit. For example, if `method_config` was: method\_config \= bd.MethodConfig( impact\_categories\=\[\ ('', ''),\ ('', ''),\ \] ) Then `lca.characterized_inventories` would be the following dictionary: { (('', ''), "γ"): sparse\_matrix, (('', ''), "ε"): sparse\_matrix, (('', ''), "γ"): sparse\_matrix, (('', ''), "ε"): sparse\_matrix, } Additional elements would be added to the dictionary keys if normalization and weighting were included. As these dictionaries have multiple matrices at each calculation step, the `MultiLCA` attributes are plural: * `supply_array` ➟ `supply_arrays` * `inventory` ➟ `inventories` * `characterized_inventory` ➟ `characterized_inventories` * `normalized_inventory` ➟ `normalized_inventories` * `weighted_inventory` ➟ `weighted_inventories` * `score` ➟ `scores` Stochastic LCA Calculations (Monte Carlo)[#](#stochastic-lca-calculations-monte-carlo "Link to this heading") -------------------------------------------------------------------------------------------------------------- Both `LCA` and `MultiLCA` classes support stochastic calculations using Monte Carlo. New values for all matrices can be generated from probability distribution functions, or from pre-calculated arrays of sample or population values. ### How do I use probability distribution functions in stochastic LCA?[#](#how-do-i-use-probability-distribution-functions-in-stochastic-lca "Link to this heading") bc.LCA(..., use\_distributions\=True) bc.MultiLCA(..., use\_distributions\=True) ### How do I use presampled values from arrays in my datapackages?[#](#how-do-i-use-presampled-values-from-arrays-in-my-datapackages "Link to this heading") bc.LCA(..., use\_arrays\=True) bc.MultiLCA(..., use\_arrays\=True) You can use both `use_distributions` _and_ `use_arrays` in a calculation. ### How do I generate a new set of results when doing stochastic LCA?[#](#how-do-i-generate-a-new-set-of-results-when-doing-stochastic-lca "Link to this heading") next(lca\_object) This will draw new data samples and generate new versions of all matrices defined, including characterization, normalization, and weighting, solve the linear system, and generate all result matrices. You can also use this in anything that needs the [iterator protocol](https://wiki.python.org/moin/Iterator) , like list comprehensions: results \= \[lca.score for \_ in zip(lca, range(10))\] But you can also advance the `lca` object manually: for \_ in range(10): next(lca) do\_something\_with\_lca\_result\_matrices(lca) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/cheatsheet/lca.md) ### This Page * [Show Source](../../_sources/content/cheatsheet/lca.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2parameters Changelog — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") `bw2parameters` Changelog[#](#bw2parameters-changelog "Link to this heading") ============================================================================== 1.1.0 (2023-04-17)[#](#id1 "Link to this heading") --------------------------------------------------- * Require `pint` dependency * Fix regression: `DefaultParameterSet` -> `ParameterSet` * New packaging based on Brightway 1.0.0 (2023-01-27)[#](#id2 "Link to this heading") --------------------------------------------------- * BREAKING CHANGE: Dropping Python 2.7 support * Introduce new class `PintParameterSet` for solving formulas with units 0.7.1 (2023-01-25)[#](#id3 "Link to this heading") --------------------------------------------------- * Fix tests: must set loc in all monte carlo runs * minor (black) reformatting and isorting * introduce github workflow for automated testing 0.7 (2021-12-25)[#](#id4 "Link to this heading") ------------------------------------------------- * Improve handling of errors in `ParameterSet.evaluate_monte_carlo` so that an array is returned even when the interpreter fails. 0.6.6 (2018-11-11)[#](#id5 "Link to this heading") --------------------------------------------------- Return global parameters from `evaluate`, to be consistent with `evaluate_monte_carlo` 0.6.5 (2018-4-19)[#](#id6 "Link to this heading") -------------------------------------------------- Allow Numpy arrays in local amount values 0.6.4 (2018-02-16)[#](#id7 "Link to this heading") --------------------------------------------------- * Add some extra functionality for presamples 0.6.3 (2018-02-14)[#](#id8 "Link to this heading") --------------------------------------------------- * Allow `global_params` to be Numpy arrays ### 0.6.2.1 (2018-02-13)[#](#id9 "Link to this heading") * Removed extraneous print statement 0.6.2 (2018-02-12)[#](#id10 "Link to this heading") ---------------------------------------------------- * Add `prefix_parameter_dict` and `substitute_in_formulas` for better symbol name mangling ### 0.6.1.2 (2017-10-19)[#](#id11 "Link to this heading") * Packaging fix 0.6 (2017-10-19)[#](#id12 "Link to this heading") -------------------------------------------------- * Add Monte Carlo sampling to parameter sets * Add Windows and Linux CI * Add Coveralls test coverage ### 0.5.3 (2017-04-17)[#](#id13 "Link to this heading") * Fix license text ### 0.5.2 (2016-08-17)[#](#id14 "Link to this heading") * Remove scipy dependency ### 0.5.1 (2016-04-12)[#](#id15 "Link to this heading") * Correct asteval dependency version 0.5 (2016-04-12)[#](#id16 "Link to this heading") -------------------------------------------------- * Correct when CapitalizationError is raised, and make error messages more useful 0.4 (2015-05-20)[#](#id17 "Link to this heading") -------------------------------------------------- * Global parameters 0.3 (2015-04-10)[#](#id18 "Link to this heading") -------------------------------------------------- * Fix adding amount to list of exchanges * More informative error messages * Improve validity checks 0.2 (2015-02-06)[#](#id19 "Link to this heading") -------------------------------------------------- * Complete tests coverage * Improved docs 0.1 (2015-02-02)[#](#id20 "Link to this heading") -------------------------------------------------- Initial checkin On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/changelog/link_to_changelog_parameters.md) ### This Page * [Show Source](../../_sources/content/changelog/link_to_changelog_parameters.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2data Changelog — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") `bw2data` Changelog[#](#bw2data-changelog "Link to this heading") ================================================================== 4.4.2 (2025-01-22)[#](#id1 "Link to this heading") --------------------------------------------------- * [PR #233: Remove \`”\`\` from search to avoid SQL escaping errors](https://github.com/brightway-lca/brightway2-data/pull/233) * [PR #232: Fix type annotations in Python 3.9](https://github.com/brightway-lca/brightway2-data/pull/232) * [PR #231: Escape search strings properly for SQLite `FTS5` format](https://github.com/brightway-lca/brightway2-data/pull/231) * [PR #230: Fix (some) type annotations](https://github.com/brightway-lca/brightway2-data/pull/230) 4.4 (2025-01-15)[#](#id2 "Link to this heading") ------------------------------------------------- * [PR #226: Rebase revisions when necessary](https://github.com/brightway-lca/brightway2-data/pull/226) * [Fix #227: Setting impact category `num_cfs` not saved to disk](https://github.com/brightway-lca/brightway2-data/issues/227) * [PR #213: Remove parentheses and curly braces from FTS5 search queries](https://github.com/brightway-lca/brightway2-data/pull/213) 4.3 (2024-12-03)[#](#id3 "Link to this heading") ------------------------------------------------- * BREAKING CHANGE: Removed looking up node attributes in reference product edges using `node['foo']` (i.e. `node.__getitem__()`). The code searching for reference product edges was incorrect - when it was correct to search for both functional inputs and outputs, there was a severe performance degradation as all edges needed to be loaded and examined. 4.2.1 (2024-12-03)[#](#id4 "Link to this heading") --------------------------------------------------- * Make `__version__` a tuple again to avoid breaking downstream libraries 4.2 (2024-12-03)[#](#id5 "Link to this heading") ------------------------------------------------- * Don’t try to look up attributes in reference product edge if node type is not “process” * Allow reference product exchange to be a functional input 4.1 (2024-11-29)[#](#id6 "Link to this heading") ------------------------------------------------- * Delete upstream edges on node deletion 4.0 (2024-11-25)[#](#id7 "Link to this heading") ================================================= * Switch all ID generation to client side instead of database side, and use [snowflake ids](https://en.wikipedia.org/wiki/Snowflake_ID) with a starting epoch of 2024-01-01. * Add optional ability to serialize data state changes via [DeepDiff](https://pypi.org/project/deepdiff/) . This implementation is well tested but is not recommended for casual use as it doesn’t have any built-in conflict resolution or other functionality which would be needed to a production-level distributed data generation service using Brightway. * Add signals based on [blinker](https://pypi.org/project/blinker/) . 4.0.DEV60 (2024-11-07)[#](#dev60-2024-11-07 "Link to this heading") -------------------------------------------------------------------- * Add possibility for location string normalization before geomapping array * Pin previous version of `pint` to skip frozen dataclass error 4.0.DEV59 (2024-10-14)[#](#dev59-2024-10-14 "Link to this heading") -------------------------------------------------------------------- * Add error handling in updating migrations files 4.0.DEV58 (2024-10-10)[#](#dev58-2024-10-10 "Link to this heading") -------------------------------------------------------------------- * [#196](https://github.com/brightway-lca/brightway2-data/issues/196) : Fix copying over database metadata when copying database 4.0.DEV57 (2024-10-03)[#](#dev57-2024-10-03 "Link to this heading") -------------------------------------------------------------------- * [#193](https://github.com/brightway-lca/brightway2-data/pull/193) : Set node types when writing a `Database` This is a big change and could break some code: * It changes data when calling `.write()` as it guarantees that `type` is always present * Many datasets will have their type label changed from `process` to `processwithreferenceproduct` (e.g. all ecoinvent). Code with uses hard-coded “process” values will break. See `bw2data.configuration` for more details on labels you should expect. * Only nodes with type `processwithreferenceproduct` will be checked for implicit production. This shouldn’t break anything as we change `process` to `processwithreferenceproduct` if implicit production was going to be added. * [#194](https://github.com/brightway-lca/brightway2-data/pull/194) : Replace `print` with logging and add optional `structlog` * Fix `calculation_setups` getting out of sync on node and database deletion 4.0.DEV56 (2024-09-24)[#](#dev56-2024-09-24 "Link to this heading") -------------------------------------------------------------------- * [#192](https://github.com/brightway-lca/brightway2-data/issues/192) : Providing `Node` objects to `prepare_lca_inputs` raises an error 4.0.DEV55 (2024-09-20)[#](#dev55-2024-09-20 "Link to this heading") -------------------------------------------------------------------- * [#190](https://github.com/brightway-lca/brightway2-data/issues/190) : `BW2Exception` should inherit `Exception` (instead of `BaseException`) * [#187](https://github.com/brightway-lca/brightway2-data/issues/187) : `Except: pass` in databases metastore * [#178](https://github.com/brightway-lca/brightway2-data/issues/178) : Use of `pydantic_settings` in `configuration.py` allows for environment variables 4.0.DEV54 (2024-09-14)[#](#dev54-2024-09-14 "Link to this heading") -------------------------------------------------------------------- * Allow `get_node(key=(>> a \= bw2data.Database("something").random() \>>> a.id 19014 And use the integer ID in the `get` functions: \>>> bw2data.get\_activity(19014) 'treatment of aluminium in car shredder residue, municipal incineration' (kilogram, RoW, None) \>>> bw2data.Database("something").get(19014) 'treatment of aluminium in car shredder residue, municipal incineration' (kilogram, RoW, None) You can also call `get_id` on activity keys: \>>> bw2data.get\_id(a) 19014 \>>> bw2data.get\_id(a.key) 19014 ### `mapping` no longer used, though compatibility layer added[#](#mapping-no-longer-used-though-compatibility-layer-added "Link to this heading") You can still import `mapping`, but this will just look up the IDs from the SQLite database. There is no longer a separate file. This change means that you **can no longer add exchanges or characterization factors which reference activities that don’t (yet) exist**. Smaller changes[#](#smaller-changes "Link to this heading") ------------------------------------------------------------ * `IOTableBackend.write` arguments have changed to `(products, prod_exchanges, tech_exchanges, bio_exchanges)`. * `bw2data.utils.safe_filename` was moved to `bw_processing` * `Database.get` is removed (though `Database('foo').get()` still works). Use `get_activity` instead. ### 3.6.2 (2019-11-11)[#](#id8 "Link to this heading") * Fixed invalid variable name creation ### 3.6.1 (2019-10-18)[#](#id9 "Link to this heading") Merged PR [#19: Fix activityparam rename](https://bitbucket.org/cmutel/brightway2-data/pull-requests/19) . 3.6 (2019-10-09)[#](#id10 "Link to this heading") -------------------------------------------------- * Merged multiple pull requests ([#12](https://bitbucket.org/cmutel/brightway2-data/pull-requests/12) , [#13](https://bitbucket.org/cmutel/brightway2-data/pull-requests/13) , [#14](https://bitbucket.org/cmutel/brightway2-data/pull-requests/14) , [#15](https://bitbucket.org/cmutel/brightway2-data/pull-requests/15) , [#16](https://bitbucket.org/cmutel/brightway2-data/pull-requests/16) , [#17](https://bitbucket.org/cmutel/brightway2-data/pull-requests/17) , [#18](https://bitbucket.org/cmutel/brightway2-data/pull-requests/18) ) from Daniël de Koning related to improving the handling of parameters, as part of his work on including parameterization in the [Activity browser](https://github.com/LCA-ActivityBrowser/activity-browser) . ### 3.5.1 (2019-09-05)[#](#id11 "Link to this heading") * Remove temporary directories after tests finish 3.5 (2019-05-16)[#](#id12 "Link to this heading") -------------------------------------------------- * PR #11: Fix for searching with stop words ### 3.4.5 (2019-05-11)[#](#id13 "Link to this heading") * Fix `collections.abc` compatibility with Python 3.8 ### 3.4.4 (2019-01-08)[#](#id14 "Link to this heading") * Make index creation not raise error if index already exists ### 3.4.3 (2018-09-21)[#](#id15 "Link to this heading") * Fix #60: No SQLite index creation after switching projects * Merged PR #9: Better handling of non-unique parameter names ### 3.4.2 (2018-06-01)[#](#id16 "Link to this heading") * Fix #56: Name conflicts with multiple dummy parameters ### 3.4.1 (2018-06-01)[#](#id17 "Link to this heading") * Fix bug with geocollections and search indices 3.4 (2018-05-31)[#](#id18 "Link to this heading") -------------------------------------------------- * Eliminate inconsistency between use of `name` and `variable` by always using `name` ### 3.3.1 (2018-04-23)[#](#id19 "Link to this heading") * Remove print debugging statements 3.3 (2018-04-05)[#](#id20 "Link to this heading") -------------------------------------------------- * Compatibility with Peewee 3 [breaking changes](http://docs.peewee-orm.com/en/latest/peewee/changes.html) 3.2 (2018-02-16)[#](#id21 "Link to this heading") -------------------------------------------------- * Better find symbol name dependencies in exchange formulas 3.1.1 (2018-02-13)[#](#id22 "Link to this heading") ---------------------------------------------------- * Minor compatibility changes for parameters to make unified API 3.1 (2018-01-18)[#](#id23 "Link to this heading") -------------------------------------------------- * Improve performance of `random` (#47) * Added `dynamic_calculation_setups` * All data in search engine stored in lowercase (#35) * Fixes to writing sqlite databases for better interaction with user interfaces (#53) 3.0 (2017-12-2)[#](#id24 "Link to this heading") ================================================= * Add support for hierarchical parameters and formulas (expressed as strings), with automatic and recalculation of dependencies * Make Activity.upstream() more flexible 2.4.7 (2017-09-14)[#](#id25 "Link to this heading") ---------------------------------------------------- * Fix bugs in `merge_databases` 2.4.6 (2017-08-29)[#](#id26 "Link to this heading") ---------------------------------------------------- * Fix bug where `negative` value wasn’t used in exchange proxy uncertainty dictionaries 2.4.5 (2017-08-15)[#](#id27 "Link to this heading") ---------------------------------------------------- * Add database merging function (bw2data.utils.merge\_databases) 2.4.4 (2017-04-17)[#](#id28 "Link to this heading") ---------------------------------------------------- * Fix license text 2.4.3 (2017-04-06)[#](#id29 "Link to this heading") ---------------------------------------------------- * Specify encoding of license file, and then don’t. Yeah computers. 2.4.2 (2017-04-06)[#](#id30 "Link to this heading") ---------------------------------------------------- * Remove dependency on bw2io 2.4.1 (2017-04-05)[#](#id31 "Link to this heading") ---------------------------------------------------- * Include substitution types in `.technosphere()` iterator. Can be excluded with `include_substitution=False`. 2.4 (2017-03-20)[#](#id32 "Link to this heading") -------------------------------------------------- * Write-only locks are now optional and disable by default * Removed `projects.current`. * `Exchanges` is now consistently ordered 2.3.2 (2016-07-17)[#](#id33 "Link to this heading") ---------------------------------------------------- * Specify a sensible order for sorting processed arrays 2.3.1 (2016-07-16)[#](#id34 "Link to this heading") ---------------------------------------------------- * Fixed bug with Activity.copy() * Fixed some bugs with database filtering 2.3 (2016-07-14)[#](#id35 "Link to this heading") ================================================== * Use consistent sorting for all `DataStore` objects. However, this sorting is not guaranteed across machines. * Use `np.save` instead of pickling for processed arrays. * Added `projects.output_dir` and environment variable `BW2_OUTPUT_DIR`. * Removed deprecated functions in `config`. * Add field `code` to search index. 2.2.2 (2016-06-10)[#](#id36 "Link to this heading") ---------------------------------------------------- * Changes to improve testing for bw2data and bw2calc 2.2.1 (2016-06-06)[#](#id37 "Link to this heading") ---------------------------------------------------- * Fix some places where set\_current wasn’t introduced * Rework initialization of projects and add projects tests * Moved tests to main directory Windows tests are failing due to naughty strings being used for project names. 2.2 (2016-06-03)[#](#id38 "Link to this heading") ================================================== * Deprecated `projects.current = 'foo'` in favor or `projects.set_current('foo')` * Added ability to switch to read only project with `projects.set_current('foo', writable=False)` * Removed separate write of topomapping files from inventory databases. All topology handling is internal to bw2regional * Fixed bug where `download_file` wouldn’t raise an error is resource was not found. 2.1 (2016-05-28)[#](#id39 "Link to this heading") ================================================== * Fix database writes not propagating to search index * Added continuous integration tests on Windows * Fix bug when iterating over projects 2.0.2 (2016-05-20)[#](#id40 "Link to this heading") ---------------------------------------------------- * Better `__str__` for metadata * Make projects sortable * Allow forcing writes with `projects.enable_writes(force=True)` 2.0.1 (2016-04-14)[#](#id41 "Link to this heading") ---------------------------------------------------- * Bugfix release to add unstated dependency of `pyprind` 2.0 (2016-04-11)[#](#id42 "Link to this heading") ================================================== 2.0 brings massive changes to how datasets are stored and searched. The first big change is a new default backend, using peewee and SQLite3. This backend has a nicer API, faster random access, and reduced memory consumption. Here are some examples of new usage patterns: * FEATURE: New backend, sqlite, which is the default. Should massively reduce memory consumption in most cases, as entire databases don’t need to be loaded. * FEATURE: Backend now return activity and exchange proxies instead of raw data, making for easier manipulation and construction. Note: Both packages `bw2search` and `bw2simple` are obsolete - their functionality is now included in `bw2data` by default. Data cannot be directly migrated from bw2data < 2; instead, databases should be exported as BW2Package files and then re-imported. 1.4 (2014-11-26)[#](#id43 "Link to this heading") ================================================== * BUGFIX: JSONDatabases are now JSON-serializable. Database variants must now support the keyword argument `as_dict`, and return an actual `dict` if `as_dict=True`. 1.3.3 (2015-02-04)[#](#id44 "Link to this heading") ---------------------------------------------------- * Improve SimaPro and Ecospold2 imports 1.3.2 (2014-10-27)[#](#id45 "Link to this heading") ---------------------------------------------------- * BUGFIX: Added missing `unidecode` dependency. * BUGFIX: Remove error when bw2calc is not installed. 1.3.1 (2014-10-27)[#](#id46 "Link to this heading") ---------------------------------------------------- * BUGFIX: `safe_save` now works on Windows. 1.3 (2014-10-25)[#](#id47 "Link to this heading") ================================================== * FEATURE: Add SimaPro ecospold 1 imports, and create a new import “flavor” called “SimaPro8” that can handle the new way SimaPro breaks ecoinvent 3 activity names. * FEATURE: `utils.safe_save` makes sure a file write is successful before overwriting known good data. * CHANGE: Lots of documentation improvements. * CHANGE: Import comments by default in ecospold 1 & 2. Remove `import_comments.py` file. * CHANGE: Added some ecoinvent 3 units to `normalize_units`. 1.2 (2014-09-04)[#](#id48 "Link to this heading") ================================================== * FEATURE: Add `backends.utils.convert_backend` utility function to switch between database backends. * FEATURE: Added Ecospold 1 & 2 comment importers (`io.import.add_ecospold1_comments` and `io.import_comments.add_ecospold2_comments`). Comments are currently not imported by default. * CHANGE: Ecospold 1 & 2 importers now store file directory as `directory` in metadata. * CHANGE: Each Database should specify its `backend` attribute. 1.1.1 (2014-08-26)[#](#id49 "Link to this heading") ---------------------------------------------------- * BUGFIX: Don’t die if `xlsxwriter` not installed. 1.1 (2014-08-25)[#](#id50 "Link to this heading") ================================================== * FEATURE: Add MATLAB LCI matrix exporter. * FEATURE: Add `make_latest_version` method for SingleFileDatabases, to make reverting easier. * BUGFIX: Make sure `uncertainify` can handle negative amount values. 1.0.3 (2014-08-16)[#](#id51 "Link to this heading") ---------------------------------------------------- * CHANGE: Automatically set `num_cfs` for methods and `number` for databases when `.write()` is called. 1.0.2 (2014-08-14)[#](#id52 "Link to this heading") ---------------------------------------------------- * BUGFIX: Release memory during `Updates.reprocess_all_1_0`. 1.0.1 (2014-08-01)[#](#id53 "Link to this heading") ---------------------------------------------------- * CHANGE: Ecospold2 importer is now more resilient to incorrect input data. * BUGFIX: uncertainify now correctly handles amount <= 0. * Small documentation fixes. 1.0 (2014-07-30)[#](#id54 "Link to this heading") ================================================== **bw2-uptodate.py is required for this update**. Default values for various attributes need to be added when not previously specified. * FEATURE: Pluggable LCI backends. Two backends are provided - SingleFileDatabase and and JSONDatabase, and others can be easily added. A new notebook shows how to use JSONDatabase. * FEATURE: Ecospold2 importer is out of alpha status as of Ecoinvent 3.1. * FEATURE: `bw2-uptodate` should now work without PATH hassles on windows. Name changed from `bw2-uptodate.py`. * FEATURE: Searching databases is better documented and tested. A new notebook shows searching examples. * BREAKING CHANGE: The “in” operator in searching is now “has” - the previous semantics were simply incorrect. * CHANGE: Database exchanges without `type` now raise UntypedExchange error when processed. * CHANGE: Database exchanges without `amount` or `input` now raise InvalidExchange error when processed. * CHANGE: The order of database exchanges in processed arrays is sorted is changed. * CHANGE: LCI database format is now more flexible, and almost all required elements are removed. For example, `{}` is now a valid LCI dataset. * BUGFIX: Allow unicode in `utils.safe_filename`. * BUGFIX: `reset_meta()` now also reset config preferences. 0.17.1 (2014-06-11)[#](#id55 "Link to this heading") ----------------------------------------------------- * CHANGE: Improve resiliency of SimaPro import. 0.17 (2014-04-29)[#](#id56 "Link to this heading") =================================================== * BREAKING CHANGE: Database ‘depends’ is now calculated automatically when calling Database.process(). 0.16 (2014-04-28)[#](#id57 "Link to this heading") =================================================== **bw2-uptodate.py is required for this update** * FEATURE: Added `Database.filepath_intermediate` and `Database.filepath_processed` for easier access to raw data files. * BREAKING CHANGE: All importers now produce unicode strings. Before, the SimaPro importer produced Latin-1 strings, while the XML importers produced UTF-8. * CHANGE: `Database.process()` now uses `obj.filename`, not `obj.name`, as this is not always safe for filenames. 0.15.1 (2014-04-17)[#](#id58 "Link to this heading") ----------------------------------------------------- * FEATURE: Utility functions to view process datasets in web browser * FEATURE: utils.web\_ui\_accessible tests if web UI is running and accessible * CHANGE: SimaPro importer can now add unlinked exchanges as new process datasets * CHANGE: New preference key: “web\_ui\_address” 0.15 (2014-04-11)[#](#id59 "Link to this heading") =================================================== * BREAKING CHANGE: `Database.process` skips exchanges if `type` is not `process`. * FEATURE: `Database.list_dependents` traverses datasets to get linked databases. * CHANGE: Query.**repr** always returns unicode strings. * CHANGE: SimaPro importer can now import input and output comments, including multiline comments 0.14.1 (2014-03-07)[#](#id60 "Link to this heading") ----------------------------------------------------- No changes, just messed up packaging… 0.14 (2014-03-07)[#](#id61 "Link to this heading") =================================================== **bw2-uptodate.py is required for this update** * CHANGE: `BW2Package.export_obj` now uses `obj.filename` instead of `obj.name` for filepath of backup file (needed for LCIA methods). * CHANGE: `categories` is no longer required by `utils.activity_hash`. * CHANGE: `Database.copy()` no longer emits a not registered warning. * CHANGE: `Database.copy()` makes a deep copy of data before modification. * CHANGE: `bw2data.__init__` no longer imports the `io` and `proxies` directories, to avoid namespace conflicts with io standard library package. 0.13 (2014-02-13)[#](#id62 "Link to this heading") =================================================== * BREAKING CHANGE: `Database.process()` now only includes datasets with type `process` in constructing geomapping array. ##0.12.2 (2014-02-04) * CHANGE: BW2Package import file ignores warnings 0.12.1 (2014-02-04)[#](#id63 "Link to this heading") ----------------------------------------------------- New BW2Package format The new BW2Package is not specific to databases or methods, but should work for any data store that implements the DataStore API. This allows for normalization, weighting, regionalization, and others, and makes it easy to backup and restore. 0.12 (2014-02-04)[#](#id64 "Link to this heading") =================================================== **bw2-uptodate.py is required for this update** Safe filenames[#](#safe-filenames "Link to this heading") ---------------------------------------------------------- The algorithm to create filenames was changed to prevent illegal characters being used. See `utils.safe_filename`. 0.11 (2014-01-28)[#](#id65 "Link to this heading") =================================================== **bw2-uptodate.py is required for this update** Upgrades to updates[#](#upgrades-to-updates "Link to this heading") -------------------------------------------------------------------- The update code filename was changed to `updates.py`, and dramatically simplified. Code was organized and moved to an Updates class. All functionality was removed from utility scripts and `bw2-uptodate.py`. Fresh installs should not have erroneous “updates needed” warnings. Generic DataStore makes new matrices easy[#](#generic-datastore-makes-new-matrices-easy "Link to this heading") ---------------------------------------------------------------------------------------------------------------- `data_store.DataStore` defines a template for all data stores which could be processed into matrix data, and provides a lot of functionality for free. New objects subclass `DataStore` or `ImpactAssessmentDataStore`, and need only define their unique data fields, metadata store, and validator. Abstracting common functionality into a simple class hierarchy should also produce fewer bugs. Smaller changes[#](#id66 "Link to this heading") ------------------------------------------------- * BREAKING CHANGE: The filenames for LCIA methods are now derived from the MD5 of the name. This breaks all method abbreviations. * BREAKING CHANGE: The filename and filepath attributes in SerializedDict and subclasses moved from `_filename` and `filepath` to `filename` and `filepath` * BREAKING CHANGE: Register for all data store now takes any keyword arguments. There are no required or positional arguments. * BREAKING CHANGE: Database.process() doesn’t raise an AssertionError for empty databases * FEATURE: Database.process() writes a geomapping processed array (linking activity IDs to locations), in addition to normal matrix arrays. * FEATURE: Tests now cover more functionality, and should allow for more worry-free development in the future. * CHANGE: Database datasets are not required to specify a unit. * CHANGE: The default biosphere database is no longer hard coded, and can be set in config.p\[‘biosphere\_database’\]. The default is still “biosphere”. * CHANGE: The default global location is no longer hard coded, and can be set in config.p\[‘global\_location’\]. The default is still “GLO”. * CHANGE: Ecospold 1 & 2 data extractors now only have classmethods, and these classes don’t need to be instantiated. A more functional style was used to try to avoid unpleasant side effects. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/changelog/link_to_changelog_data.md) ### This Page * [Show Source](../../_sources/content/changelog/link_to_changelog_data.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2calc Changelog — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") `bw2calc` Changelog[#](#bw2calc-changelog "Link to this heading") ================================================================== 2.0.1 (2024-12-10)[#](#id1 "Link to this heading") =================================================== * Update `matrix_utils` dependency 2.0 (2024-11-27)[#](#id2 "Link to this heading") ================================================= * Add `CachingLCA` class which saves supply vector calculations 2.0.DEV23 (2024-09-18)[#](#dev23-2024-09-18 "Link to this heading") -------------------------------------------------------------------- * Allow `MethodConfig` as an input to `MultiLCA` 2.0.DEV22 (2024-09-18)[#](#dev22-2024-09-18 "Link to this heading") -------------------------------------------------------------------- * Add `MethodConfig` to `__init__.py` for better UX 2.0.DEV21 (2024-09-13)[#](#dev21-2024-09-13 "Link to this heading") -------------------------------------------------------------------- * Fix [#108](https://github.com/brightway-lca/brightway2-calc/issues/108) : `MultiLCA` normalizes and weights in all combinations 2.0.DEV20 (2024-09-02)[#](#dev20-2024-09-02 "Link to this heading") -------------------------------------------------------------------- * Bump dependencies as upstream has breaking changes 2.0.DEV19 (2024-09-02)[#](#dev19-2024-09-02 "Link to this heading") -------------------------------------------------------------------- * Fix [#105](https://github.com/brightway-lca/brightway2-calc/issues/105) : `MultiLCA` class returning identical results under iteration 2.0.DEV18 (2024-07-24)[#](#dev18-2024-07-24 "Link to this heading") -------------------------------------------------------------------- * [#101](https://github.com/brightway-lca/brightway2-calc/pull/101) : Convert `technosphere_matrix` to `csr` when using `pypardiso` for speed boost on repeated calculations. * [#104](https://github.com/brightway-lca/brightway2-calc/pull/104) : Explicitly set array-size in MultiLCA’s `lci_calculation()`. Solves bug with a single functional unit passed to `MultiLCA`. 2.0.DEV17 (2024-06-05)[#](#dev17-2024-06-05 "Link to this heading") -------------------------------------------------------------------- ### New `MultiLCA` implementation[#](#new-multilca-implementation "Link to this heading") The new `MultiLCA` implementation support efficient calculation of multiple functional units, impact categories, normalizations, and weightings, and supports advanced features of `bw_processign` datapackages across the complete calculation chain, including scenarios and correlated uncertainty. It also adds usability improvements compared to previous implementations. To perform a `MultiLCA`, you first need to define your configuration. There is a `pydantic` [validator `MethodConfig`](https://github.com/brightway-lca/brightway2-calc/blob/9c94ec64c68103d21f4c7d262c3038e83fb09978/bw2calc/method_config.py#L8) to make sure it is constructed correctly; see its docs for more info. Here is an example `MultiLCA` calculation in action: import bw2data as bd import bw2io as bi \# All the LCI and LCIA data exist in the current project functional\_units \= { "γ": {bd.get\_node(name\="foo").id: 1}, "ε": {bd.get\_node(name\="bar").id: 2}, "ζ": {bd.get\_node(name\="baz").id: 3}, } config \= { "impact\_categories": \[\ ("first", "categ."),\ ("second", "categ."),\ \], "normalizations": { ("am I normal?",): \[\ ("first", "categ."),\ ("second", "categ."),\ \] }, "weightings": {("heavy", "weight"): \[("am I normal?",)\]}, } data\_objs \= bd.get\_multilca\_data\_objs(functional\_units\=functional\_units, method\_config\=config) mlca \= MultiLCA(demands\=functional\_units, method\_config\=config, data\_objs\=data\_objs) mlca.lci() mlca.lcia() mlca.normalize() mlca.weight() mlca.scores \>>> { (("heavy", "weight"), ("am I normal?",), ('first', 'categ.'), 'γ'): 190.31896453011996, (("heavy", "weight"), ("am I normal?",), ('first', 'categ.'), 'ε'): 42.504568745060126, (("heavy", "weight"), ("am I normal?",), ('first', 'categ.'), 'ζ'): 431.9104810103497, (("heavy", "weight"), ("am I normal?",), ('second', 'categ.'), 'γ'): 1205.2506281852936, (("heavy", "weight"), ("am I normal?",), ('second', 'categ.'), 'ε'): 269.17264029471556, (("heavy", "weight"), ("am I normal?",), ('second', 'categ.'), 'ζ'): 5614.00396766416 } One big change compared to previous implementations is the labelling of matrices and results, which is used across the `MultiLCA` class. The `MultiLCA` class can be used for both static and Monte Carlo calculations. You can configure which types of uncertainty to use where with `selective_use`. See the [`MultiLCA` class docs](https://github.com/brightway-lca/brightway2-calc/blob/main/bw2calc/multi_lca.py) for more information. Here is an example of a selective use config. In this case, assuming `use_distributions=False` was passed to the `MultiLCA` constructor, on the characterization and weighting matrices would draw from the probability distribution information provided. { "characterization\_matrix": {"use\_distributions": True}, "weighting\_matrix": {"use\_distributions": True}, } **Gotcha**: In `MultiLCA`, you need to use the selective use flags `characterization_matrix`, `normalization_matrix`, and `weighting_matrix`, even though all three of these are dictionaries, and called `characterization_matrices`, `normalization_matrices`, and `weighting_matrices`. This is because selective use flags can also be used in the base `LCA` class, and use the same code. The flags apply to **all** impact categories, normalizations, and weightings; You would need to write a custom subclass to turn on certain forms of uncertainty only for selected impact categories. Result matrices (`characterized_inventories`, `normalized_inventories`, `weighted_inventories`) are all dictionaries, with each combination of functional unit and impact category/normalization/weighting possible as described in the `MethodConfig`. The values in this dictionary are sparse matrices with the same dimensions as the `inventory`, namely biosphere flows (rows) by processes (columns). ### Other changes[#](#other-changes "Link to this heading") * Removed graph traversal completely - use [bw\_graph\_tools](https://github.com/brightway-lca/bw_graph_tools) instead. * Migrate from `fs` to `fsspec` * Start using [`@` for matrix multiplication](https://peps.python.org/pep-0465/) * Removed `MonteCarloLCA` (normal LCA class can do Monte Carlo) and added `IterativeLCA` (different solving strategy) * Fix miscellaneous deprecated API calls 2.0.DEV16 (2023-10-22)[#](#dev16-2023-10-22 "Link to this heading") -------------------------------------------------------------------- * Fix [#78](https://github.com/brightway-lca/brightway2-calc/issues/78) : Allow for selective use of distributions or arrays depending on matrix label * Fix [#77](https://github.com/brightway-lca/brightway2-calc/issues/77) : Prevent multiple `remap_inventory_dicts` calls * Fix [#71](https://github.com/brightway-lca/brightway2-calc/issues/71) : Poor error message when no LCIA data is supplied * Documentation improvements * Switch packaging to `pyproject.toml` 2.0.DEV15 (2023-10-22)[#](#dev15-2023-10-22 "Link to this heading") -------------------------------------------------------------------- Never happened, can’t prove anything :) 2.0.DEV14 (2023-08-24)[#](#dev14-2023-08-24 "Link to this heading") -------------------------------------------------------------------- * Packaging updates 2.0.DEV13 (2023-05-07)[#](#dev13-2023-05-07 "Link to this heading") -------------------------------------------------------------------- * CI workflow updates * Merge [#65](https://github.com/brightway-lca/brightway2-calc/pull/65) : Add PyPI and conda-forge badge * Fix hidden dependency on `bw2data` 2.0.DEV12 (2022-09-19)[#](#dev12-2022-09-19 "Link to this heading") -------------------------------------------------------------------- * Add some backwards compatiblity methods 2.0.DEV11 (2022-08-31)[#](#dev11-2022-08-31 "Link to this heading") -------------------------------------------------------------------- * Merged [PR #63 Multifunctional graph traversal](https://github.com/brightway-lca/brightway2-calc/pull/63) * Changed `GraphTraversal` to `AssumedDiagonalGraphTraversal`. `GraphTraversal` still exists as a proxy but raises a `DeprecationWarning` 2.0.DEV10 (2022-08-19)[#](#dev10-2022-08-19 "Link to this heading") -------------------------------------------------------------------- * Add `LCA.to_dataframe`, based on work by Ben Portner 2.0.DEV9 (2022-07-07)[#](#dev9-2022-07-07 "Link to this heading") ------------------------------------------------------------------ * [#61 wrap\_functional\_unit missing from multi\_lca.py](https://github.com/brightway-lca/brightway2-calc/pull/58) * MultiLCA is useable again 2.0.DEV8 (2022-06-28)[#](#dev8-2022-06-28 "Link to this heading") ------------------------------------------------------------------ * [#58 use logger at module level, not from LCA](https://github.com/brightway-lca/brightway2-calc/pull/58) * [#59 Fix a number of testing issues](https://github.com/brightway-lca/brightway2-calc/pull/59) 2.0.DEV7 (2022-05-22)[#](#dev7-2022-05-22 "Link to this heading") ------------------------------------------------------------------ * Add `LCA.keep_first_iteration` to make iteration simpler 2.0.DEV6 (2022-04-23)[#](#dev6-2022-04-23 "Link to this heading") ------------------------------------------------------------------ * Add an optional warning on LCA instantiation if excluding resources (arrays or distributions) which could be useful * Add function stubs to be used by subclasses on iteration 2.0.DEV5 (2021-11-26)[#](#dev5-2021-11-26 "Link to this heading") ------------------------------------------------------------------ * Fix a bug in `switch_method` if given a `bw2data` method tuuple instead of a list of datapackages. 2.0.DEV4 (2021-11-03)[#](#dev4-2021-11-03 "Link to this heading") ------------------------------------------------------------------ * Add `invert_technosphere_matrix` with algo from @haasad * Fix `switch_method`, `switch_normalization`, `switch_weighting` Compatibility changes: * `LCA.score` will return weighted or normalized score, if weighting or normalization has been performed * `LCA.weighting` will now trigger a deprecation warning. Switch to `.weight` instead. * `LCA.redo_lci` deprecated in favor of `LCA.lci(demand)`; `LCA.redo_lcia` deprecated in favor of `LCA.lcia(demand)` 2.0.DEV3 (2021-10-17)[#](#dev3-2021-10-17 "Link to this heading") ------------------------------------------------------------------ * Fix for constructing characterization matrices with semi-regionalized impact categories 2.0.DEV2 (2021-10-01)[#](#dev2-2021-10-01 "Link to this heading") ------------------------------------------------------------------ * More 2.5 work and fixes 2.0.DEV1[#](#dev1 "Link to this heading") ========================================== Version 2.0 brings a number of large changes, while maintaining backwards compatibility (except for dropping Py2). The net result of these changes is to prepare for a future where data management is separated from calculations, and where working with large, complicated models is much easier. Future DEV releases[#](#future-dev-releases "Link to this heading") -------------------------------------------------------------------- Before 2.0 is released, the following features will be added: * Presamples will be adapted to use `bw_processing` * Logging will be taken seriously :) * ~~LCA results to dataframes~~ Breaking changes[#](#breaking-changes "Link to this heading") -------------------------------------------------------------- ### Simplification of user endpoints[#](#simplification-of-user-endpoints "Link to this heading") The structure of this library has been simplified, as the `LCA` class can now perform static, stochastic (Monte Carlo), iterative (scenario-based), and single-matrix LCA calculations. Matrix building has been moved to the [matrix\_utils](https://github.com/brightway-lca/matrix_utils) library. ### Python 2 compatibility removed[#](#python-2-compatibility-removed "Link to this heading") Removing the Python 2 compatibility layer allows for much cleaner and more compact code, and the use of some components from the in-development Brightway version 3 libraries. Compatible with `bw2data` version 4.0. ### Removal of classes and methods[#](#removal-of-classes-and-methods "Link to this heading") * `LCA.rebuild_*_matrix` methods are removed. See the [TODO](#) notebook for alternatives. * `DirectSolvingMixin` and `DirectSolvingMonteCarloLCA` are removed, direct solving is now the default * `ComparativeMonteCarlo` is removed, use `MultiLCA(use_distributions=True)` instead * `SingleMatrixLCA` is remove, use `LCA` instead. It allows for empty biosphere matrices. ### Simplified handling of mapping dictionaries[#](#simplified-handling-of-mapping-dictionaries "Link to this heading") Mapping dictionaries map the database identifiers to row and column indices. In 2.5, these mapping dictionaries are only created on demand; avoiding their creation saves a bit of time and memory. Added a new class (`DictionaryManager`) and made it simpler reverse, remap, and get the original dictionaries inside an `LCA`. Here is an example: LCA.dicts.biosphere\[x\] \>> y LCA.dicts.biosphere.original \# if remapped with activity keys LCA.dicts.biosphere.reversed\[y\] \# (generated on demand) \>> x The dictionaries in a conventional LCA are: * LCA.dicts.product * LCA.dicts.activity * LCA.dicts.biosphere ~~`LCA.reverse_dict` is removed; all reversed dictionaries are available at `LCA.dicts.{name}.reversed`~~. In 2.5, these mapping dictionaries are not automatically “remapped” to the `(database name, activity code)` keys. You will need to call `.remap_inventory_dicts()` after doing an inventory calculation to get mapping dictionaries in this format. ### Weighting is a diagonal matrix instead of a single number[#](#weighting-is-a-diagonal-matrix-instead-of-a-single-number "Link to this heading") It is easier to have everything in the same mode of operation. This also allows for the use of arrays, distributions, interfaces, etc. in weighting. Implemented in new `SingleValueDiagonalMatrix` class. Architectual changes[#](#architectual-changes "Link to this heading") ---------------------------------------------------------------------- ### Use of `bw_processing`[#](#use-of-bw-processing "Link to this heading") We now use [bw\_processing](https://github.com/brightway-lca/bw_processing) to load processed arrays. `bw_processing` has separate files for the technosphere and biosphere arrays, and explicit indication of . Therefore, the `TechnosphereBiosphereMatrixBuilder` is no longer necessary, and is removed. ### No dependency on `bw2data`[#](#no-dependency-on-bw2data "Link to this heading") `bw2data` is now an optional install, and even if available only a single utility function is used to prepare input data. `bw2calc` is primarily intended to be used as an independent library. ### Changes in Monte Carlo[#](#changes-in-monte-carlo "Link to this heading") Smaller changes[#](#smaller-changes "Link to this heading") ------------------------------------------------------------ ### New LCA input specification[#](#new-lca-input-specification "Link to this heading") The existing input specification is still there, but this release also adds the ability to specify input arguments compatible with Brightway version 3. Previously, we would write `LCA({some demand}, method=foo)` - this requires `bw2calc` to use `bw2data` to figure out the dependent databases of the functional unit in `some demand`, and then to get the file paths of all the necessary files for both the inventory and impact assessment. The new syntax is `LCA({some demand}, data_objs)`, where `some demand` is already integer IDs, and `data_objects` is a lists of data packages (either in memory or on the filesystem). `bw2data` has a helper function to prepare arguments in the new syntax: `prepare_lca_inputs`. This new input syntax, with consistent column labels for all structured arrays, removes the need for `IndependentLCAMixin`. This is deleted, and the methods `get_vector`, `get_vector_metadata`, and `set_vector` are added. ### More robust matrix building[#](#more-robust-matrix-building "Link to this heading") More tests were identified, and undefined behaviour is now specified. For example, the previous matrix builders assumed that the values in the provided row or column dictionaries were sequential integers starting from zero - this assumption is now relaxed, and we allow this dictionary values to start with an offset. There are also tests and documentation on what happens under various cases when `drop_missing` is `False`, but missing values are present. ### 1.8.0 (2020-02-27)[#](#id3 "Link to this heading") * Replace `.todense` with `.toarray` to satisfy changes in Scipy API * Add `atol` parameter to iterative solver to satisfy changes in Scipy API * Fix regression in 1.7.7 which raises errors when no new `demand` was present ([PR #6](https://bitbucket.org/cmutel/brightway2-calc/pull-requests/6) ) ### 1.7.8 (2019-11-01)[#](#id4 "Link to this heading") * Add check to make sure not all arrays are empty during matrix construction * Allow numpy loading pickled data ### 1.7.7 (2019-10-31)[#](#id5 "Link to this heading") Switch `lca.demand` when running `.redo_lci` or `.redo_lcia`. Thanks Aleksandra Kim! ### 1.7.6 (2019-10-22)[#](#id6 "Link to this heading") Fixed [#25](https://bitbucket.org/cmutel/brightway2-calc/issues/25/function-load_arrays-in-utilspy-unsorted) : Sort array filepaths when loading. Thanks Pedro Anchieta! ### 1.7.5 (2019-09-19)[#](#id7 "Link to this heading") Merged [Pull Request #4](https://bitbucket.org/cmutel/brightway2-calc/pull-requests/4/numpy-array-passthrough/diff) to directly pass Numpy or byte arrays instead of filepaths. Thanks Jan Machacek! ### 1.7.4 (2019-08-23)[#](#id8 "Link to this heading") * Improved support for independent LCA calculations (i.e. without Brightway2 databases, only processed arrays) * Added ability to calculate LCAs in a single matrix (for BONSAI) ### 1.7.3 (2018-10-24)[#](#id9 "Link to this heading") Updated Monte Carlo for upstream presamples changes ### 1.7.2 (2018-08-21)[#](#id10 "Link to this heading") Merged [Pull Request #3](https://bitbucket.org/cmutel/brightway2-calc/pull-requests/3/correcting-flow-and-impact-calculations/diff) to fix some attributes in graph traversals. Thanks Bernhard Steubing! ### 1.7.1 (2018-02-14)[#](#id11 "Link to this heading") Compatibility with `presamples` release version 1.7 (2018-01-18)[#](#id12 "Link to this heading") -------------------------------------------------- Add compatibility with `bw_presamples` ### 1.6.4 (2018-01-12)[#](#id13 "Link to this heading") Really fix bug in seed generation for pooled Monte Carlo calculations ### 1.6.3 (2018-01-11)[#](#id14 "Link to this heading") * [JOSS submission](https://joss.theoj.org/papers/6c24869ed7f1e66b3b837c31579c6fe5) * Fix bug in MultiMonteCarlo * Add some logging to support presamples in the future ### 1.6.2 (2017-04-17)[#](#id15 "Link to this heading") Fix license text ### 1.6.1 (2017-04-06)[#](#id16 "Link to this heading") Simplify indexing 1.6 (2017-04-05)[#](#id17 "Link to this heading") -------------------------------------------------- Replace `bw2speedups` indexing with numpy array trickiness which is ~5 times faster ### 1.5.4 (2017-02-24)[#](#id18 "Link to this heading") Remove non-ascii characters from license text, because [setuptools](#ttps://github.com/pypa/setuptools/issues/984) ### 1.5.3 (2016-10-28)[#](#id19 "Link to this heading") * Restructure imports to not depend on `bw2data` * Use `io.open` in `setup.py` ### 1.5.2 (2016-10-28)[#](#id20 "Link to this heading") Specify encoding of license file ### 1.5.1 (2016-09-15)[#](#id21 "Link to this heading") Bugfix for broken import statement 1.5 (2016-09-15)[#](#id22 "Link to this heading") -------------------------------------------------- Merge pull request from Adrian Haas to enable Pardiso solver usage when available. 1.4 (2016-07-14)[#](#id23 "Link to this heading") -------------------------------------------------- * Added utility functions for `load_calculation_package` and `save_calculation_package` for independent LCAs and cloud computing. * Compatibility with `bw2data` 2.3 ### 1.3.6 (2016-07-01)[#](#id24 "Link to this heading") Fixed bugs where RNG and technosphere matrix builder would change values in arrays meant to be static ### 1.3.5 (2016-07-01)[#](#id25 "Link to this heading") Fix bugs and add tests for `ParameterVectorLCA` ### 1.3.4 (2016-06-10)[#](#id26 "Link to this heading") Changed `ParameterVectorLCA`: Can no longer be called, split off `rebuild_all` into a separate method, added tests. ### 1.3.3 (2016-06-10)[#](#id27 "Link to this heading") Better test coverage and Windows comaptibility ### 1.3.2 (2016-06-08)[#](#id28 "Link to this heading") * FEATURE: Add class and mixin for Monte Carlo using direct solvers * CHANGE: Move tests to root directory and add Monte Carlo tests * CHANGE: Consistent use of `__next__` and `next()` so that all Monte Carlo iterator classes are Py2/3 compatible and programmed the same way. `ParameterVectorLCA.next()` will no longer work on Python 3; instead, call `next(ParameterVectorLCA)`. When providing a new vector, call the class itself (after it is instantiated): `pv = ParameterVectorLCA(args); pv(new_vector)`. ### 1.3.1 (2016-06-06)[#](#id29 "Link to this heading") * CHANGE:Updates for bw2data 2.2 * BUGFIX: Correctly handle regionalized CFs in site-generic calculations * FEATURE: Add contribution methods to LCA classes 1.3 (2016-05-28)[#](#id30 "Link to this heading") -------------------------------------------------- BUGFIX: Correctly handle project names in multiprocess calculations ### 1.2.1 (2016-03-14)[#](#id31 "Link to this heading") BUGFIX: `switch_*` was seriously broken due to new handling of processed arrays filepaths 1.2 (2016-03-14)[#](#id32 "Link to this heading") -------------------------------------------------- * Feature: Py3 compatibility * FEATURE: Independent LCAs which don’t rely on bw2data and the brightway2 ecosystem * Feature: Add `DenseLCA` * FEATURE: Added `switch_*` and `to_dataframe` methods to LCA class * FEATURE: Allow graph traversal to skip links in static databases * BUGFIX: Terminate multiprocessing pools after calculations * CHANGE: Load data automatically in Monte Carlo * CHANGE: Automatically clean dirty databases before starting calculations Plus lots of small bugfixes, and compatibility with `projects`. 1.0 (2015-03-08)[#](#id33 "Link to this heading") ================================================== CHANGE: Split activities and products 0.17.1 (2015-02-13)[#](#id34 "Link to this heading") ----------------------------------------------------- BUGFIX: Don’t require substitution in `TYPE_DICTIONARY`. 0.17 (2015-02-13)[#](#id35 "Link to this heading") --------------------------------------------------- * FEATURE: Properly handle `substitution` type exchanges * CHANGE: Compatible with bw2data version 2 * BUGFIX: Fix handling of nested dependent databases ### 0.16.1 (2014-12-05)[#](#id36 "Link to this heading") * CHANGE: Better documentation for most code. * BUGFIX: Graph traversal handles most coproducts, and raises sensible errors when it can’t. 0.16 (2014-08-03)[#](#id37 "Link to this heading") --------------------------------------------------- FEATURE: Changes in MatrixBuilder should make normal static LCA calculations about three times faster. ### 0.15.1 (2014-07-30)[#](#id38 "Link to this heading") Update dependencies. 0.15 (2014-06-11)[#](#id39 "Link to this heading") --------------------------------------------------- BREAKING CHANGE: Use `Database.filename` for processed data. Requires update to bw2data version 0.16 or greater. 0.13 (2014-04-16)[#](#id40 "Link to this heading") --------------------------------------------------- * BREAKING CHANGE: LCA.fix\_dictionaries now sets/uses `_mapped_dict` to determine if `fix_dictionaries` has been called. * BUGFIX: LCA.build\_demand\_array doesn’t break if `fix_dictionaries` has been called. 0.12 (2014-02-13)[#](#id41 "Link to this heading") --------------------------------------------------- BREAKING CHANGE: Matrix builder will only include parameter array rows that are correctly mapped, instead of raising an error when unmapped rows occur. This behaviour can be turned off by passing `drop_missing=False`. ### 0.11.1 (2014-01-29)[#](#id42 "Link to this heading") BUGFIX: Change column names in method matrix building to be consistent with `bw2data` 0.11 0.11 (2014-01-26)[#](#id43 "Link to this heading") --------------------------------------------------- * BREAKING CHANGE: Graph traversal was reworked, and some functionality for interpreting the output was moved to `bw2analyzer`. * BREAKING CHANGE: Deleted `SimpleRegionalizedLCA` class. Regionalization will be provided in bw2regional. * BREAKING CHANGE: Deleted initial sensitivity work, moved for now to branch, as it was not yet usable. * FEATURE: Much better and more thorough documentation. * FEATURE: Improved testing and test coverage On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/changelog/link_to_changelog_calc.md) ### This Page * [Show Source](../../_sources/content/changelog/link_to_changelog_calc.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Formatting Guide — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Formatting Guide[#](#formatting-guide "Link to this heading") ============================================================== The Brightway Documentation webpage, including the Example Gallery, uses the [MyST markdown format](https://myst-parser.readthedocs.io/en/latest/index.html) . _Markdown_ is a is a lightweight markup language (=text-encoding system) for creating formatted text using a plain-text editor. MyST is a dialect of Markdown that supports many visual elements useful in scientific publishing. Formatting Features[#](#formatting-features "Link to this heading") -------------------------------------------------------------------- For instance, you can use plain text to write a [LaTeX equation](https://en.wikipedia.org/wiki/LaTeX) : $y = mx^2 + b$ which will be rendered as: \\(y = mx^2 + b\\) You can also add page elements, such as colored information boxes: ::: {note} This is an information box ::: which will be rendered as: Note This is an information box Other functions include [cross-references, footnotes, embedded images, tables, colored information boxes and more](https://myst-parser.readthedocs.io/en/latest/index.html) . _“If you can do it in Microsoft Word, you can do it in Markdown!”_ To provide this functionality in Jupyter Notebooks, the Brightway Documentation webpage uses the [MyST-NB](https://myst-nb.readthedocs.io/en/latest/index.html) extension. Reference[#](#reference "Link to this heading") ------------------------------------------------ For a complete overview of the MyST Markdown syntax, please refer to the MyST Markdown Guide. This will covery all cases you might want to use in your edits to the Brightway Documentation webpage: * [MyST Markdown Guide](https://myst-parser.readthedocs.io/en/latest/syntax/typography.html) * [Typography](https://myst-parser.readthedocs.io/en/latest/syntax/typography.html) * [Admonitions](https://myst-parser.readthedocs.io/en/latest/syntax/admonitions.html) * [Images/Figures](https://myst-parser.readthedocs.io/en/latest/syntax/images_and_figures.html) * [Tables](https://myst-parser.readthedocs.io/en/latest/syntax/tables.html) * [API](https://myst-parser.readthedocs.io/en/latest/syntax/code_and_apis.html) * [Cross References](https://myst-parser.readthedocs.io/en/latest/syntax/cross-referencing.html) * [Math and Equations](https://myst-parser.readthedocs.io/en/latest/syntax/cross-referencing.html) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/contributing/formatting.md) ### This Page * [Show Source](../../_sources/content/contributing/formatting.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Negative or Confusing LCA Results — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Negative or Confusing LCA Results[#](#negative-or-confusing-lca-results "Link to this heading") ================================================================================================ Why is my average stochastic LCA score so different from my static score?[#](#why-is-my-average-stochastic-lca-score-so-different-from-my-static-score "Link to this heading") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- When performing Monte Analysis, we are at the mercy of the uncertainty descriptions given in our data. If these values are different than the fixed static value, then our uncertainty analysis will naturally produce different results and statistical moments. The exact cause of this difference varies depending on the modelling assumptions you have used and the databases you are using. We have seen the following: * Databases which use the [lognormal distribution](https://en.wikipedia.org/wiki/Log-normal_distribution) extensively, but use the [_median_ value of the distribution for the static value](https://chris.mutel.org/too-confusing.html) . The median of the lognormal is always less than the average, and the difference between these results depends on how wide the distribution is. This is [often the case with ecoinvent](https://chris.mutel.org/ecoinvent-lognormal.html) , for example. Consider reporting the median instead of the mean of the uncertainty analysis distribution to weaken this effect. * Databases have errors in their uncertainty data which bias uncertainty results toward higher numbers. Databases which use asymmetric distributions like the lognormal extensively need to pay special attention to the uncertainty parameters, as even a single incorrect value can significantly change LCA scores. See [this notebook](https://github.com/brightway-lca/brightway2/blob/master/notebooks/Investigating%20interesting%20Monte%20Carlo%20results.ipynb) on diagnosing such a problem in ecoinvent 3.8, and [this notebook](https://github.com/brightway-lca/brightway2/blob/master/notebooks/Fixing%20large%20uncertainty%20distributions.ipynb) on how to fix it. Do my unit processes need to produce a _net_ or _gross_ production amount of one?[#](#do-my-unit-processes-need-to-produce-a-net-or-gross-production-amount-of-one "Link to this heading") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- You don’t need to normalize your data in Brightway! This is just another step where math or data errors can enter the process. Instead, it’s much easier to put in the actual measure amounts of all inputs and outputs. Consumers of your outputs can still ask for however much of the functional products they need, and Brightway will get the math right. See [this blog post](https://chris.mutel.org/non-unitary.html) on non-unitary production amounts, and [this blog post](https://chris.mutel.org/too-confusing.html) on self-consumption in LCA. Why do I get negative static LCA results?[#](#why-do-i-get-negative-static-lca-results "Link to this heading") --------------------------------------------------------------------------------------------------------------- Depending on the LCIA method and functional unit, some LCA scores might be negative. Not everything is bad for the environment! We often do LCA of carbon capture or [phytoremediation](https://en.wikipedia.org/wiki/Phytoremediation) . See the [LCA cheat sheet](../cheatsheet/lca.html) for ways to isolate where negative impacts are coming from. Why do I get negative stochastic LCA results?[#](#why-do-i-get-negative-stochastic-lca-results "Link to this heading") ----------------------------------------------------------------------------------------------------------------------- If you static score is positive, but you see negative scores when doing Monte Carlo analysis, there can be several factors at play: * The uncertainty data could just be [be incorrect](#difference-stochastic) . * The uncertainty data could include agricultural processes where some flows are modelled with a [normal distribution](https://en.wikipedia.org/wiki/Normal_distribution) which has a very small mean value, and a very high standard deviation. In these cases, there is a roughly fifty percent chance that the scores will be negative. * There could be cases where an input is both produced and consumed in a process. For example, it is common to have both land transformation into and out of a process; water use is often modelled the same way. In this case, the database does not include logical links between the input and the output, and each has their own uncertainty distributions. These two distributions are sampled _independently_, and it relatively common for the output amount to draw a higher sample than the input amount, meaning that a resource is being net produced or an emission is being net removed from the environment. The only way to fix this is with a different modelling paradigm which reflects logical relationships or physical constraints, and better data. * Similarly, if a process models water intake and output separately, but uses different flows for the input and output, then its possible for the impact category to characterize them differently (or not characterize one at all), allowing for unusual results to appear during Monte Carlo analysis. See more discussion on a [Brightway development discussion thread](https://brightway.groups.io/g/development/topic/negative_values_in/105163086) . On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/negative_results.md) ### This Page * [Show Source](../../_sources/content/faq/negative_results.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Importing Data — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Importing Data[#](#importing-data "Link to this heading") ========================================================== The philosophy and workflow for importing data is explained on [the Overview page](../overview/index.html) . Before starting an Import Make sure you have the basic data, such as background data and biosphere flows available. It will probably be needed to create links with your imported data. Creating Importers[#](#creating-importers "Link to this heading") ------------------------------------------------------------------ ### How do I start an import from the Brightway excel template?[#](#how-do-i-start-an-import-from-the-brightway-excel-template "Link to this heading") importer \= bi.ExcelImporter('') See [`bw2io.importers.excel.ExcelImporter`](../api/bw2io/importers/excel/index.html#bw2io.importers.excel.ExcelImporter "bw2io.importers.excel.ExcelImporter") for additional information. ### How do I start an import from SimaPro CSV?[#](#how-do-i-start-an-import-from-simapro-csv "Link to this heading") from pathlib import Path importer \= bi.SimaProBlockCSVImporter(Path('')) See [`bw2io.importers.simapro_block_csv.SimaProBlockCSVImporter`](../api/bw2io/importers/simapro_block_csv/index.html#bw2io.importers.simapro_block_csv.SimaProBlockCSVImporter "bw2io.importers.simapro_block_csv.SimaProBlockCSVImporter") for additional information. ### How do I start an import from Ecospold 1?[#](#how-do-i-start-an-import-from-ecospold-1 "Link to this heading") importer \= bi.SingleOutputEcospold1Importer('', '') See [`bw2io.importers.ecospold1.SingleOutputEcospold1Importer`](../api/bw2io/importers/ecospold1/index.html#bw2io.importers.ecospold1.SingleOutputEcospold1Importer "bw2io.importers.ecospold1.SingleOutputEcospold1Importer") for additional information. ### How do I start an import from Ecospold 1?[#](#id1 "Link to this heading") importer \= bi.SingleOutputEcospold2Importer('', '') See [`bw2io.importers.ecospold2.SingleOutputEcospold2Importer`](../api/bw2io/importers/ecospold2/index.html#bw2io.importers.ecospold2.SingleOutputEcospold2Importer "bw2io.importers.ecospold2.SingleOutputEcospold2Importer") for additional information. Ecoinvent[#](#ecoinvent "Link to this heading") ------------------------------------------------ ### How can I import an ecoinvent release using the online portal?[#](#how-can-i-import-an-ecoinvent-release-using-the-online-portal "Link to this heading") bi.import\_ecoinvent\_release( version\='', system\_model\='', username\='', password\='' ) The `import_ecoinvent_release` function will create a namespaced set of impact categories and a separate namespaced biosphere `Database`. Warning The setup function `bw2setup()` is deprecated and should no longer be used. See [`bw2io.ecoinvent.import_ecoinvent_release`](../api/bw2io/ecoinvent/index.html#bw2io.ecoinvent.import_ecoinvent_release "bw2io.ecoinvent.import_ecoinvent_release") for customization options, and the [`ecoinvent_interface` documentation](https://github.com/brightway-lca/ecoinvent_interface/?tab=readme-ov-file#authentication-via-settings-object) for instructions on how to download additional ecoinvent data and save your credentials. ### How can I import a local copy of an ecoinvent release?[#](#how-can-i-import-a-local-copy-of-an-ecoinvent-release "Link to this heading") Start with a basic project which has the correct set of elementary flows for your given release - see [Creating initial project data](projects.html#initial-project-data) . You can then use the standard ecospold2 importer: importer \= bi.SingleOutputEcospold2Importer( dirpath\='', db\_name\='' ) importer.apply\_strategies() importer.write\_database() We strongly recommend that you follow the `ecoinvent--` database naming pattern. Applying Transformations[#](#applying-transformations "Link to this heading") ------------------------------------------------------------------------------ ### How do I apply the default transformation strategies?[#](#how-do-i-apply-the-default-transformation-strategies "Link to this heading") importer.apply\_strategies() ### How do I apply a custom transformation strategy?[#](#how-do-i-apply-a-custom-transformation-strategy "Link to this heading") importer.apply\_strategy() ### How do I write a custom transformation strategy?[#](#how-do-i-write-a-custom-transformation-strategy "Link to this heading") Transformation functions must take the entire import data as the single input argument, and return the modified entire import data. They should follow this general pattern: from typing import List def my\_custom\_strategy(data: List\[dict\]) \-> List\[dict\]: """Add very import information to each dataset""" for dataset in data: dataset\["this is a dataset"\] \= True return data If you need to provide additional information to a transformation strategy, you can [curry](https://en.wikipedia.org/wiki/Currying) the transformation function: from typing import List from functools import partial def my\_custom\_strategy(data: List\[dict\], favorite\_color: str) \-> List\[dict\]: """Add very import color information""" for dataset in data: dataset\["my favorite color"\] \= favorite\_color return data importer.apply\_strategy(partial(my\_custom\_strategy, favorite\_color\="blue")) ### How do I change the default strategies?[#](#how-do-i-change-the-default-strategies "Link to this heading") `importer.strategies` is a list, and the normal Python list methods can be used to modify the list before `.apply_strategies()` is called. You can also replace `importer.strategies` completely: importer.strategies \= \[\] ### How can I apply static transformations from [randonneur\_data](https://github.com/brightway-lca/randonneur_data) ?[#](#how-can-i-apply-static-transformations-from-randonneur-data "Link to this heading") importer.randonneur('') See [`bw2io.importers.base_lci.LCIImporter.match_database`](../api/bw2io/importers/base_lci/index.html#bw2io.importers.base_lci.LCIImporter.match_database "bw2io.importers.base_lci.LCIImporter.match_database") for customization of this function’s behavior. Linking Status[#](#linking-status "Link to this heading") ---------------------------------------------------------- ### How can I quickly check if all edges are linked?[#](#how-can-i-quickly-check-if-all-edges-are-linked "Link to this heading") importer.all\_linked ### How can I see how many edges have been linked so far?[#](#how-can-i-see-how-many-edges-have-been-linked-so-far "Link to this heading") importer.statistics() ### How can I export an Excel file of the unlinked edges?[#](#how-can-i-export-an-excel-file-of-the-unlinked-edges "Link to this heading") filepath \= importer.write\_excel(only\_unlinked\=True) ### How can I export a Randonneur template for matching unlinked edges?[#](#how-can-i-export-a-randonneur-template-for-matching-unlinked-edges "Link to this heading") filepath \= importer.create\_randonneur\_excel\_template\_for\_unlinked() See [`bw2io.importers.base_lci.LCIImporter.create_randonneur_excel_template_for_unlinked`](../api/bw2io/importers/base_lci/index.html#bw2io.importers.base_lci.LCIImporter.create_randonneur_excel_template_for_unlinked "bw2io.importers.base_lci.LCIImporter.create_randonneur_excel_template_for_unlinked") for customization of this function’s behavior. Handling Unlinked Edges[#](#handling-unlinked-edges "Link to this heading") ---------------------------------------------------------------------------- ### How can I iterate over all unique unlinked edges?[#](#how-can-i-iterate-over-all-unique-unlinked-edges "Link to this heading") for edge in importer.unlinked: do\_something(edge) ### How can I delete unlinked edges?[#](#how-can-i-delete-unlinked-edges "Link to this heading") importer.drop\_unlinked(i\_am\_reckless\=True) ### How can I add biosphere nodes from my imported data?[#](#how-can-i-add-biosphere-nodes-from-my-imported-data "Link to this heading") You can leave such biosphere nodes in the `Database` you are going to create, but you can separate them out into a new `Database`: importer.create\_new\_biosphere('') You can also add them to an existing database: importer.add\_unlinked\_flows\_to\_biosphere\_database('') ### How can I create placeholder process or product nodes referenced in my imported data but without any producers?[#](#how-can-i-create-placeholder-process-or-product-nodes-referenced-in-my-imported-data-but-without-any-producers "Link to this heading") importer.add\_unlinked\_activities() On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/cheatsheet/importing.md) ### This Page * [Show Source](../../_sources/content/cheatsheet/importing.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Importing — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Importing[#](#importing "Link to this heading") ================================================ Leaning from examples Importing data is the worst part of the LCA world, and it is easy to get overwhelmed. This document discusses basic concepts, but also includes a set of examples that show the concepts in practice. Prepared projects Some data has already been prepared for Brightway, so you can skip doing the import yourself. Look at the [initial project data](../cheatsheet/index.html#creating-initial-project-data) and at [`bw2io.ecoinvent.import_ecoinvent_release`](../api/bw2io/ecoinvent/index.html#bw2io.ecoinvent.import_ecoinvent_release "bw2io.ecoinvent.import_ecoinvent_release") . Introduction[#](#introduction "Link to this heading") ------------------------------------------------------ There are some standards for life cycle inventory data, but the sad truth is that there are no really good standards, and each implementation of the standards by different software providers has its own quirks. The biggest difficulty we face is in constructing the supply chain graph from its serialization in the given data format. In the most basic case, a graph can be written: nodes \= \['A', 'B'\] edges \= \[{'from': 'A', 'to': 'B', 'amount': 42}\] In this case, there is a a single unambiguous identifier for each node, and everything is easy. In the real world, edges are normally defined by the _attributes_ of the referenced nodes, like this: nodes \= \[{\ 'id': 1,\ 'name': 'foo'\ }, {\ 'id': 2,\ 'name': 'bar'\ }\] edges \= \[{'from': 'foo', 'to': 'bar', 'amount': 42}\] This type of data exchange format is convenient for data creators, as some formats simply lack a single unambiguous identifier, and in others this identifier is generated at run-time. **However**, to use this data we now need to figure out that the node with name “foo” is the one with “id” `1` - and real world matching is more complex than this simple example, and needs to be done hundreds or thousands of times. In general, we need to write our import logic assuming that we will have to do attribute matching. Each main LCA data format comes with its own set of challenges: | Format | Gotchas | | --- | --- | | ecospold 1 | Unique identifier is `number`, but some software doesn’t use this correctly, so it can’t be counted on | | ecospold 2 | Separate UUIDs for activity and product, but they aren’t easy to find, and you need to combine them to get a single identifier for a process with a reference process located in time and space | | SimaPro CSV | No guarantee of any attribute uniqueness, exports don’t always include internal ids, attributes changed from original data for common background databases, exported data can include errors[\[1\]](#id2) | | Excel | Potential whitespace errors, no support for anything but primitive data types, custom templates require custom code | | OLCA JSON-LD | Format can change in incompatible ways, lots of NIH | | ILCD | Everything we love about XML, better for individual datasets than complete databases, in practice requires using EU elementary flow list and UUID mapping | | Exiobase | Not a single format, elementary flow list changes over time | The basic strategy for importing data is the following: First, data is extracted from the given format. Extraction is done using a format-specific extractor. Currently, there are extractors for `ecospold1`, `ecospold2`, `simapro CSV`, `exiobase`, and the standard Brightway `excel` template. Next, we have to choose where and how to transform the data, either for direct import or for linking to other databases already present. Harmonization could mean transforming the data to fit a certain taxonomy, to fit a certain data model, or to meet other data modelling assumptions. There is a lot of variety in LCA data formats, and the most popular software allows for a lot of flexibility, so there are no general rules. We then need to create concrete links in each edge - i.e. to turn `'from': 'foo'` to `'from': 1`. To do this, we define the fields we want to link with, and use the built-in `Brightway` linking functionality. This is normally an iterative process, trying different linking approaches combined with harmonization and examining the linking status until the imported data is completely linked. Finally, we can load the data into our relational data store, and use it in models or calculations. Transforming Nodes or Edges[#](#transforming-nodes-or-edges "Link to this heading") ------------------------------------------------------------------------------------ In general, we want to avoid transformations, as it is cleaner and less future work to use the original data as it was provided. Transformations are a necessary evil used for two main purposes: * To align the data with a given data schema or set of modelling assumptions * To allow for linking, and especially for linking across databases. Linking is always finding a suitable edge candidate, so transformations for linking are almost always on edges, not nodes, as we can normally assume that imported data is internally consistent. Transforming nodes can be done, though; here are some common scenarios: * You want all data to be harmonized to a certain taxonomy. Brightway prefers that units be written in full, for example, so you could normalize all unit strings to “kilogram”, etc. * You want to reverse changes made by a data provider. For example, some databases are built on top of other databases, and if we have those other databases already imported, we would like to remove the existing link and re-link to our versions of the background data. This normally means removing the copied nodes in the imported data. * You need to adapt the provided data to better fit a specific set of assumptions, a data quality standard, or a data schemas. Static Transformations[#](#static-transformations "Link to this heading") -------------------------------------------------------------------------- Static transformations are pre-computed, and come prepared in a fixed format. `Brightway` has a number of static transformations available in the [randonneur\_data](https://github.com/brightway-lca/randonneur_data) library. Static transformations are great when they work. Please be careful to read their descriptions, match versions precisely, and check to make sure they are doing what you expect! Static transformations will also not perform linking - they will prepare the data to be compatible so that it can be linked afterwards. The most common static transformations in normal practice are updating references from one background database version to a newer version before linking, and undoing modifications to allow for linking against original data. Here is an example of updating references: import randonneur\_data as rd registry \= rd.Registry() registry.sample('ecoinvent-3.9.1-biosphere-ecoinvent-3.10-biosphere') { 'replace': \[{\ 'source': {\ 'name': 'Xylene',\ 'uuid': '0e6cf9f9-44ff-4395-ad3b-36109a32e6eb'\ },\ 'target': {\ 'name': 'Xylenes, unspecified',\ 'formula': 'C8H10',\ 'uuid': '0e6cf9f9-44ff-4395-ad3b-36109a32e6eb'\ },\ 'comment': 'Flow attribute change not listed in change report'\ },\ {\ 'source': {\ 'uuid': 'ce11d77b-c85a-4f03-816e-714dcda260ea',\ 'name': 'Americium-241'\ },\ 'target': {\ 'uuid': 'a0e98cdc-79cd-4073-9713-c1a48238883a',\ 'name': 'Americium-241'\ }\ }\] } Similarly, here is a transformation from one nomenclature system to another for the same data: import randonneur\_data as rd registry \= rd.Registry() registry.sample('simapro-ecoinvent-3.9.1-cutoff', 1) { 'replace': \[{\ 'source': {\ 'identifier': 'EI3ARUNI000011519609842',\ 'name': 'Ventilation of dwellings, decentralized, 6 x 120 m3/h {CH}| ventilation of dwellings, decentralized, 6 x 120 m3/h, polyethylene ducts, with earth tube heat exchanger | Cut-off, U',\ 'platform\_id': '35E3AE4E-798C-40F1-A9A2-626BE36D8367'\ },\ 'target': {\ 'filename': '2578e5c8-8fdd-5a68-bb93-525f992fafd8\_60c21de1-a8e8-4f50-8949-78759bf96c62.spold',\ 'name': 'ventilation of dwellings, decentralized, 6 x 120 m3/h, polyethylene ducts, with earth tube heat exchanger',\ 'location': 'CH',\ 'reference product': 'ventilation of dwellings, decentralized, 6 x 120 m3/h',\ 'unit': 'm2\*year'\ }\ }\ \]} The complete transformation data format includes [useful metadata](https://github.com/brightway-lca/randonneur?tab=readme-ov-file#data-format) in addition to the raw changes. ### Applying Static Transformations[#](#applying-static-transformations "Link to this heading") TBD In order to use these transformations, we need to think about and specify the following: * Do I want to do destructive changes (delete and create), or just modifications (replace, update, and disaggregate)? * Are the labels used in the transformation data correct for my data schema? * What fields do we want to use for matching to determine if the transformation should be applied? ### Creating New Static Transformations[#](#creating-new-static-transformations "Link to this heading") TBD Static transformations should be added to a `randonneur_data` regis See [`bw2io.importers.base_lci.LCIImporter.randonneur`](../api/bw2io/importers/base_lci/index.html#bw2io.importers.base_lci.LCIImporter.randonneur "bw2io.importers.base_lci.LCIImporter.randonneur") on how to customize these choices. Prepared static transformations can be generated in two ways - programmatically, or manually. Programmatic generation is always preferred, as it should be tested, is reproducible, and can be adapted for new contexts or input lists. However, manual matching is sometimes necessary. Manual matches should be noted clearly in the transformation file comment. The [flowmapper](https://github.com/cmutel/flowmapper/) tool allows for automatic matching of elementary flow lists. Technosphere flow matching is usually custom developed, as there are few generic patterns to follow. The [ecoinvent\_migrate](https://github.com/brightway-lca/ecoinvent_migrate) library is an exception, and generates prepared static transformations for ecoinvent technosphere and biosphere upgrades. Dynamic Transformations[#](#dynamic-transformations "Link to this heading") ---------------------------------------------------------------------------- Dynamic transformations are done programmatically - i.e. a function takes in a dataset, does some changes, and returns the altered dataset. There are many such functions already available in the Brightway framework. Here are a few: * [`bw2io.strategies.generic.add_database_name`](../api/bw2io/strategies/generic/index.html#bw2io.strategies.generic.add_database_name "bw2io.strategies.generic.add_database_name") * [`bw2io.strategies.generic.convert_uncertainty_types_to_integers`](../api/bw2io/strategies/generic/index.html#bw2io.strategies.generic.convert_uncertainty_types_to_integers "bw2io.strategies.generic.convert_uncertainty_types_to_integers") * [`bw2io.strategies.ecospold2.add_cpc_classification_from_single_reference_product`](../api/bw2io/strategies/ecospold2/index.html#bw2io.strategies.ecospold2.add_cpc_classification_from_single_reference_product "bw2io.strategies.ecospold2.add_cpc_classification_from_single_reference_product") * [`bw2io.strategies.ecospold2.remove_uncertainty_from_negative_loss_exchanges`](../api/bw2io/strategies/ecospold2/index.html#bw2io.strategies.ecospold2.remove_uncertainty_from_negative_loss_exchanges "bw2io.strategies.ecospold2.remove_uncertainty_from_negative_loss_exchanges") * [`bw2io.strategies.simapro.change_electricity_unit_mj_to_kwh`](../api/bw2io/strategies/simapro/index.html#bw2io.strategies.simapro.change_electricity_unit_mj_to_kwh "bw2io.strategies.simapro.change_electricity_unit_mj_to_kwh") In general, even if you are just writing a quick script for a one-off import, it’s best practice to write transformation functions which have documentation and some simple unit tests. This development work forces you to think about what you are trying to accomplish, and what could go wrong. Here are some examples of typical harmonization steps: * Next, each dataset is normalized or transformed to make it better conform to what Brightway2 expects. This could mean, for example, copying the only production exchange to the list of `products`, or normalizing the units or biosphere category names. This step could also include applying migrations, which are additional dataset that can be used to transform data to new forms. For example, SimaPro changes ecoinvent activity and product names, and the `simapro-ecoinvent-3` changes these names back to what ecoinvent provided. Migrations are explained in more detail below. * The third step is to link exchanges to activities within the imported data. Brightway2 has a powerful generic linking function called `link_iterable_by_fields` that does the heavy lifting. This function will link an exchange if the fields match, i.e. it has the same name, location, unit, etc. `link_iterable_by_fields` can also be told to only link certain types of exchanges, such as biosphere exchanges. * Many imported datasets will link to other databases already installed on your computer. You can link these exchanges using the `.match_database()` function. You can customize this function by specifying the fields to use, as well as other options. * You should then check on the quality of linking using the `statistics()` function, which will tell you how many exchanges are in the data, and how many unlinked exchanges are present, as well as the types of unlinked exchanges. * You are finally ready to choose what to do with the imported data. If all exchanges are linked, you can write a new database with `.write_database()`. You can also save your work with `.write_unlinked(name)`, which will save a new unlinked database for further processing at a later time. You can also write details on linking with `.write_excel()`, which can write the entire data or just the unlinked exchanges. Of course, you can always continue with steps 2, 3, and 4, refining your linking until you are satisfied. If this seems a bit overwhelming, that’s because it is - and a huge pain. The current data formats and lack of well-defined strategies for interchange between databases and even updating databases makes life much more difficult than it should be. There are concrete examples of importing databases in `example-io-notebooks`. ### Importing from `ecospold 1`[#](#importing-from-ecospold-1 "Link to this heading") Importing from ecospold 1 is relatively simple. Multioutput products are allocated to single output products using the given allocation factors using the strategy `es1_allocate_multioutput`. The reference product is then assigned using the strategy `assign_only_product_as_production`. Next, some basic data cleanup is performed. Integer codes are removed, as these are not used consistently by different LCA software (`clean_integer_codes`). Unspecified subcategories are removed (i.e. `('air', 'unspecified')` is changed to `('air',)`) using `drop_unspecified_subcategories`. Biosphere exchange names and categories are normalized using `normalize_biosphere_categories` and `normalize_biosphere_names`. Biosphere exchanges are removed, as biosphere flows do not have locations (`strip_biosphere_exc_locations`). Next, a unique activity code is generated for each dataset, using a combination of the name, categories, location, and unit (`set_code_by_activity_hash`). Finally, biosphere flows are linked to the default biosphere database, and internal technosphere flows are linked using `link_technosphere_by_activity_hash`. Import[#](#import "Link to this heading") ------------------------------------------ ### Importing from `ecospold 2`[#](#importing-from-ecospold-2 "Link to this heading") Importing from ecospold 2 is a bit complex, because although ecospold 2 gives unique IDs for many fields, which helps in linking, the current implementation has some `known issues`(http://www.ecoinvent.org/database/ecoinvent-version-3/ecoinvent-v30/known-data-issues/) which have to be resolved or ignored by the importer. Warning Brightway2 cannot precisely reproduce the LCI and LCIA results given by the ecoinvent centre. The technosphere matrix used by ecoinvent cannot be reproduced from the provided unit process datasets. However, the differences for most products are quite small. We start by removing some exchanges from most datasets. Specifically, we remove exchanges with amounts of zero, both coproducts and technosphere or biosphere inputs (`remove_zero_amount_coproducts` and `remove_zero_amount_inputs_with_no_activity`). We then assign reference products. Although each unit process should have a single output, coproducts which have been allcoated away are often still included, with amounts of zero. We use two strategies to choose the reference product: `es2_assign_only_product_with_amount_as_reference_product` and `assign_only_product_as_production`. Next, a composite code is generated, using the UUID of the activity and the product (`create_composite_code`). Biosphere flow exchanges are now normalized (`drop_unspecified_subcategories`) and linked (`link_biosphere_by_flow_uuid`). Internal technosphere exchanges are also linked, using the composite codes (`link_internal_technosphere_by_composite_code`). Not all technosphere exchanges are linked, however. We need to drop two different types of exchanges, as we have no way of linking them. First, there are some exchanges with listed products but no listed activities - and no activity in the database produces these products. Removal is done with the strategy `delete_exchanges_missing_activity`. Additionally, there are some exchanges with listed products and activities - but the given activity doesn’t produce the listed product. These exchanges also have to be deleted, using the strategy `delete_ghost_exchanges`. Note Ecoinvent 3.1 includes some dummy biosphere flows (`Fluoranthene_temp`, `Chrysene_temp`, etc.). They can be safely deleted using using `.drop_unlinked(True)`. ### Importing from SimaPro[#](#importing-from-simapro "Link to this heading") Importing SimaPro CSV files is also a bit of a headache. Pré, the makers of SimaPro, have done a lot of work to make LCA software accessible and understandable. This work includes making changes to process names and other metadata, which makes linking these processes back to original ecoinvent data difficult. Fortunately, Pré has been very helpful is supplying correspondence files, which we can use to move (to the best of our ability) from the “SimaPro world” to “ecoinvent world”. Note Importing SimaPro XML export files is not recommended, as there are bugs with exporting ecoinvent 3 processes. ### Importing from the Standard Excel Template[#](#importing-from-the-standard-excel-template "Link to this heading") Note You can see these ideas in practive in `basic database`(https://github.com/brightway-lca/brightway2-io/blob/master/tests/fixtures/excel/basic\_example.xlsx?raw=true) and `parameterized database`(https://github.com/brightway-lca/brightway2-io/blob/master/tests/fixtures/excel/sample\_activities\_with\_variables.xlsx?raw=true) Excel templates. You can define inventory datasets in many ways in Excel, but there is a standard template which is supported by the `ExcelImporter`. The template should be pretty self-explanatory, and follows this general format: Project parameters (optional) sp.statistics() 366 datasets 3991 exchanges 2639 unlinked exchanges Type biosphere: 170 unique unlinked exchanges Type technosphere: 330 unique unlinked exchanges The options to examine or resolve the unlinked exchanges are: * You can write a spreadsheet of the characterization factors, including their linking status, with `.write_excel("some name")`. * You can apply new linking strategies with `.apply_strategies(some_new_strategy)`. Note that this method requires a _list_ of strategies. * You can match technosphere or biosphere exchanges to other background databases using `.match_database("another database")`. To resolve unlinked biosphere exchanges which simply don’t exist in your current biosphere database, you can: * Add them to the biosphere database with `add_unlinked_flows_to_biosphere_database()` * Create a new biosphere database with`create_new_biosphere("new biosphere name")` * Add the biosphere flows to the database you are currently working on (LCI databases can include both process and biosphere flows) with \`add\_unlinked\_biosphere\_flows\_to\_current\_database() Note These methods have several options, and you should understand what they do and read their documentation before choosing between them. Note You can’t write an LCI database with unlinked exchanges. ### Migrations[#](#migrations "Link to this heading") Sometimes the only way to correctly link activities or biosphere flows is by applying a list of name (or other field) transforms. For example,SimaPro will export a process named “\`sulfonyl\`urea-compound {RoW}| production | Alloc Rec, S”, which corresponds to the ecoinvent process “\`sulfonyl\`urea-compound production”, with reference product “\`sulfonyl\`urea-compound” and location “RoW”. In another example, in ecoinvent 2, emissions of water to air were measured in kilograms, and in ecoinvent 3, emissions of water to air are measured in cubic meters. In this case, our migration would look like this: { 'fields': \`'name', 'categories', 'type', 'unit'\`, 'data': \` ( \## First element is input data in the order of \`fields\` above ('Water', ('air',), 'biosphere', 'kilogram'), \## Second element is new values to substitute { 'unit': 'cubic meter', 'multiplier': 0.001 } ) \` } We call the application of transform lists “migrations”, and they are applied with the `.migrate(migrations_name)` method. If the numeric values in an exchange need to changed, the special key ‘multiplier’ is used, where new\_amount = multiplier \* old\_amount. Uncertainty information and formulas are adjusted automatically, if possible (see `utils.rescale_exchange`). A few additional notes: * Migrations change the underlying data, but do not do any linking - you will also have to apply linking strategies after a migration. * Migrations can specify any number of fields, but of course the fields must be present in the importing database. * TODO: Migrations can be specified in an excel template. Template files must be processed using `convert_migration_file`. * Subcategories are not expanded automatically, so a separate row in the migrations file would be needed for e.g. `water (air, non-urban air or from high stacks)`. ### Importing an LCIA Method[#](#importing-an-lcia-method "Link to this heading") LCIA methods can be imported from ecospold 1 XML files (`EcoinventLCIAImporter`) and SimaPro CSV files (`SimaProLCIACSVImporter`). When importing an LCIA method or set of LCIA methods, you should specify the biosphere database to link against e.g. `EcoinventLCIAImporter("some file path", "some biosphere database name")`. If no biosphere database name is provided, the default `biosphere3` database is used. Both importers will attempt to normalize biosphere flow names and categories to the ecospold2 standard, using the strategies: * `normalize_simapro_lcia_biosphere_categories` * `normalize_simapro_biosphere_names` * `normalize_biosphere_names` * `normalize_biosphere_categories` Next, the characterization factors are examined to see if they are only given for root categories, e.g. `('air',)` and not `('air', 'urban air close to ground')`. If only root categories are characterized, then we assume that the characterization factors also apply to all subcategories, using the strategy `match_subcategories`. Finally, linking to the given or default biosphere database is attempted, using the strategy `link_iterable_by_fields` and the standard fields: name, categories, unit, location. Note that biosphere flows do not actually have a location. You can now check the linking statistics. If all biosphere flows are linked, write the LCIA methods with `.write_methods()`. Note that attempting to write an existing method will raise a `ValueError` unless you use `.write_methods(overwrite=True)`, and trying to write methods which aren’t completely linked will also raise a `ValueError`. If there are unlinked characterization factors, you have several options. If you aren’t sure what to do yet, you can save a temporary copy (that can be loaded later) using `.write_unlinked("some name")`. The options to examine or resolve the unlinked characterization factors are: * You can write a spreadsheet of the characterization factors, including their linking status, with `.write_excel("some name")`. * You can apply new linking strategies with `.apply_strategies(`some\_new\_strategy`)`. Note that this method requires a _list_ of strategies. * TODO: You can write all biosphere flows to a new biosphere database with `.create_new_biosphere("some name")`. * If you are satisfied that you don’t care about the unlinked characterization factors, you can drop them with `.drop_unlinked()`. * Alternatively, you can add the missing biosphere flows to the biosphere database using `.add_missing_cfs()`. ### Custom Strategies[#](#custom-strategies "Link to this heading") A `strategy` is just a Python callable (usually a function) that follows a few simple conventions: it takes the input data as a single input argument, and returns the modified data as the only returned value. Inventory data is store in `{ImporterClass}.data`, and has the following form: \` { 'name': "some name", ..., \## other metadata in key: value form 'exchanges': \` { 'amount': float, ..., \## other data in key: value form } \` } \` Here is an example strategy (from `bw2io.strategies.csv.py`(https://github.com/brightway-lca/brightway2-io/blob/master/bw2io/strategies/csv.py)): def csv\_add\_missing\_exchanges\_section(data): for ds in data: if "exchanges" not in ds: ds\`"exchanges"\` \= \`\` return data This is short function, and is not complicated - most strategies will do more. #### Data Format for LCIA Methods[#](#data-format-for-lcia-methods "Link to this heading") In order to allow for the re-use of strategies, the data format for LCIA methods is the same as for inventory databases. `name` is the name (as a tuple) of the impact category, and `exchanges` is the list of characterization factors. It is a bit awkward, but makes other things easier. #### Adding Other Inputs to a Strategy[#](#adding-other-inputs-to-a-strategy "Link to this heading") Strategy functions should only take one input, but sometimes you want to add other input arguments. For example, imagine the following silly strategy: def add\_silly\_string(data, string): for ds in data: ds\`'name'\` += string return data If you tried to use this, it would raise an error, as `string` wouldn’t be defined. The right approach here is `currying`(https://en.wikipedia.org/wiki/Currying), which allows you to give the values of some input arguments in advance: from functools import partial add\_silly\_string\_fixed \= partial(add\_silly\_string, string\="something silly") You would then apply the strategy `add_silly_string_fixed`. #### Applying Custom Strategies[#](#applying-custom-strategies "Link to this heading") You apply strategies using the `{ImporterClass}.apply_strategy(name_of_callable)` method. You could also append your custom strategy to `{ImporterClass}.strategies`, so it is used when you call `{ImporterClass}.apply_strategies`. Export[#](#export "Link to this heading") ------------------------------------------ * * * On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/importing.md) ### This Page * [Show Source](../../_sources/content/overview/importing.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Contributing to the Code — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Contributing to the Code[#](#contributing-to-the-code "Link to this heading") ============================================================================== If you would like to contribute to the development of Brightway, follow [the usual GitHub process](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) : Fork the [relevant Brightway repository on GitHub](https://github.com/brightway-lca) , make your changes and open a pull request with your changes. Note The Brightway project has adopted the [Contributor Covenant](https://www.contributor-covenant.org/) . See also The development of major new features, collecting community input on issues, and documenting Brightway design decisions is managed through [`Brightway Enhancement Proposals`](https://github.com/brightway-lca/enhancement-proposals/tree/main) [\[1\]](#id2) . Specific Guidelines[#](#specific-guidelines "Link to this heading") -------------------------------------------------------------------- ### Code Style[#](#code-style "Link to this heading") Brightway has currently not adopted a specific code style beyond [Python PEP8](https://peps.python.org/pep-0008/) . However, we recommend the use of [Black](https://black.readthedocs.io/en/stable/) to ensure a consistent code style across the code base. ### Docstrings[#](#docstrings "Link to this heading") Warning The use of descriptive docstrings for all Brightway functions, classes and class methods is mandatory. Brightway has adopted the [NumPy Docstring Style](https://numpydoc.readthedocs.io/en/latest/format.html) . Writing code that is easy to understand is a key principle of Brightway. This is why it is not enough to write code with descriptive variable names and comments. All functions, classes and class methods must be documented with a [docstring](https://en.wikipedia.org/wiki/Docstring) . These docstrings are used to automatically generate the [Brightway API documentation](https://brightway-lca.github.io/brightway-documentation/) . As such, they should form the basis of the documentation of the Brightway code base. Using [the full extend of the NumPy Docstring features](https://numpydoc.readthedocs.io/en/latest/format.html) , including the `Examples`, `Raises`, `See Also`, `Notes`, and `References` sections, is recommended: Docstring Features | Feature | Required | Comment | | --- | --- | --- | | short summary | yes | N/A | | extended summary | yes | N/A | | `attributes` | yes | N/A | | `parameters` | yes | must include types | | `returns` | yes | must be `Nothing` the function does not return anything | | `raises` | yes | N/A | | `see also` | optional | should like to other relevant functions | | `notes` | optional | scientific/mathematical explanation of the life-cycle assessment functionality | | `references` | optional | references for the information used in `notes` | | `examples` | yes | mandatory for all public functions, classes and class methods | The `__init__` method should be documented as a docstring on the **init** method itself. This means that The `attributes` and `parameters` sections [will be split between the class docstring the the `__init__` docstring.](https://github.com/sphinx-contrib/napoleon/blob/dce30797b7a229ccebda4030f65482d501427794/docs/source/example_numpy.py#L226) * * * On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/contributing/code.md) ### This Page * [Show Source](../../_sources/content/contributing/code.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Exporting — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Exporting[#](#exporting "Link to this heading") ================================================ Exporting to `ecospold` 1[#](#exporting-to-ecospold-1 "Link to this heading") ------------------------------------------------------------------------------ Brightway can export inventory datasets conforming to the latest version of the ecospold version 1 [schema documentation](https://github.com/brightway-lca/pyecospold/tree/main/pyecospold/schemas/v1) . which follow the [Brightway data schema](inventory.html#data-schema) . `ecospold` 1 documents describe processes who produce and consume products. The [`bw2io.export.ecospold1.Ecospold1Exporter`](../api/bw2io/export/ecospold1/index.html#bw2io.export.ecospold1.Ecospold1Exporter "bw2io.export.ecospold1.Ecospold1Exporter") operates on individual nodes, and it is up to you to pass nodes of the correct type to the exporter. The `ecospold` 1 format uses a lot of fields which practitioners don’t normally populate. When importing `ecospold` 1, we store most of this information as “tags”. The main exception are comment fields; the `Ecospold1Exporter` requires that the `comments` field be a dictionary, not a string. This is because we need to break comments up into several fields in the XML export. No keys in this dictionary are required, and the fields used are listed below. ### Nodes[#](#nodes "Link to this heading") The following node attributes are _required_ for a valid `ecospold` 1 export: | Brightway node attribute | `ecospold` 1 XPath | | --- | --- | | name | ecoSpold/dataset/metaInformation/processInformation/referenceFunction/@name | | unit | ecoSpold/dataset/metaInformation/processInformation/referenceFunction/@unit | The following _optional_ attributes can be included, and are considered useful by most `ecospold` importers. In `ecoSpold/dataset/metaInformation/processInformation/referenceFunction`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | comments\[“includedProcesses”\] | empty string | @includedProcesses | | tags\[“ecoSpold01category”\] | empty string | @category | | tags\[“ecoSpold01datasetRelatesToProduct”\] | `true` | @datasetRelatesToProduct | | tags\[“ecoSpold01infrastructureIncluded”\] | `false` | @infrastructureIncluded | | tags\[“ecoSpold01infrastructureProcess”\] | `false` | @infrastructureProcess | | tags\[“ecoSpold01localCategory”\] | tags\[“ecoSpold01category”\] | @localCategory | | tags\[“ecoSpold01localName”\] | name | @localName | | tags\[“ecoSpold01localSubCategory”\] | tags\[“ecoSpold01subCategory”\] | @localSubCategory | | tags\[“ecoSpold01subCategory”\] | empty string | @subCategory | In `ecoSpold/dataset/metaInformation/processInformation/geography`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | comments\[“location”\] | empty string | @text | | location | “GLO” | @location | In `ecoSpold/dataset/metaInformation/processInformation/technology`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | comments\[“technology”\] | empty string | @text | In `ecoSpold/dataset/metaInformation/processInformation/timePeriod`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | comments\[“timePeriod”\] | empty string | @text | | tags\[“dataValidForEntirePeriod”\] | `true` | @dataValidForEntirePeriod | | tags\[“ecoSpold01endDate”\] | “1970-01-01” | endData/text() | | tags\[“ecoSpold01startDate”\] | “1970-01-01” | startData/text() | In `ecoSpold/dataset/metaInformation/processInformation/timePeriod`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | comments\[“timePeriod”\] | empty string | @text | | tags\[“dataValidForEntirePeriod”\] | `true` | @dataValidForEntirePeriod | | tags\[“ecoSpold01endDate”\] | “1970-01-01” | endData/text() | | tags\[“ecoSpold01startDate”\] | “1970-01-01” | startData/text() | In `ecoSpold/dataset/metaInformation/processInformation/dataSetInformation`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | tags\[“ecoSpold01impactAssessmentResult”\] | `false` | @impactAssessmentResult | | tags\[“ecoSpold01internalVersion”\] | “0.0” | @internalVersion | | tags\[“ecoSpold01languageCode”\] | “en” | @languageCode | | tags\[“ecoSpold01localLanguageCode”\] | “de” | @localLanguageCode | | tags\[“ecoSpold01timestamp”\] | datetime.now().isoformat() | @timestamp | | tags\[“ecoSpold01type”\] | “1” | @type | | tags\[“ecoSpold01version”\] | “0.0” | @version | In `ecoSpold/dataset/metaInformation/modellingAndValidation/representativeness`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | comments\[“extrapolations”\] | “unknown” | @extrapolations | | comments\[“productionVolume”\] | “unknown” | @productionVolume | | comments\[“sampling”\] | “unknown” | @samplingProcedure | | comments\[“uncertaintyAdjustments”\] | “unknown” | @uncertaintyAdjustments | #### References[#](#references "Link to this heading") If provided, `node["references"]` should be a list attached to nodes. Each element in the list is a dictionary. This dictionary does not have any required attributes, but the following can be provided in each “reference” dictionary: In `ecoSpold/dataset/metaInformation/modellingAndValidation/source`: | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | anthology | skipped if missing | @titleOfAnthology | | authors\[0\] | empty string | @firstAuthor | | authors\[1:\] | empty string | @additionalAuthors | | editors | skipped if missing | @nameOfEditors | | identifier | node numerical index | @number | | issue | skipped if missing | @issueNo | | journal | skipped if missing | @journal | | pages | skipped if missing | @pageNumbers | | place\_of\_publication | skipped if missing | @placeOfPublications | | publisher | skipped if missing | @publisher | | text | skipped if missing | @text | | title | skipped if missing | @title | | type | “Undefined (default)” | @sourceType | | volume | skipped if missing | @volumeNo | | year | skipped if missing | @year | The `reference_element["authors"]` field, if given, should be a list of strings. The `reference_element["type"]` field, if given, should be one of: * “Undefined (default)” * “Article” * “Chapters in anthology” * “Seperate publication” * “Measurement on site” * “Oral communication” * “Personal written communication” * “Questionnaries” ### Edges[#](#edges "Link to this heading") The following edge attributes are _required_ for each `exchange` element in `ecoSpold/dataset/flowData` for a valid `ecospold` 1 export: | Brightway edge attribute | `ecospold` 1 XPath | | --- | --- | | unit | ecoSpold/dataset/flowData/exchange/@unit | | name | ecoSpold/dataset/flowData/exchange/@name | | amount | ecoSpold/dataset/flowData/exchange/@meanValue | The edge “type” will set the `ecospold` 1 `inputGroup` or `outputGroup` value using the following mapping: | Brightway edge type | `ecospold` 1 `inputGroup` | `ecospold` 1 `outputGroup` | | --- | --- | --- | | technosphere | “5” | | | production | | “0” | | substitution | | “1” | | biosphere[\[1\]](#id2) | “5” | “4” | If uncertainty information is given, this uncertainty information should follow the `stats_arrays` data schema. All uncertainty fields will be translated to `ecospold` 1 equivalents. The following _optional_ attributes can be included, and are considered useful by most `ecospold` importers. | Brightway data schema | Default value | `ecospold` 1 XPath | | --- | --- | --- | | caetgories\[0\] | empty string | @category | | caetgories\[1\] | empty string | @subCategory | | CAS number | skipped if empty | @CASNumber | | chemical formula | skipped if empty | @formula | | comment | skipped if empty | @generalComment | | infrastructureProcess | `false` | @infrastructureProcess | | location | skipped if empty | @location | | pages | skipped if empty | @pageNumbers | | source\_reference | skipped if empty | @referenceToSource | | uncertainty type | skipped if empty[\[2\]](#id4) | @uncertaintyType | * * * On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/overview/exporting.md) ### This Page * [Show Source](../../_sources/content/overview/exporting.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Ecoinvent Database — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Ecoinvent Database[#](#ecoinvent-database "Link to this heading") ================================================================== Import[#](#import "Link to this heading") ------------------------------------------ ### Which `Ecoinvent` file should I download?[#](#which-ecoinvent-file-should-i-download "Link to this heading") Ecoinvent makes several versions of each system model available. For instance: ecoinvent 3.3\_xxx\_ecoSpold02.7z ecoinvent 3.3\_xxx\_lci\_ecoSpold02.7z ecoinvent 3.3\_xxx\_lcia\_ecoSpold02.7z ecoinvent 3.3\_xxx\_lcia\-cumulated\-matrices\_xls.7z ecoinvent 3.3\_xxx\_lci\-cumulated\-matrices\_xls.7z You want to download and import `ecoinvent 3.3_xxx_ecoSpold02.7z`. If your import process is taking a long time or a lot of memory, double check to make sure you have the right version. ### Unmatched exchanged when importing `Ecoinvent`[#](#unmatched-exchanged-when-importing-ecoinvent "Link to this heading") Trying to import Ecoinvent 3.8 with `bw2io` like so Note `` is the path to your Ecoinvent data directory. import bw2io import bw2data importer\_ei38 \= bw2io.SingleOutputEcospold2Importer( dirpath \= , db\_name \= 'ei38' ) importer\_ei38.apply\_strategies() importer\_ei38.statistics() might leave you with many unlinked exchanges: 19565 datasets 629959 exchanges 388452 unlinked exchanges Type biosphere: 1018 unique unlinked exchanges Unfortunately, the latest version of `bw2io` can not import older versions of Ecoinvent. Currently, you have to use: | Ecoinvent version | `bw2io` version | | --- | --- | | <=3.8 | \=.8.7 | | \>3.8 | \>0.8.7 | Why are activity dataset keys so confusing?[#](#why-are-activity-dataset-keys-so-confusing "Link to this heading") ------------------------------------------------------------------------------------------------------------------- `('ecoinvent 2.2', '5bbf...')` seems insane! It is insane, in the sense that it doesn’t make any sense at all to people. Rather, `5bbf2e66f2d75d60726974ac44ab4225` is a computer-generated unique ID. The basic problem is that we need one unique ID for an activity dataset, but there is no ID provided in the ecospold 1 data format. Instead, an activity is uniquely identified by its name, location, category, subcategory, unit, and whether or not it is an infrastructure process! `5bbf2e66f2d75d60726974ac44ab4225` is just an easy way of representing all this information in one string. It is a pain, but there is no good way around it. Unfortunately, ecospold 2 (the data format used in ecoinvent 3) isn’t more approachable - keys will now look like `('ecoinvent 3', 'fff06f42-6c5f-4aea-b695-93bcaba55fed')`. Sorry. At least this time it is ecoinvent generating the unique ID, and not Brightway2. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/ecoinvent.md) ### This Page * [Show Source](../../_sources/content/faq/ecoinvent.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Contributing to the Documentation — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Contributing to the Documentation[#](#contributing-to-the-documentation "Link to this heading") ================================================================================================ Note We are happy to find you on this page! Let’s improve the documentation together. Please follow the steps below to start your contribution. See also If you would like to report a bug or error, please follow the [instructions on the Report Bugs or Errors page](bugs.html) . 🥉 Request new Content[#](#request-new-content "Link to this heading") ----------------------------------------------------------------------- Prerequisites 1. A [GitHub account](https://github.com/signup) [Create a documentation request in the _Discussion_ section of the `brightway-documentation` repository](https://github.com/brightway-lca/brightway-documentation/discussions/new?category=documentation-request) , detailing your request and all relevant information. A member of the Brightway developer community will evaluate your request. Please note that all developments are undertaken on a voluntary basis, so it may take some time for your issue to be resolved. 🥈 Write new Content[#](#write-new-content "Link to this heading") ------------------------------------------------------------------- Prerequisites 1. A [GitHub account](https://github.com/signup) 2. Basic knowledge of [Markdown](https://www.markdownguide.org/basic-syntax/) Write your content in [Markdown](https://en.wikipedia.org/wiki/Markdown) , using the formatting options described in the [Formatting Guide](formatting.html) and save it to a single file. Now [create a new issue](https://github.com/brightway-lca/brightway-documentation/issues/new) in the _Issues_ section of the `brightway-documentation` repository, describing your request and attaching the Markdown file. A member of the Brightway developer community will integrate your contribution into the documentation. Please note that all developments are undertaken on a voluntary basis, so it may take some time for your issue to be resolved. 🥇 Write and add new Content[#](#write-and-add-new-content "Link to this heading") ----------------------------------------------------------------------------------- Prerequisites 1. A [GitHub account](https://github.com/signup) 2. Basic knowledge of [the GitHub contribution workflow (fork, branch, PR)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) 3. A [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) of the [`brightway-documentation`](https://github.com/brightway-lca/brightway-documentation) repository 4. Basic knowledge of [Markdown](https://www.markdownguide.org/basic-syntax/) In order to fix add new content to the documentation by yourself, follow the ususal GitHub contribution workflow: 1. Use the `✏️ Edit on GitHub` button on the top right of the page to open the corresponding file in the GitHub repository. This shows you which file you need to edit. 2. Edit the file in your fork of the repository. Finally, create a pull request. 3. As soon as a member of the Brightway developer community has merged your pull request, the changes will be visible on the Brightway documentation website. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/contributing/docs.md) ### This Page * [Show Source](../../_sources/content/contributing/docs.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2io — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") bw2io[#](#module-bw2io "Link to this heading") =============================================== Submodules[#](#submodules "Link to this heading") -------------------------------------------------- * [bw2io.backup](backup/index.html) * [bw2io.chemidplus](chemidplus/index.html) * [bw2io.compatibility](compatibility/index.html) * [bw2io.data](data/index.html) * [bw2io.download\_utils](download_utils/index.html) * [bw2io.ecoinvent](ecoinvent/index.html) * [bw2io.errors](errors/index.html) * [bw2io.export](export/index.html) * [bw2io.extractors](extractors/index.html) * [bw2io.importers](importers/index.html) * [bw2io.migrations](migrations/index.html) * [bw2io.modified\_database](modified_database/index.html) * [bw2io.package](package/index.html) * [bw2io.remote](remote/index.html) * [bw2io.strategies](strategies/index.html) * [bw2io.units](units/index.html) * [bw2io.unlinked\_data](unlinked_data/index.html) * [bw2io.utils](utils/index.html) Functions[#](#functions "Link to this heading") ------------------------------------------------ | | | | --- | --- | | [`bw2setup`](#bw2io.bw2setup "bw2io.bw2setup")
() | | | [`create_default_biosphere3`](#bw2io.create_default_biosphere3 "bw2io.create_default_biosphere3")
(\[overwrite\]) | | | [`create_default_lcia_methods`](#bw2io.create_default_lcia_methods "bw2io.create_default_lcia_methods")
(\[overwrite, ...\]) | | | [`exiobase_monetary`](#bw2io.exiobase_monetary "bw2io.exiobase_monetary")
(\[version, year, products, name, ...\]) | | | [`import_ecoinvent_release`](#bw2io.import_ecoinvent_release "bw2io.import_ecoinvent_release")
(\*args, \*\*kwargs) | | | [`useeio20`](#bw2io.useeio20 "bw2io.useeio20")
(\[name, collapse\_products, prune\]) | | Package Contents[#](#package-contents "Link to this heading") -------------------------------------------------------------- bw2io.bw2setup()[\[source\]](../../../_modules/bw2io.html#bw2setup) [#](#bw2io.bw2setup "Link to this definition") bw2io.create\_default\_biosphere3(_overwrite\=False_)[\[source\]](../../../_modules/bw2io.html#create_default_biosphere3) [#](#bw2io.create_default_biosphere3 "Link to this definition") bw2io.create\_default\_lcia\_methods(_overwrite\=False_, _rationalize\_method\_names\=False_, _shortcut\=True_)[\[source\]](../../../_modules/bw2io.html#create_default_lcia_methods) [#](#bw2io.create_default_lcia_methods "Link to this definition") bw2io.exiobase\_monetary(_version\=(3, 8, 1)_, _year\=2017_, _products\=False_, _name\=None_, _ignore\_small\_balancing\_corrections\=True_)[\[source\]](../../../_modules/bw2io.html#exiobase_monetary) [#](#bw2io.exiobase_monetary "Link to this definition") bw2io.import\_ecoinvent\_release(_\*args_, _\*\*kwargs_)[\[source\]](../../../_modules/bw2io.html#import_ecoinvent_release) [#](#bw2io.import_ecoinvent_release "Link to this definition") bw2io.useeio20(_name\='USEEIO-2.0'_, _collapse\_products\=False_, _prune\=False_)[\[source\]](../../../_modules/bw2io.html#useeio20) [#](#bw2io.useeio20 "Link to this definition") On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/api/bw2io/index.rst) ### This Page * [Show Source](../../../_sources/content/api/bw2io/index.rst.txt) [Support Brightway](latest/../../../../content/other/support.html) --- # Contributing to the Examples — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Contributing to the Examples[#](#contributing-to-the-examples "Link to this heading") ====================================================================================== You can contribute examples to the Brightway Documentation webpage by following these steps: Write your Notebook[#](#write-your-notebook "Link to this heading") -------------------------------------------------------------------- Prerequisites 1. Basic knowledge of [Jupyter Notebooks](https://jupyter.org) 2. A working installation of [Conda](https://docs.conda.io/en/latest/) 3. Basic knowledge of [Conda environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) Write your Jupyter Notebook, using the template provided below. Make sure to include [a Conda environment file in YAML format](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment) to ensure other users will be able to re-create your example from scratch. Download Notebook Template `template.ipynb` `template.yaml` Format your Notebook[#](#format-your-notebook "Link to this heading") ---------------------------------------------------------------------- Prerequisites 1. Basic knowledge of the [MyST Markdown syntax](https://myst-parser.readthedocs.io/en/latest/syntax/typography.html) Please follow the formatting instructions from the [Formatting Guide](formatting.html) . Add your Notebook[#](#add-your-notebook "Link to this heading") ---------------------------------------------------------------- Prerequisites 1. Basic knowledge of [the GitHub contribution workflow (fork, branch, pull request)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) 2. A fork of the [`brightway-examples`](https://github.com/brightway-lca/brightway-examples) repository 3. Your finished example notebook Once you are happy with your example, you can start the process to add it to the Brightway Documentation webpage. All examples are collected in the [`brightway-examples` repository](https://github.com/brightway-lca/brightway-examples) . To add your example, determine the appropriate location for it in the repository structure. For instance, an example about importing data from the Ecoinvent 3.9.1 database should be added to the `data_import` directory: . └── brightway-examples/ └── data\_import/ └── ecoinvent\_3-9-1\_import/ ├── ecoinvent\_3-9-1\_import.ipynb └── ecoinvent\_3-9-1\_import.yaml Add your example to the approriate location in your fork of the `brightway-examples` repository. Make sure to include the `.ipynb` and `.yaml` files. Finally, open a pull request. Once the pull request has been merged by a member of the Brightway Development team, your example will be added to the Brightway Documentation webpage. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/contributing/examples.md) ### This Page * [Show Source](../../_sources/content/contributing/examples.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # SimaPro Interoperability — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") SimaPro Interoperability[#](#simapro-interoperability "Link to this heading") ============================================================================== The global warming potential values are different in SimaPro![#](#the-global-warming-potential-values-are-different-in-simapro "Link to this heading") ------------------------------------------------------------------------------------------------------------------------------------------------------- The default LCIA characterization factors in Brightway2 come from version 3.5 of the ecoinvent database. For most LCIA methods, these are identical to those found in SimaPro. However, there are important differences for global warming potential: 1. SimaPro does not include a characterization factors for carbon monoxide, but ecoinvent does. Here is the ecoinvent language: > Emitted CO is transformed in the atmosphere to CO\\(\_2\\) after some time. Not all LCIA methods do consider the global warming potential of CO. Most methods are based on factors published by the IPCC (IPCC 2001). It is assumed that CO\\(\_2\\) emissions are calculated with the carbon content of the burned fuels and thus all carbon in the fuel is considered. In ecoinvent CO emissions are subtracted from the theoretical CO\\(\_2\\) emissions. Thus a GWP factor is calculated for CO (1.57 kg CO\\(\_2\\)\-eq per kg CO). Otherwise processes with higher CO emissions would benefit from this gap. This is especially important for biomass combustion. Neglecting the formation of CO2 from CO would lead in this case to a negative sum of the global warming potential score. The value of 1.57 is the ratio of the molecular weights of CO\\(\_2\\) and CO. 2. SimaPro gives biogenic methane a characterization factor of 22 kg CO\\(\_2\\)\-eq, while ecoinvent gives 25, the same value as for other types of methane. Note There may be other differences as well - these are the ones we have found. On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/simapro.md) ### This Page * [Show Source](../../_sources/content/faq/simapro.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Updating and Upgrading — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Updating and Upgrading[#](#updating-and-upgrading "Link to this heading") ========================================================================== Updating Brightway Libraries[#](#updating-brightway-libraries "Link to this heading") -------------------------------------------------------------------------------------- Brightway is being actively developed, with frequent new releases. The update procedure varies slightly depending on whether you have installed Brightway using `pip`, `conda`, or `mamba`. In a terminal or command line shell _with your Brightway environment activated_, run one of the following: pip install -U brightway25 conda update -c conda-forge -c cmutel brightway25 mamba update -c conda-forge -c cmutel brightway25 Warning Apple Silicon users should update `brightway25_nosolver`. You can use the same syntax to update individual packages: pip install -U Upgrading from Brightway Version 2[#](#upgrading-from-brightway-version-2 "Link to this heading") -------------------------------------------------------------------------------------------------- Individual projects can be migrate to Brightway version 2.5 import bw2data as bd bd.projects.set\_current('') bd.projects.migrate\_project\_25() On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/installation/upgrading.md) ### This Page * [Show Source](../../_sources/content/installation/upgrading.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Importing Data — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Importing Data[#](#importing-data "Link to this heading") ========================================================== Work in Progress! More examples will be added over time… 🥉 For Beginners Ecoinvent Import Import the proprietary Ecoinvent database for access to 20k+ datasets. by @michaelweinold [./brightway-examples/import\_data/import\_ecoinvent/import\_ecoinvent.html](./brightway-examples/import_data/import_ecoinvent/import_ecoinvent.html) 🥉 For Beginners Excel Import Import life-cycle inventory data from your own Excel sheets. by @michaelweinold [./brightway-examples/import\_data/import\_excel/import\_excel.html](./brightway-examples/import_data/import_excel/import_excel.html) [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/import.md) ### This Page * [Show Source](../../_sources/content/examples/import.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Python — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Python[#](#python "Link to this heading") ========================================== How can I find out what kind of Python object I am dealing with?[#](#how-can-i-find-out-what-kind-of-python-object-i-am-dealing-with "Link to this heading") ------------------------------------------------------------------------------------------------------------------------------------------------------------- You can use the `type` function to find out what kind of Python object you are dealing with: type(my\_object) This may not always be helpful. This is because many Brightway objects are instances of classes that inherit from other classes. To find out which classes an object inherits from, you can use the `inspect` module: import inspect print(inspect.getmro(type(my\_object))) For example, if we want to find out what kind of object a random activity from a database is, we can do the following: import bw2data as bd import inspect my\_database \= bd.Database('') print(inspect.getmro(type(my\_database.random()))) This will tell us that, a few levels of down, the object is an instance of `Mapping`, [which is most frequently used in Python to represent a dictionary](https://docs.python.org/3/library/stdtypes.html#mapping-types-dict) : ( , , , , , , , , , ) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/faq/python.md) ### This Page * [Show Source](../../_sources/content/faq/python.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Exporting Data — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Exporting Data[#](#exporting-data "Link to this heading") ========================================================== [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/export.md) ### This Page * [Show Source](../../_sources/content/examples/export.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2data — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") bw2data[#](#module-bw2data "Link to this heading") =================================================== Submodules[#](#submodules "Link to this heading") -------------------------------------------------- * [bw2data.backends](backends/index.html) * [bw2data.compat](compat/index.html) * [bw2data.configuration](configuration/index.html) * [bw2data.data\_store](data_store/index.html) * [bw2data.database](database/index.html) * [bw2data.errors](errors/index.html) * [bw2data.fatomic](fatomic/index.html) * [bw2data.filesystem](filesystem/index.html) * [bw2data.ia\_data\_store](ia_data_store/index.html) * [bw2data.logs](logs/index.html) * [bw2data.meta](meta/index.html) * [bw2data.method](method/index.html) * [bw2data.parameters](parameters/index.html) * [bw2data.project](project/index.html) * [bw2data.proxies](proxies/index.html) * [bw2data.query](query/index.html) * [bw2data.revisions](revisions/index.html) * [bw2data.search](search/index.html) * [bw2data.serialization](serialization/index.html) * [bw2data.signals](signals/index.html) * [bw2data.snowflake\_ids](snowflake_ids/index.html) * [bw2data.sqlite](sqlite/index.html) * [bw2data.string\_distance](string_distance/index.html) * [bw2data.subclass\_mapping](subclass_mapping/index.html) * [bw2data.updates](updates/index.html) * [bw2data.utils](utils/index.html) * [bw2data.validate](validate/index.html) * [bw2data.weighting\_normalization](weighting_normalization/index.html) Attributes[#](#attributes "Link to this heading") -------------------------------------------------- | | | | --- | --- | | [`mapping`](#bw2data.mapping "bw2data.mapping") | | Package Contents[#](#package-contents "Link to this heading") -------------------------------------------------------------- bw2data.mapping[\[source\]](../../../_modules/bw2data.html#mapping) [#](#bw2data.mapping "Link to this definition") On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/api/bw2data/index.rst) ### This Page * [Show Source](../../../_sources/content/api/bw2data/index.rst.txt) [Support Brightway](latest/../../../../content/other/support.html) --- # Docker Setup — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Docker Setup[#](#docker-setup "Link to this heading") ====================================================== Prerequisites 1. Basic knowledge of [Docker](https://www.docker.com) . 2. Basic knowledge of [the difference between `brightway2` and `brightway 25`](../faq/brightway.html) Brightway publishes two official docker images: * [brightway/bw2](https://hub.docker.com/r/brightway/bw2) , for brightway 2 * [brightway/bw25](https://hub.docker.com/r/brightway/bw25) , for brightway 2.5 Based on the [Jupyter minimal notebook](https://github.com/jupyter/docker-stacks/tree/master/minimal-notebook) . What it Gives You[#](#what-it-gives-you "Link to this heading") ---------------------------------------------------------------- * Miniconda * Python 3.10 * Jupyterlab * brightway2 framework Docker instances are ephemeral. You will almost certainly want to mount a [data volume](https://docs.docker.com/storage/volumes/) . Usage of bw2 image[#](#usage-of-bw2-image "Link to this heading") ------------------------------------------------------------------ To run an instance of Jupyter Lab, accessible at [localhost:8888](http://localhost:8888/) : docker run --rm -p 8888:8888 -e JUPYTER\_ENABLE\_LAB=yes brightway/bw2 Jupyterlab also allows you to run iPython sessions or even a terminal. See the [Jupyter documentation](https://github.com/jupyter/docker-stacks) for more usage options. Tags[#](#tags "Link to this heading") -------------------------------------- ### brightway2[#](#brightway2 "Link to this heading") The [brightway2](https://github.com/brightway-lca/brightway2) docker images are currently built and tagged based on the following different components of the image * brightway2 metapackage version (2.4.3) * python version (py310, py311, py312) * the python distribution (official python 3 or miniconda3) * Ecoinvent 3.X compatibility (3.8, 3.9) version [\[1\]](#id2) The following images are built: | Image Name | components | | --- | --- | | brightway/bw2:latest | brightway 2.4.3, py310, miniconda3, compatible with ecoinvent 3.9 | | brightway/bw2:2.4.3-py310-miniconda3-ecoinvent-3.9 | | | brightway/bw2:2.4.3-py310-miniconda3-ecoinvent-3.8 | | * * * On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/installation/docker.md) ### This Page * [Show Source](../../_sources/content/installation/docker.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Graphical User Interface (GUI) — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Graphical User Interface (GUI)[#](#graphical-user-interface-gui "Link to this heading") ======================================================================================== (i)Python Shell[#](#i-python-shell "Link to this heading") ----------------------------------------------------------- Brightway can be used from the interactive [iPython shell](http://ipython.org/) . Jupyter Notebooks[#](#jupyter-notebooks "Link to this heading") ---------------------------------------------------------------- Brightway can be used with [Jupyter Notebooks](https://jupyter.org/) . These interactive Python-enabled lab notebooks open incredible possibilities for interactive, reproducible, collaborative, and understandable science. Graphical User Interface (Activity Browser)[#](#graphical-user-interface-activity-browser "Link to this heading") ------------------------------------------------------------------------------------------------------------------ The Activity Browser is a graphical interface for Brightway with additional functionality. An [experimental version of the Activity Browser](https://anaconda.org/cmutel/activity-browser-dev25) compatible with Brightway 2.5 is available in the `cmutel` channel. ![image](../../_images/activity-browser-new.png) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/installation/ui.md) ### This Page * [Show Source](../../_sources/content/installation/ui.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2calc — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") bw2calc[#](#module-bw2calc "Link to this heading") =================================================== Submodules[#](#submodules "Link to this heading") -------------------------------------------------- * [bw2calc.caching\_lca](caching_lca/index.html) * [bw2calc.dense\_lca](dense_lca/index.html) * [bw2calc.dictionary\_manager](dictionary_manager/index.html) * [bw2calc.errors](errors/index.html) * [bw2calc.grid](grid/index.html) * [bw2calc.iterative\_lca](iterative_lca/index.html) * [bw2calc.lca](lca/index.html) * [bw2calc.lca\_base](lca_base/index.html) * [bw2calc.least\_squares](least_squares/index.html) * [bw2calc.log\_utils](log_utils/index.html) * [bw2calc.method\_config](method_config/index.html) * [bw2calc.multi\_lca](multi_lca/index.html) * [bw2calc.restricted\_sparse\_matrix\_dict](restricted_sparse_matrix_dict/index.html) * [bw2calc.result\_cache](result_cache/index.html) * [bw2calc.single\_value\_diagonal\_matrix](single_value_diagonal_matrix/index.html) * [bw2calc.utils](utils/index.html) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/api/bw2calc/index.rst) ### This Page * [Show Source](../../../_sources/content/api/bw2calc/index.rst.txt) [Support Brightway](latest/../../../../content/other/support.html) --- # Inventory Manipulation — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Inventory Manipulation[#](#inventory-manipulation "Link to this heading") ========================================================================== [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/inventory.md) ### This Page * [Show Source](../../_sources/content/examples/inventory.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # LCA Calculation — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") LCA Calculation[#](#lca-calculation "Link to this heading") ============================================================ [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/calculation.md) ### This Page * [Show Source](../../_sources/content/examples/calculation.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2analyzer — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") bw2analyzer[#](#module-bw2analyzer "Link to this heading") =========================================================== Submodules[#](#submodules "Link to this heading") -------------------------------------------------- * [bw2analyzer.comparisons](comparisons/index.html) * [bw2analyzer.contribution](contribution/index.html) * [bw2analyzer.econ](econ/index.html) * [bw2analyzer.health\_check](health_check/index.html) * [bw2analyzer.lci](lci/index.html) * [bw2analyzer.matrix\_grapher](matrix_grapher/index.html) * [bw2analyzer.page\_rank](page_rank/index.html) * [bw2analyzer.report](report/index.html) * [bw2analyzer.sc\_graph](sc_graph/index.html) * [bw2analyzer.tagged](tagged/index.html) * [bw2analyzer.utils](utils/index.html) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/api/bw2analyzer/index.rst) ### This Page * [Show Source](../../../_sources/content/api/bw2analyzer/index.rst.txt) [Support Brightway](latest/../../../../content/other/support.html) --- # Visualization — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Visualization[#](#visualization "Link to this heading") ======================================================== Work in Progress! More examples will be added over time… 🥉 For Beginners Technosphere Graph [![../../_images/graph_technosphere.png](../../_images/graph_technosphere.png)](../../_images/graph_technosphere.png) by @cmutel [./brightway-examples/visualization/graph\_technosphere.html](./brightway-examples/visualization/graph_technosphere.html) [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/visualization.md) ### This Page * [Show Source](../../_sources/content/examples/visualization.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # bw2parameters — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") bw2parameters[#](#module-bw2parameters "Link to this heading") =============================================================== Submodules[#](#submodules "Link to this heading") -------------------------------------------------- * [bw2parameters.errors](errors/index.html) * [bw2parameters.interpreter](interpreter/index.html) * [bw2parameters.mangling](mangling/index.html) * [bw2parameters.parameter\_set](parameter_set/index.html) * [bw2parameters.pint](pint/index.html) * [bw2parameters.utils](utils/index.html) On this page [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/api/bw2parameters/index.rst) ### This Page * [Show Source](../../../_sources/content/api/bw2parameters/index.rst.txt) [Support Brightway](latest/../../../../content/other/support.html) --- # Uncertainty (Monte Carlo) — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Uncertainty (Monte Carlo)[#](#uncertainty-monte-carlo "Link to this heading") ============================================================================== [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/uncertainty.md) ### This Page * [Show Source](../../_sources/content/examples/uncertainty.md.txt) [Support Brightway](latest/../../../content/other/support.html) --- # Regionalization — Brightway documentation [Skip to main content](#main-content) Back to top Ctrl+K * [GitHub](https://github.com/brightway-lca "GitHub") * [PyPi](https://pypi.org/project/brightway25/#description "PyPi") * [Matrix Group Chat](https://app.element.io/#/room/#brightway/community:matrix.org "Matrix Group Chat") Regionalization[#](#regionalization "Link to this heading") ============================================================ [Edit on GitHub](https://github.com/brightway-lca/brightway-documentation/edit/main/source/content/examples/regionalization.md) ### This Page * [Show Source](../../_sources/content/examples/regionalization.md.txt) [Support Brightway](latest/../../../content/other/support.html) ---