Skip to main content

Tools for importing and export life cycle inventory databases

Project description

bw2io appveyor build status Test coverage report

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.7.5.tar.gz (28.4 MB view details)

Uploaded Source

Built Distribution

bw2io-0.7.5-py3-none-any.whl (39.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bw2io-0.7.5.tar.gz
  • Upload date:
  • Size: 28.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for bw2io-0.7.5.tar.gz
Algorithm Hash digest
SHA256 74901bffbb6fd84b28da9f72601f3ce650b4db2e904a9e4d7860825a506f909e
MD5 c8d574aa44f9fb0b814dce28596d8800
BLAKE2b-256 11a4159a420e9f6ff6f97d7d8d1668cb04b8b160e127f4f3b65ec9c8ad78e273

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bw2io-0.7.5-py3-none-any.whl
  • Upload date:
  • Size: 39.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for bw2io-0.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 639a6658c1a83ad3f1eb538a6082bfdb360256ed2cafb2542c1d8ae1017b856a
MD5 6428c8b27b97ecd6d5d23883ad592507
BLAKE2b-256 89b58a7ab793db709dc111af3d4a1c8192076018cae3f5ca33c818419bcbf9da

See more details on using hashes here.

Supported by

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