Package: unfold
unfoldPublicly share data packages that allow reproducing LCA databases
based on licensed data.If you use this software, please cite the following article:Sacchi, R., (2023). unfold: removing the barriers to sharing and reproducing prospective life-cycle assessment databases.
Journal of Open Source Software, 8(83), 5198,https://doi.org/10.21105/joss.05198What doesunfolddo?unfoldis 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.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,unfoldallows 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 thebrightway2framework.unfoldis initially conceived to sharepremise-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).Limitationsonly works withbrightway2at the momentonly tested wih ecoinvent 3.6, 3.7 and 3.8 (but should be working with any other source database in principle)How toInstallunfoldis available on PyPI and can be installed withpip:pip install unfoldAlternatively, you can clone the repository and install the library from the source code:git clone https://github.com/polca/unfold.git
cd unfold
pip install -e .It can also be installed fromconda:conda install -c romainsacchi unfoldUseSee also examples notebooks in theexamplesfolder.foldunfoldcan "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.fromunfoldimportFoldimportbw2data# name of the brightway project containing# both the source database and the databases to foldbw2data.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.unfoldunfoldcan "unfold" a data package into one or several
brightway2 databases.fromunfoldimportUnfoldimportbw2data# name of the brightway project containing# both the source database and the databases to unfoldbw2data.projects.set_current("some BW2 project")u=Unfold("a package name.zip")u.unfold()The file path given to theUnfoldclass can be either
absolute or relative to the current directory, or even a URL.unfold a superstructure database (to be used with Activity Browser)unfoldcan "unfold" a data package into a superstructure database
that can be used with theActivity Browser.fromunfoldimportUnfoldimportbw2data# name of the brightway project containing# both the source database and the databases to unfoldbw2data.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.ContributingUnfold is an open-source project, and contributions are welcome.
To contribute to the project, please create a pull request on the project's
GitHub page. Before submitting a pull request, please make sure that
your changes are properly documented and that all tests pass.IssuesIf you encounter any problems, please open an issue on the project's
GitHub page. Please include a minimal working example that reproduces
the problem. If you are reporting a bug, please include the version
of the package you are using.SupportIf you need help using Unfold, please contact the author (see below).AuthorRomain Sacchi, PSILicenseUnfold is released under the MIT License.
See theLicensefile for more information.