bw2io


Namebw2io JSON
Version 0.8.12 PyPI version JSON
download
home_pagehttps://github.com/brightway-lca/brightway2-io
SummaryTools for importing and export life cycle inventory databases
upload_time2023-12-07 09:17:44
maintainer
docs_urlNone
authorChris Mutel
requires_python
licenseBSD 3-clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Brightway2 input and output
===========================

.. image:: https://img.shields.io/pypi/v/bw2io.svg
   :target: https://pypi.org/project/bw2io/
   :alt: pypi version

.. image:: https://img.shields.io/conda/vn/conda-forge/bw2io.svg
   :target: https://anaconda.org/conda-forge/bw2io
   :alt: conda-forge version

.. image:: https://dev.azure.com/mutel/Brightway%20CI/_apis/build/status/brightway-lca.brightway2-io?branchName=bw2legacy
   :target: https://dev.azure.com/mutel/Brightway%20CI/_build?definitionId=5&_a=summary&repositoryFilter=3&branchFilter=113
   :alt: azure build status

This package provides tools for the import, export, and management of inventory databases and impact assessment methods. It is part of the `Brightway2 LCA framework <https://brightwaylca.org>`_. `Online documentation <https://docs.brightwaylca.org/>`_ is available, and the source code is hosted on `Bitbucket <https://bitbucket.org/cmutel/brightway2-io>`_.

In contrast with previous IO functionality in Brightway2, brightway2-io uses an iterative approach to importing and linking data. First, data is *extracted* into a common format. Next, a series of *strategies* is employed to uniquely identify each dataset and link datasets internally and to the biosphere. Following internal linking, linking to other background datasets can be performed. Finally, database data is written to disk.

This approach offers a number of benefits that help mitigate some of the serious problems in existing inventory data formats: the number of unlinked exchanges can be easily seen, linking strategies can be iteratively applied, and intermediate results can be saved.

Here is a typical usage:

.. code-block:: python

    In [1]: from bw2io import *

    In [2]: so = SingleOutputEcospold2Importer("/path/to/ecoinvent/3.1/cutoff/datasets", "ecoinvent 3.1 cutoff")
    11301/11301 (100%) |||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 0:01:56
    Converting to unicode
    Extracted 11301 datasets in 262.63 seconds

    In [3]: so.apply_strategies()
    Applying strategy: remove_zero_amount_coproducts
    Applying strategy: remove_zero_amount_inputs_with_no_activity
    Applying strategy: es2_assign_only_product_with_amount_as_reference_product
    Applying strategy: assign_single_product_as_activity
    Applying strategy: create_composite_code
    Applying strategy: link_biosphere_by_flow_uuid
    Applying strategy: link_internal_technosphere_by_composite_code
    Applying strategy: delete_exchanges_missing_activity
    Applying strategy: delete_ghost_exchanges
    Applying strategy: mark_unlinked_exchanges

    In [4]: so.statistics()
    11301 datasets
    521712 exchanges
    0 unlinked exchanges
    Out[4]: (11301, 521712, 0)

    In [5]: so.write_database()

