Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brightway-lca/bw_migrations
Migration data and utilities for Brightway IO and LCA in general
https://github.com/brightway-lca/bw_migrations
bw3 etl life-cycle-assessment python reconciliation
Last synced: about 2 months ago
JSON representation
Migration data and utilities for Brightway IO and LCA in general
- Host: GitHub
- URL: https://github.com/brightway-lca/bw_migrations
- Owner: brightway-lca
- License: bsd-3-clause
- Created: 2019-10-17T06:43:49.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-06-17T14:51:42.000Z (6 months ago)
- Last Synced: 2024-11-08T16:06:13.957Z (about 2 months ago)
- Topics: bw3, etl, life-cycle-assessment, python, reconciliation
- Language: Python
- Size: 45.9 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# bw_migrations
Migration data and utilities for Brightway IO and LCA in general
[![PyPi Version](https://img.shields.io/pypi/v/bw_migrations.svg)](https://pypi.org/project/bw_migrations/) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/bw_migrations.svg)](https://anaconda.org/conda-forge/bw_migrations) [![Build Status](https://travis-ci.org/brightway-lca/bw_migrations.svg?branch=master)](https://travis-ci.org/brightway-lca/bw_migrations) [![Coverage Status](https://coveralls.io/repos/github/brightway-lca/bw_migrations/badge.svg?branch=master)](https://coveralls.io/github/brightway-lca/bw_migrations?branch=master) [![Build status](https://ci.appveyor.com/api/projects/status/lk0tbo21v2irm48x?svg=true)](https://ci.appveyor.com/project/cmutel/bw-migrations)
Most databases use their own nomenclature for classification systems, units, etc. These systems need to be matched when linking from one database to another. Often, a simple mapping is suitable, and tools like [correspondentia](https://github.com/BONSAMURAIS/correspondentia) are a good fit. However, sometimes one needs more complexity, e.g. change field X to Y, but only if field A has value B. When ecoinvent released version 3, they changed their unit of mesaure for water from kilograms to cubic meters. ``bw_migrations`` provides tools for this more complicated transformations, and is built around the following data format:
{
# The fields on which to filter
'fields': ['name', 'category', 'unit'],
'data': [
(
# First element is input data in the order of `fields` above
('Water', 'air', 'kilogram'),
# Second element is new values to substitute when all fields match
{
'unit': 'cubic meter',
'__multiplier__': 0.001
}
)
]
}And is implemented with the following pseudo-code:
for element in input_data:
for original, new in migration['data']:
if all(element[field] == original[field] for field in migration['fields']):
element.update(dict(zip(migration['fields'], new)))The actual code is a bit more complex, as `bw_migrations` can also do rescaling of probability distributions and disaggregation migrations (splitting one object into several outputs).