Migration data and utilities for Brightway IO and LCA in general
Project description
bw_migrations
Migration data and utilities for Brightway IO and LCA in general
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 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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bw_migrations-0.2.tar.gz
.
File metadata
- Download URL: bw_migrations-0.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 229d99a820cbcf18854ce6a3870552e8feebb89b9342abbafaa1a6d95a57dff9 |
|
MD5 | 77dda1fa197b42ad87b42b9f04e7f72f |
|
BLAKE2b-256 | 5156647c42d2c7ec041da11a04cb583e8ec4f14b3cae2ed420669ef5e443ae43 |
File details
Details for the file bw_migrations-0.2-py3-none-any.whl
.
File metadata
- Download URL: bw_migrations-0.2-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c72ef245380e04cea610116ee42e9b27f63cd42b4760f6ef92258abea73c33fb |
|
MD5 | c67169fe19f35557f81277cab4721c7a |
|
BLAKE2b-256 | d73b691c781ce78c18694e86536d8bf24a881661407cb93f8c4e9f6b70037714 |