Skip to main content

Unpacks LCA scenario databases.

Project description

unfold

Publicly share data packages that allow reproducing LCA databases based on licensed data.

What does unfold do?

unfold is a Python package that allows "folding" and "unfolding" LCA databases derived from a source database (e.g., ecoinvent) without exposing the licensed data it builds from.

flow diagram

The purpose of this package is to allow users to publicly share LCA databases without sharing the source database, in the case where the latter is under restrictive license. Hence, unfold allows users to share instead data packages that allows other users to reproduce the LCA database (provided they have the source database).

It is based on the brightway2 framework.

unfold is initially conceived to share premise-generated databases (link), or any other databases that have been heavily modified and derived from a base which is under restrictive licensing (i.e., ecoinvent).

Limitations

  • only works with brightway2 at the moment
  • only tested wih ecoinvent 3.6, 3.7 and 3.8 (but should be working with any other source database in principle)

How to

Install

unfold is available on PyPI and can be installed with pip:

pip install unfold

It can also be installed from conda:

conda install -c romainsacchi unfold

Use

See also examples notebooks in the examples folder.

fold

unfold can "fold" several brightway2 databases into a single data package. The data package is a zip file containing the differences of the databases in relation to a source database (including extra inventories), as well as a metadata file that describes the databases and their content.

    from unfold import Fold
    import bw2data
    
    # name of the brightway project containing 
    # both the source database and the databases to fold
    bw2data.projects.set_current("some BW2 project")
    
    f = Fold()
    f.fold()

The resulting data package is saved in the current directory and can be shared with other users.

unfold

unfold can "unfold" a data package into one or several brightway2 databases.

    from unfold import Unfold
    import bw2data
    
    # name of the brightway project containing 
    # both the source database and the databases to unfold
    bw2data.projects.set_current("some BW2 project")
    
    u = Unfold("a package name.zip")
    u.unfold()

The file path given to the Unfold class can be either absolute or relative to the current directory, or even a URL.

unfold a superstructure database (to be used with Activity Browser)

unfold can "unfold" a data package into a superstructure database that can be used with the Activity Browser.

    from unfold import Unfold
    import bw2data
    
    # name of the brightway project containing 
    # both the source database and the databases to unfold
    bw2data.projects.set_current("some BW2 project")
    
    u = Unfold("a package name.zip")
    u.unfold(superstructure=True)

This outputs a superstructure database in your brightway2 project, as well as a scenario difference file (Excel) in the current working directory.

Author

Romain Sacchi, PSI

License

See License.

Project details


Download files

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

Source Distribution

unfold-1.0.2.tar.gz (190.8 kB view details)

Uploaded Source

Built Distribution

unfold-1.0.2-py3-none-any.whl (179.7 kB view details)

Uploaded Python 3

File details

Details for the file unfold-1.0.2.tar.gz.

File metadata

  • Download URL: unfold-1.0.2.tar.gz
  • Upload date:
  • Size: 190.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for unfold-1.0.2.tar.gz
Algorithm Hash digest
SHA256 78c3c0ed6e41d4d6c84830d10863a12b6e71afe6ebd077506a79008f70b3f4c1
MD5 1ee6993a2776752dc2ac73e9d01f9edc
BLAKE2b-256 16922ada902ca18e048a5de0bb1bafa1b5c0edca54f3086d574dbf3df05612c7

See more details on using hashes here.

File details

Details for the file unfold-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: unfold-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 179.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for unfold-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6cb28d0566fef1b42bf72e356cf19d7da978c6587f7f27c85d4a94ef63fb0496
MD5 152a05eea5441d6f311444293c2c696e
BLAKE2b-256 7ee183af3f360bd6996356953b527079ec3b26ab1705bf49db77509286d6e44b

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