bw2io


Namebw2io JSON
Version 0.9.4 PyPI version JSON
download
home_pageNone
SummaryTools for importing and export life cycle inventory databases
upload_time2024-12-16 14:12:23
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
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: bw2io pypi version
   
.. image:: https://img.shields.io/conda/vn/conda-forge/bw2io.svg
   :target: https://anaconda.org/conda-forge/bw2io
   :alt: bw2io conda-forge version

.. image:: https://ci.appveyor.com/api/projects/status/7dox9te430eb2f8h?svg=true
   :target: https://ci.appveyor.com/project/cmutel/brightway2-io
   :alt: bw2io appveyor build status

.. image:: https://coveralls.io/repos/bitbucket/cmutel/brightway2-io/badge.svg?branch=master
    :target: https://coveralls.io/bitbucket/cmutel/brightway2-io?branch=default
    :alt: Test coverage report

This package provides tools for the import, export, and management of inventory databases and impact assessment methods. It is part of the `Brightway LCA framework <https://brightway.dev/>`_. `Online documentation <https://2.docs.brightway.dev/>`_ is available, and the source code is hosted on `Github <https://github.com/brightway-lca/brightway2-io>`_.

Bw2io approach
---------------

brightway2-io is an ETL library. 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. Note that we also have shortcuts for popular LCA databases such as ecoinvent:

