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.3.tar.gz (742.7 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.3-py3-none-any.whl (745.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: brightpath-0.0.3.tar.gz
  • Upload date:
  • Size: 742.7 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.3.tar.gz
Algorithm Hash digest
SHA256 aa802407f02ace15ad505c8dea4718e57e0d594dd7b6bc7f3c0b849e08da1f96
MD5 ec68f0b4b77093bfdf1784e0063eb78c
BLAKE2b-256 8b8ad6b5512704d7d53f93261b326e022133e5a019084c1eca8b37c1ab12b01e

See more details on using hashes here.

Provenance

The following attestation bundles were made for brightpath-0.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: brightpath-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 745.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 443a3e04427050bb31edf7272a66cf88291fed576ed0efbb6caeb718a7b70d3c
MD5 a9175de7af17e5c551e51befb3227cef
BLAKE2b-256 227c28053ece1abd8875eaf093f64a5c6e67a8e0065f05aec70aa4fd144dfa64

See more details on using hashes here.

Provenance

The following attestation bundles were made for brightpath-0.0.3-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