bw-migrations


Namebw-migrations JSON
Version 0.2 PyPI version JSON
download
home_pagehttps://github.com/brightway-lca/bw_migrations
SummaryMigration data and utilities for Brightway IO and LCA in general
upload_time2021-10-01 12:15:45
maintainer
docs_urlNone
authorChris Mutel
requires_python
licenseNewBSD 3-clause; LICENSE
keywords
VCS
bugtrack_url
requirements stats_arrays bw2data pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bw_migrations

Migration data and utilities for Brightway IO and LCA in general

[![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).
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/brightway-lca/bw_migrations",
    "name": "bw-migrations",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Chris Mutel",
    "author_email": "cmutel@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/51/56/647c42d2c7ec041da11a04cb583e8ec4f14b3cae2ed420669ef5e443ae43/bw_migrations-0.2.tar.gz",
    "platform": "",
    "description": "# bw_migrations\n\nMigration data and utilities for Brightway IO and LCA in general\n\n[![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)\n\nMost 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:\n\n    {\n        # The fields on which to filter\n        'fields': ['name', 'category', 'unit'],\n        'data': [\n            (\n                # First element is input data in the order of `fields` above\n                ('Water', 'air', 'kilogram'),\n                # Second element is new values to substitute when all fields match\n                {\n                    'unit': 'cubic meter',\n                    '__multiplier__': 0.001\n                }\n            )\n        ]\n    }\n\nAnd is implemented with the following pseudo-code:\n\n    for element in input_data:\n        for original, new in migration['data']:\n            if all(element[field] == original[field] for field in migration['fields']):\n                element.update(dict(zip(migration['fields'], new)))\n\nThe 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).",
    "bugtrack_url": null,
    "license": "NewBSD 3-clause; LICENSE",
    "summary": "Migration data and utilities for Brightway IO and LCA in general",
    "version": "0.2",
    "project_urls": {
        "Homepage": "https://github.com/brightway-lca/bw_migrations"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d73b691c781ce78c18694e86536d8bf24a881661407cb93f8c4e9f6b70037714",
                "md5": "c67169fe19f35557f81277cab4721c7a",
                "sha256": "c72ef245380e04cea610116ee42e9b27f63cd42b4760f6ef92258abea73c33fb"
            },
            "downloads": -1,
            "filename": "bw_migrations-0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c67169fe19f35557f81277cab4721c7a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9349,
            "upload_time": "2023-09-15T14:25:55",
            "upload_time_iso_8601": "2023-09-15T14:25:55.955471Z",
            "url": "https://files.pythonhosted.org/packages/d7/3b/691c781ce78c18694e86536d8bf24a881661407cb93f8c4e9f6b70037714/bw_migrations-0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5156647c42d2c7ec041da11a04cb583e8ec4f14b3cae2ed420669ef5e443ae43",
                "md5": "77dda1fa197b42ad87b42b9f04e7f72f",
                "sha256": "229d99a820cbcf18854ce6a3870552e8feebb89b9342abbafaa1a6d95a57dff9"
            },
            "downloads": -1,
            "filename": "bw_migrations-0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "77dda1fa197b42ad87b42b9f04e7f72f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10196,
            "upload_time": "2021-10-01T12:15:45",
            "upload_time_iso_8601": "2021-10-01T12:15:45.042494Z",
            "url": "https://files.pythonhosted.org/packages/51/56/647c42d2c7ec041da11a04cb583e8ec4f14b3cae2ed420669ef5e443ae43/bw_migrations-0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-10-01 12:15:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "brightway-lca",
    "github_project": "bw_migrations",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "stats_arrays",
            "specs": []
        },
        {
            "name": "bw2data",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        }
    ],
    "lcname": "bw-migrations"
}
        
Elapsed time: 2.86700s