.. code-block:: ipython

   In [1]: import bw2io as bi

   In [2]: import brightway2 as bw2

   In [3]: bi.__version__
   Out[3]: (0, 8, 7)

   In [4]: bw2.__version__
   Out[4]: (2, 4, 1)

   In [5]: importer = bi.SingleOutputEcospold2Importer('path/to/ecoinvent/datasets/', 'ei_38_cutoff')
   Extracting XML data from 19565 datasets
   Extracted 19565 datasets in 19.21 seconds

   In [6]: importer.apply_strategies()
   Applying strategy: normalize_units
   Applying strategy: update_ecoinvent_locations
   Applying strategy: remove_zero_amount_coproducts
   Applying strategy: remove_zero_amount_inputs_with_no_activity
   Applying strategy: remove_unnamed_parameters
   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: drop_unspecified_subcategories
   Applying strategy: fix_ecoinvent_flows_pre35
   Applying strategy: drop_temporary_outdated_biosphere_flows
   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: remove_uncertainty_from_negative_loss_exchanges
   Applying strategy: fix_unreasonably_high_lognormal_uncertainties
   Applying strategy: set_lognormal_loc_value
   Applying strategy: convert_activity_parameters_to_list
   Applying strategy: add_cpc_classification_from_single_reference_product
   Applying strategy: delete_none_synonyms
   Applied 21 strategies in 3.62 seconds

   In [7]: importer.statistics()
   19565 datasets
   629959 exchanges
   0 unlinked exchanges

   Out[7]: (19565, 629959, 0)

   In [8]: if importer.statistics()[2] == 0:
   ...:     importer.write_database()
   ...: else:
   ...:     print("There are unlinked exchanges.")
   ...:     importer.write_excel()
   ...: 
   19565 datasets
   629959 exchanges
   0 unlinked exchanges

   Writing activities to SQLite3 database:
   0% [##############################] 100% | ETA: 00:00:00
   Total time elapsed: 00:02:29
   Title: Writing activities to SQLite3 database:
   Started: 11/07/2022 11:55:57
   Finished: 11/07/2022 11:58:26
   Total time elapsed: 00:02:29
   CPU %: 32.90
   Memory %: 11.17
   Created database: ei_38_cutoff


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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bw2io",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Chris Mutel <cmutel@gmail.com>",
    "keywords": null,
    "author": null,
    "author_email": "Chris Mutel <cmutel@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a6/4f/97f076a6fb1a89be5f58794c5e53a4fe9326356d8a6e89afff40894d3678/bw2io-0.9.4.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: bw2io 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: bw2io conda-forge version\n\n.. image:: https://ci.appveyor.com/api/projects/status/7dox9te430eb2f8h?svg=true\n   :target: https://ci.appveyor.com/project/cmutel/brightway2-io\n   :alt: bw2io appveyor build status\n\n.. image:: https://coveralls.io/repos/bitbucket/cmutel/brightway2-io/badge.svg?branch=master\n    :target: https://coveralls.io/bitbucket/cmutel/brightway2-io?branch=default\n    :alt: Test coverage report\n\nThis package provides tools for the import, export, and management of inventory databases and impact assessment methods. It is part of the `Brightway LCA framework <https://brightway.dev/>`_. `Online documentation <https://2.docs.brightway.dev/>`_ is available, and the source code is hosted on `Github <https://github.com/brightway-lca/brightway2-io>`_.\n\nBw2io approach\n---------------\n\nbrightway2-io is an ETL library. 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. Note that we also have shortcuts for popular LCA databases such as ecoinvent:\n\n.. code-block:: ipython\n\n   In [1]: import bw2io as bi\n\n   In [2]: import brightway2 as bw2\n\n   In [3]: bi.__version__\n   Out[3]: (0, 8, 7)\n\n   In [4]: bw2.__version__\n   Out[4]: (2, 4, 1)\n\n   In [5]: importer = bi.SingleOutputEcospold2Importer('path/to/ecoinvent/datasets/', 'ei_38_cutoff')\n   Extracting XML data from 19565 datasets\n   Extracted 19565 datasets in 19.21 seconds\n\n   In [6]: importer.apply_strategies()\n   Applying strategy: normalize_units\n   Applying strategy: update_ecoinvent_locations\n   Applying strategy: remove_zero_amount_coproducts\n   Applying strategy: remove_zero_amount_inputs_with_no_activity\n   Applying strategy: remove_unnamed_parameters\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: drop_unspecified_subcategories\n   Applying strategy: fix_ecoinvent_flows_pre35\n   Applying strategy: drop_temporary_outdated_biosphere_flows\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: remove_uncertainty_from_negative_loss_exchanges\n   Applying strategy: fix_unreasonably_high_lognormal_uncertainties\n   Applying strategy: set_lognormal_loc_value\n   Applying strategy: convert_activity_parameters_to_list\n   Applying strategy: add_cpc_classification_from_single_reference_product\n   Applying strategy: delete_none_synonyms\n   Applied 21 strategies in 3.62 seconds\n\n   In [7]: importer.statistics()\n   19565 datasets\n   629959 exchanges\n   0 unlinked exchanges\n\n   Out[7]: (19565, 629959, 0)\n\n   In [8]: if importer.statistics()[2] == 0:\n   ...:     importer.write_database()\n   ...: else:\n   ...:     print(\"There are unlinked exchanges.\")\n   ...:     importer.write_excel()\n   ...: \n   19565 datasets\n   629959 exchanges\n   0 unlinked exchanges\n\n   Writing activities to SQLite3 database:\n   0% [##############################] 100% | ETA: 00:00:00\n   Total time elapsed: 00:02:29\n   Title: Writing activities to SQLite3 database:\n   Started: 11/07/2022 11:55:57\n   Finished: 11/07/2022 11:58:26\n   Total time elapsed: 00:02:29\n   CPU %: 32.90\n   Memory %: 11.17\n   Created database: ei_38_cutoff\n\n\nNote that brightway2-io can't magically make problems in databases go away.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Tools for importing and export life cycle inventory databases",
    "version": "0.9.4",
    "project_urls": {
        "homepage": "https://github.com/brightway-lca/brightway2-io",
        "source": "https://github.com/brightway-lca/brightway2-io",
        "tracker": "https://github.com/brightway-lca/brightway2-io/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0cd98b8823f8f4e92d2569e240feff47d53561fc603546dff1e7cc958bcc690a",
                "md5": "fe1f15191095f4d51ede105245960c68",
                "sha256": "d86bff7b90c552d0ad14b75642fec044b15f545a1dd65f686bf206407c965b80"
            },
            "downloads": -1,
            "filename": "bw2io-0.9.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fe1f15191095f4d51ede105245960c68",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 27636509,
            "upload_time": "2024-12-16T14:12:18",
            "upload_time_iso_8601": "2024-12-16T14:12:18.637921Z",
            "url": "https://files.pythonhosted.org/packages/0c/d9/8b8823f8f4e92d2569e240feff47d53561fc603546dff1e7cc958bcc690a/bw2io-0.9.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a64f97f076a6fb1a89be5f58794c5e53a4fe9326356d8a6e89afff40894d3678",
                "md5": "ac7c68e5f650940b8ee51efc5e5ef999",
                "sha256": "d4a78a55d9ac7d1b331f142f6158520e71c3381db70cefb9442f751902cab301"
            },
            "downloads": -1,
            "filename": "bw2io-0.9.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ac7c68e5f650940b8ee51efc5e5ef999",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 27595838,
            "upload_time": "2024-12-16T14:12:23",
            "upload_time_iso_8601": "2024-12-16T14:12:23.838032Z",
            "url": "https://files.pythonhosted.org/packages/a6/4f/97f076a6fb1a89be5f58794c5e53a4fe9326356d8a6e89afff40894d3678/bw2io-0.9.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 14:12:23",
    "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.72399s