Skip to main content

Convert Brightway2 LCI data to Simapro and back.

Project description

BrightPath

License: BSD 3-Clause

BrightPath bridges life-cycle assessment (LCA) data between Brightway2 and SimaPro. It bundles the mappings that are required to translate units, flow names and metadata between both tools and exposes high-level helpers to perform the conversion in either direction.

Features

  • Convert Brightway2 inventories exported as Excel spreadsheets to the SimaPro CSV format.
  • Import SimaPro CSV exports and normalise them so that they can be registered as Brightway databases.
  • Ship curated mappings for biosphere flows, technosphere exchanges, sub-compartments and blacklist entries required during the conversion.

Installation

Install BrightPath from PyPI using pip:

pip install brightpath

Usage

Convert Brightway inventories to SimaPro CSV

from brightpath import BrightwayConverter

converter = BrightwayConverter(
    filepath="/path/to/brightway-export.xlsx",
    metadata="/path/to/metadata.yaml",  # optional
    ecoinvent_version="3.9",
)

# Write the converted inventory to a CSV file (defaults to the current
# working directory unless ``export_dir`` is provided during initialisation).
output_path = converter.convert_to_simapro(database="ecoinvent")
print(output_path)

The converter also accepts inventory data that has already been loaded into memory via the data argument and can return the converted rows directly by calling convert_to_simapro(format="data").

Convert SimaPro CSV exports to Brightway datasets

from brightpath import SimaproConverter

converter = SimaproConverter(
    filepath="/path/to/simapro-export.csv",
    ecoinvent_version="3.9",
    db_name="my-simapro-import",
)

# Normalise exchange names, locations and metadata so that they align with
# Brightway conventions.
converter.convert_to_brightway()

# The processed data lives on ``converter.i`` (an instance of
# ``bw2io.SimaProCSVImporter``). You can now write the database to your
# Brightway project if desired:
# converter.i.write_database()

Development

  • Source code is formatted with standard Python tools and tested with pytest.
  • Data files required for the conversions live under brightpath/data.
  • Please see CONTRIBUTING.md for guidance on running tests and submitting pull requests.

License

BrightPath is distributed under the BSD-3-Clause 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

brightpath-0.0.1.tar.gz (735.8 kB view details)

Uploaded Source

Built Distribution

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

brightpath-0.0.1-py3-none-any.whl (745.0 kB view details)

Uploaded Python 3

File details

Details for the file brightpath-0.0.1.tar.gz.

File metadata

  • Download URL: brightpath-0.0.1.tar.gz
  • Upload date:
  • Size: 735.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brightpath-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8e4ecfa9924bde2f3c19310fb2783503476a613e3e71e2132587750c213fa41e
MD5 a3b65b8327db4e5a7f1af7faa359f28e
BLAKE2b-256 4354d8a98becf6668a66347b0bced0c44e58a08f3c03f21173300a4764f34550

See more details on using hashes here.

File details

Details for the file brightpath-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: brightpath-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 745.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brightpath-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d48f43355caf0151e0dd9b6e027af431c2f0a25c64e3bbea22f315aefd104fc7
MD5 8b851f6b6a99ef1cd0c2057a2576f73e
BLAKE2b-256 9eca4088ea9a2bfb301c5062a905fd9712c1167ab41c575c09bbc3861b68e364

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