Skip to main content

Tools for importing and export life cycle inventory databases

Project description

pypi version conda-forge version azure build status

This package provides tools for the import, export, and management of inventory databases and impact assessment methods. It is part of the Brightway2 LCA framework. Online documentation is available, and the source code is hosted on Bitbucket.

In contrast with previous IO functionality in Brightway2, brightway2-io uses an iterative approach to importing and linking data. First, data is extracted into a common format. Next, a series of strategies is employed to uniquely identify each dataset and link datasets internally and to the biosphere. Following internal linking, linking to other background datasets can be performed. Finally, database data is written to disk.

This approach offers a number of benefits that help mitigate some of the serious problems in existing inventory data formats: the number of unlinked exchanges can be easily seen, linking strategies can be iteratively applied, and intermediate results can be saved.

Here is a typical usage:

In [1]: from bw2io import *

In [2]: so = SingleOutputEcospold2Importer("/path/to/ecoinvent/3.1/cutoff/datasets", "ecoinvent 3.1 cutoff")
11301/11301 (100%) |||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 0:01:56
Converting to unicode
Extracted 11301 datasets in 262.63 seconds

In [3]: so.apply_strategies()
Applying strategy: remove_zero_amount_coproducts
Applying strategy: remove_zero_amount_inputs_with_no_activity
Applying strategy: es2_assign_only_product_with_amount_as_reference_product
Applying strategy: assign_single_product_as_activity
Applying strategy: create_composite_code
Applying strategy: link_biosphere_by_flow_uuid
Applying strategy: link_internal_technosphere_by_composite_code
Applying strategy: delete_exchanges_missing_activity
Applying strategy: delete_ghost_exchanges
Applying strategy: mark_unlinked_exchanges

In [4]: so.statistics()
11301 datasets
521712 exchanges
0 unlinked exchanges
Out[4]: (11301, 521712, 0)

In [5]: so.write_database()

Note that brightway2-io can’t magically make problems in databases go away.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bw2io-0.8.10.tar.gz (19.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bw2io-0.8.10-py3-none-any.whl (20.7 MB view details)

Uploaded Python 3

File details

Details for the file bw2io-0.8.10.tar.gz.

File metadata

  • Download URL: bw2io-0.8.10.tar.gz
  • Upload date:
  • Size: 19.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for bw2io-0.8.10.tar.gz
Algorithm Hash digest
SHA256 2ad12a69188a2309ee37d9d6c22a9fea28a57339da79545c4193c92d5aa37c28
MD5 43457b703d30df201ad2826bc7520ec1
BLAKE2b-256 6d3d609c9d260f8db13d461dd95ccd4198f80469af085b65fe6dde3b1a7a1b10

See more details on using hashes here.

File details

Details for the file bw2io-0.8.10-py3-none-any.whl.

File metadata

  • Download URL: bw2io-0.8.10-py3-none-any.whl
  • Upload date:
  • Size: 20.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for bw2io-0.8.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4e49c159b723c5048f5f5991a1473a2574c2731367c3ad1e4b8a4175152b5e5e
MD5 acd3adb740d2fa3e4caab7859a1a5f24
BLAKE2b-256 d30881c61701012a3d1f0504fcb5b54a90ef8847a6201d86f6c41f3017f8109a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page