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.1.tar.gz
.
File metadata
- Download URL: bw_migrations-0.1.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a568fc157735b383bd4fc45ddf739e1a2029cafbe764eb84c9b302a4e52b4d1 |
|
MD5 | e1eb308126c9a8950ff1845fbb8e8e71 |
|
BLAKE2b-256 | e2b18c46d0cd0d552cffee729ff7b18c70adbb029e60c52dff750218050e9d6b |
File details
Details for the file bw_migrations-0.1-py3-none-any.whl
.
File metadata
- Download URL: bw_migrations-0.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6f79bbbe4de96d11d9918da93c0021a1ef4e6720f5b32b4b7e5888b5e93f6af |
|
MD5 | 8705b78ffa5ca1d9dfa13cb296293f8e |
|
BLAKE2b-256 | 4f01d62328ede4195cb18ff8dc6e8fc040fdda4095b352a8cb79080788368a09 |