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()

You can also write a Brightway Excel workbook directly, without first creating a Brightway database:

path = converter.convert_to_brightway(
    format="excel",
    filename="lci-my-simapro-import.xlsx",
)
print(path)

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.4.tar.gz (744.4 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.4-py3-none-any.whl (746.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: brightpath-0.0.4.tar.gz
  • Upload date:
  • Size: 744.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brightpath-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7eaee0fb870c1a82ad2a06903639980ae87bfd8fae53d5f6c2b088052f4e0774
MD5 3ae7604fcb25ee775315d3d4cdc40929
BLAKE2b-256 f8d41daf7de603027b7a24cbabcf27ad76c05486424b61f94be1fa6a3e23d4a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for brightpath-0.0.4.tar.gz:

Publisher: release.yml on romainsacchi/brightpath

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: brightpath-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 746.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brightpath-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 30717d64819af9d229c34817d629a1762737d60adc3e4673dfe8ad7e28316d65
MD5 94a4a2a2d91a9427969c1181a968a4c5
BLAKE2b-256 076cd1831889c104fd1c3ecae2b57553d408bf25732641a214390e6292c4908c

See more details on using hashes here.

Provenance

The following attestation bundles were made for brightpath-0.0.4-py3-none-any.whl:

Publisher: release.yml on romainsacchi/brightpath

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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