Note that brightway2-io can't magically make problems in databases go away.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/brightway-lca/brightway2-io",
    "name": "bw2io",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Chris Mutel",
    "author_email": "cmutel@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/29/80/ca41f96e3e5f424ee435fd6bab947052a54273ec82438c2fb6c539de8d24/bw2io-0.8.12.tar.gz",
    "platform": null,
    "description": "Brightway2 input and output\n===========================\n\n.. image:: https://img.shields.io/pypi/v/bw2io.svg\n   :target: https://pypi.org/project/bw2io/\n   :alt: pypi version\n\n.. image:: https://img.shields.io/conda/vn/conda-forge/bw2io.svg\n   :target: https://anaconda.org/conda-forge/bw2io\n   :alt: conda-forge version\n\n.. image:: https://dev.azure.com/mutel/Brightway%20CI/_apis/build/status/brightway-lca.brightway2-io?branchName=bw2legacy\n   :target: https://dev.azure.com/mutel/Brightway%20CI/_build?definitionId=5&_a=summary&repositoryFilter=3&branchFilter=113\n   :alt: azure build status\n\nThis package provides tools for the import, export, and management of inventory databases and impact assessment methods. It is part of the `Brightway2 LCA framework <https://brightwaylca.org>`_. `Online documentation <https://docs.brightwaylca.org/>`_ is available, and the source code is hosted on `Bitbucket <https://bitbucket.org/cmutel/brightway2-io>`_.\n\nIn contrast with previous IO functionality in Brightway2, brightway2-io uses an iterative approach to importing and linking data. First, data is *extracted* into a common format. Next, a series of *strategies* is employed to uniquely identify each dataset and link datasets internally and to the biosphere. Following internal linking, linking to other background datasets can be performed. Finally, database data is written to disk.\n\nThis approach offers a number of benefits that help mitigate some of the serious problems in existing inventory data formats: the number of unlinked exchanges can be easily seen, linking strategies can be iteratively applied, and intermediate results can be saved.\n\nHere is a typical usage:\n\n.. code-block:: python\n\n    In [1]: from bw2io import *\n\n    In [2]: so = SingleOutputEcospold2Importer(\"/path/to/ecoinvent/3.1/cutoff/datasets\", \"ecoinvent 3.1 cutoff\")\n    11301/11301 (100%) |||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 0:01:56\n    Converting to unicode\n    Extracted 11301 datasets in 262.63 seconds\n\n    In [3]: so.apply_strategies()\n    Applying strategy: remove_zero_amount_coproducts\n    Applying strategy: remove_zero_amount_inputs_with_no_activity\n    Applying strategy: es2_assign_only_product_with_amount_as_reference_product\n    Applying strategy: assign_single_product_as_activity\n    Applying strategy: create_composite_code\n    Applying strategy: link_biosphere_by_flow_uuid\n    Applying strategy: link_internal_technosphere_by_composite_code\n    Applying strategy: delete_exchanges_missing_activity\n    Applying strategy: delete_ghost_exchanges\n    Applying strategy: mark_unlinked_exchanges\n\n    In [4]: so.statistics()\n    11301 datasets\n    521712 exchanges\n    0 unlinked exchanges\n    Out[4]: (11301, 521712, 0)\n\n    In [5]: so.write_database()\n\nNote that brightway2-io can't magically make problems in databases go away.\n",
    "bugtrack_url": null,
    "license": "BSD 3-clause",
    "summary": "Tools for importing and export life cycle inventory databases",
    "version": "0.8.12",
    "project_urls": {
        "Homepage": "https://github.com/brightway-lca/brightway2-io"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8971524f228ff355fa8ff2ed8645d1ae61c993802236532945553f48b044cb71",
                "md5": "3563a7e3090a61f774f4e522a216bad6",
                "sha256": "4ebdf95a7a9035f66133e16146c0da962816327d8b11f604b5225d6c3dfd2e7e"
            },
            "downloads": -1,
            "filename": "bw2io-0.8.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3563a7e3090a61f774f4e522a216bad6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19384084,
            "upload_time": "2023-12-07T09:17:38",
            "upload_time_iso_8601": "2023-12-07T09:17:38.364555Z",
            "url": "https://files.pythonhosted.org/packages/89/71/524f228ff355fa8ff2ed8645d1ae61c993802236532945553f48b044cb71/bw2io-0.8.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2980ca41f96e3e5f424ee435fd6bab947052a54273ec82438c2fb6c539de8d24",
                "md5": "93bb33523ad62593304e5ddbd8523d52",
                "sha256": "410fdac7d3a4273750861cc65166b026813e23dfa0ee59c77a8a412ea1dbbaea"
            },
            "downloads": -1,
            "filename": "bw2io-0.8.12.tar.gz",
            "has_sig": false,
            "md5_digest": "93bb33523ad62593304e5ddbd8523d52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19535911,
            "upload_time": "2023-12-07T09:17:44",
            "upload_time_iso_8601": "2023-12-07T09:17:44.623160Z",
            "url": "https://files.pythonhosted.org/packages/29/80/ca41f96e3e5f424ee435fd6bab947052a54273ec82438c2fb6c539de8d24/bw2io-0.8.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-07 09:17:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "brightway-lca",
    "github_project": "brightway2-io",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bw2io"
}
        
Elapsed time: 0.39656s