{"id":191416,"name":"bonsai_ipcc","description":"Enables users to calculate national greenhouse gas (GHG) inventories based on the guidelines provided by the International Panel on Climate Change.","url":"https://gitlab.com/bonsamurais/bonsai/util/ipcc","last_synced_at":"2026-04-06T18:30:22.403Z","repository":{"id":234589990,"uuid":"51700323","full_name":"bonsamurais/bonsai/util/ipcc","owner":"bonsamurais","description":"","archived":false,"fork":false,"pushed_at":null,"size":null,"stargazers_count":2,"open_issues_count":4,"forks_count":2,"subscribers_count":null,"default_branch":"main","last_synced_at":"2025-12-28T07:44:18.991Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":null,"metadata":{},"created_at":"2022-06-24T09:33:07.000Z","updated_at":"2025-10-20T07:22:05.669Z","dependencies_parsed_at":null,"dependency_job_id":"159c2330-e472-450a-ab91-32233039e579","html_url":"https://gitlab.com/bonsamurais/bonsai/util/ipcc","commit_stats":null,"previous_names":["bonsamurais/bonsai/util/ipcc"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:gitlab/bonsamurais/ipcc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners/bonsamurais","download_url":"https://gitlab.com/bonsamurais/bonsai/util/ipcc/-/archive/main/ipcc-main.zip","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc/sbom","scorecard":null,"host":{"name":"gitlab.com","url":"https://gitlab.com","kind":"gitlab","repositories_count":4521539,"owners_count":7348,"icon_url":"https://github.com/gitlab.png","version":null,"created_at":"2022-05-30T11:31:42.605Z","updated_at":"2026-01-12T22:45:04.389Z","status":"online","status_checked_at":"2026-04-03T02:00:07.538Z","response_time":523,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.382Z","robots_txt_url":"https://gitlab.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners"}},"owner":{"login":"bonsamurais","name":"BONSAI","uuid":"organization-77028262","kind":"organization","description":"","email":null,"website":null,"location":null,"twitter":null,"company":null,"icon_url":null,"repositories_count":1,"last_synced_at":"2024-04-20T00:06:44.910Z","metadata":{},"html_url":"https://gitlab.com/bonsamurais","funding_links":[],"total_stars":0,"followers":null,"following":null,"created_at":"2024-04-20T00:06:45.152Z","updated_at":"2024-04-20T00:06:45.152Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners/bonsamurais","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners/bonsamurais/repositories"},"packages":[],"commits":{"id":1638620,"full_name":"bonsamurais/bonsai/util/ipcc","default_branch":"main","total_commits":714,"total_committers":10,"total_bot_commits":0,"total_bot_committers":0,"mean_commits":71.4,"dds":0.2408963585434174,"past_year_total_commits":105,"past_year_total_committers":6,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":17.5,"past_year_dds":0.48571428571428577,"last_synced_at":"2026-04-03T17:01:47.577Z","last_synced_commit":"3d033c8bfb0871647b227058482f88e52ee262ad","created_at":"2024-07-23T21:30:19.428Z","updated_at":"2026-04-03T17:01:46.865Z","committers":[{"name":"mabudz","email":"maikb@plan.aau.dk","login":null,"count":542},{"name":"Albert Osei-Owusu","email":"ako@plan.aau.dk","login":null,"count":69},{"name":"matdelpierre","email":"mathieu.delpierre@lca-net.com","login":null,"count":49},{"name":"Albert Osei-Owusu","email":"EQ25BW@plan.aau.dk","login":null,"count":18},{"name":"maddalen","email":"maddalen.ayala@gmail.com","login":null,"count":15},{"name":"mabudz","email":"maik.budzinski@gmx.de","login":null,"count":9},{"name":"Joao Rodrigues","email":"jfdr@plan.aau.dk","login":null,"count":5},{"name":"Joao Rodrigues","email":"joao.rodrigues@lca-net.com","login":null,"count":3},{"name":"Valentin Starlinger","email":"valentin.starlinger@lca-net.com","login":null,"count":3},{"name":"PennyHow","email":"pho@geus.dk","login":null,"count":1}],"past_year_committers":[{"name":"Albert Osei-Owusu","email":"ako@plan.aau.dk","login":null,"count":54},{"name":"mabudz","email":"maikb@plan.aau.dk","login":null,"count":18},{"name":"maddalen","email":"maddalen.ayala@gmail.com","login":null,"count":15},{"name":"Mathieu Delpierre","email":"mathieu.delpierre@lca-net.com","login":null,"count":13},{"name":"mabudz","email":"maik.budzinski@gmx.de","login":null,"count":4},{"name":"Valentin Starlinger","email":"valentin.starlinger@lca-net.com","login":null,"count":1}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc/commits","host":{"name":"gitlab.com","url":"https://gitlab.com","kind":"gitlab","last_synced_at":"2026-04-05T00:00:09.438Z","repositories_count":23875,"commits_count":4124667,"contributors_count":113965,"owners_count":12292,"icon_url":"https://github.com/gitlab.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/gitlab.com","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/gitlab.com/repositories"}},"issues_stats":{"full_name":"bonsamurais/bonsai/util/ipcc","html_url":"https://gitlab.com/bonsamurais/bonsai/util/ipcc","last_synced_at":"2026-04-03T17:00:44.415Z","status":"error","issues_count":null,"pull_requests_count":null,"avg_time_to_close_issue":null,"avg_time_to_close_pull_request":null,"issues_closed_count":null,"pull_requests_closed_count":null,"pull_request_authors_count":null,"issue_authors_count":null,"avg_comments_per_issue":null,"avg_comments_per_pull_request":null,"merged_pull_requests_count":null,"bot_issues_count":null,"bot_pull_requests_count":null,"past_year_issues_count":null,"past_year_pull_requests_count":null,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":null,"past_year_issues_closed_count":null,"past_year_pull_requests_closed_count":null,"past_year_pull_request_authors_count":null,"past_year_issue_authors_count":null,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":null,"past_year_bot_issues_count":null,"past_year_bot_pull_requests_count":null,"past_year_merged_pull_requests_count":null,"created_at":"2024-08-09T05:30:24.276Z","updated_at":"2026-04-03T17:00:44.415Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/bonsamurais%2Fbonsai%2Futil%2Fipcc/issues","issue_labels_count":{},"pull_request_labels_count":{},"issue_author_associations_count":{},"pull_request_author_associations_count":{},"issue_authors":{},"pull_request_authors":{},"host":{"name":"gitlab.com","url":"https://gitlab.com","kind":"gitlab","last_synced_at":"2026-04-05T00:00:08.729Z","repositories_count":0,"issues_count":0,"pull_requests_count":0,"authors_count":61892,"icon_url":"https://github.com/gitlab.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/gitlab.com","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/gitlab.com/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/gitlab.com/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/gitlab.com/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{},"past_year_pull_request_author_associations_count":{},"past_year_issue_authors":{},"past_year_pull_request_authors":{},"maintainers":[],"active_maintainers":[]},"events":null,"keywords":[],"dependencies":[],"score":4.094344562222101,"created_at":"2024-04-20T00:06:42.048Z","updated_at":"2026-04-06T18:30:22.420Z","avatar_url":null,"language":null,"category":"Emissions","sub_category":"Emission Observation and Modeling","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"# bonsai_ipcc\n\n\nThe `bonsai_ipcc` python package enables users to calculate national greenhouse gas (GHG) inventories based on the guidelines provided by the International Panel on Climate Change.\n\nBy using `volumes` and `chapters`, the python package follows the structure of the IPCC guidelines and allows users to access individual equations and sequences of equations as `bonsai_ipcc.\u003cvolume\u003e.\u003cchapter\u003e.elementary.\u003cequation\u003e` or `bonsai_ipcc.\u003cvolume\u003e.\u003cchapter\u003e.sequence.\u003ctier_method\u003e`. The package allows users to access the data as Pandas dataframes in `bonsai_ipcc.\u003cvolume\u003e.\u003cchapter\u003e.dimension.\u003ctable\u003e` or `bonsai_ipcc.\u003cvolume\u003e.\u003cchapter\u003e.parameter.\u003ctable\u003e`: dimensions list valid coordinates to access parameters; parameters are values to be used in equations. When using the `bonsai_ipcc` python package, it may helpful to also use the [pdf documents](https://www.ipcc-nggip.iges.or.jp/public/2019rf/index.html) for additional information.\n\nThe package also allows uncertainty information to be taken into account. Within a sequence, the user can choose between analytical error propagation and Monte Carlo simulation. Thereby, the values of an equation are transformed into [ufloat](https://uncertainties-python-package.readthedocs.io/en/latest/) or [numpy.array](https://numpy.org/doc/stable/reference/generated/numpy.array.html), respectively.\n\nA comrehensive documentation is available [here](https://bonsamurais.gitlab.io/bonsai/util/ipcc).\n\n## Installation for users\n\n\nYou can install the package from PyPi sing `pip`:\n\n```bash\npip install bonsai_ipcc\n```\n\nYou can also download the package from gitlab.com\nReplace the keyword `tag` by the specific version, e.g., `v0.3.0`.\n\n```bash\npip install git+ssh://git@gitlab.com/bonsamurais/bonsai/util/ipcc.git@tag\n```\n\nChange `pip` to `pip3` in Linux. Note that the path may change in future versions.\n\n## Installation for developers\n\n### Create a python environment\nThe `bonsai_ipcc` package requires `python\u003e=3.9`. If you use conda as your python package manager, you could do something like:\n```\nconda create --name py311 python=3.11\nconda activate py311\n```\n\n### Install the package in editable mode\n```bash\ngit clone git@gitlab.com:bonsamurais/bonsai/util/ipcc.git\ncd bonsai_ipcc\npip install -e .\n```\n\n## Basic use\n\nInside a Python console or notebook, create an instance of the `IPCC` class like this:\n\n```python\nimport bonsai_ipcc\nmy_ipcc = bonsai_ipcc.IPCC()\n```\n\nWith `my_ipcc.\u003cvolume\u003e.\u003cchapter\u003e` the `bonsai_ipcc` package follows the structure of the IPCC guidelines.\nTo show the elementary equations and sequences of a certain chapter in a specific volume:\n\n```python\ndir(my_ipcc.waste.swd.elementary)\n# dir(my_ipcc.waste.swd.sequence)\n```\n\nTo find information about a elementary equation:\n\n```python\nhelp(my_ipcc.waste.swd.elementary.ddoc_from_wd_data)\n```\n\nThe following will print the docstring with information on the parameters and the reqiured units:\n\n```\nHelp on function ddoc_from_wd_data in module bonsai_ipcc.waste.swd.elementary:\n\nddoc_from_wd_data_tier1(waste, doc, doc_f, mcf)\n    Equation 3.2 (tier 1)\n\n    Calculates the decomposable doc (ddocm) from waste disposal data.\n\n    Argument\n    ---------\n    waste (tonnes) : float\n        Amount of waste\n        (either wet or dry-matter, but attention to doc!)\n    doc (kg/kg) : float\n        Fraction of degradable organic carbon in waste.\n    doc_F (kg/kg) : float\n        Fraction of doc that can decompose.\n    mcf (kg/kg) : float\n        CH4 correction factor for aerobic decomposition in the year of decompostion.\n\n    Returns\n    -------\n    VALUE: float\n        Decomposable doc (tonnes/year)\n```\n\nTo show the dimensions of a certain parameter:\n\n```python\nmy_ipcc.waste.swd.parameter.mcf.index.names\n```\n```\nFrozenList(['swds_type', 'property'])\n```\n\nTo find the possible values of a dimension:\n\n```python\nmy_ipcc.waste.swd.dimension.swds_type.index\n```\n```\nIndex(['managed', 'managed_well_s-a', 'managed_poorly_s-a', 'managed_well_a-a',\n       'managed_poorly_a-a', 'unmanaged_deep', 'unmanaged_shallow',\n       'uncharacterised'],\n      dtype='object', name='code')\n```\n\nTo retrieve the value and the unit of a certain parameter.\n```python\nmy_ipcc.waste.swd.parameter.mcf.loc[(\"managed\",\"def\")]\n```\n```\nvalue      1.0\nunit     kg/kg\nName: (managed, def), dtype: object\n```\n\n\n### Run a tier sequence\n\nDespite the fact that various default data for parameter tables is provided within the `bonsai_ipcc` package, in most cases, the user still needs to collect data to calculate the greenhouse gas inventories.\nFor the `tier1_co2` sequence in the `incineration` chapter of volume `waste`, data for urban population is required.\nThe data can be added as a pandas DataFrame.\n```python\nimport bonsai_ipcc\nimport pandas as pd\n\n# urban population\nd = {\n    \"year\": [2010,2010,2010,2010,2010],\n    \"region\": [\"DE\",\"DE\",\"DE\",\"DE\",\"DE\"],\n    \"property\": [\n        \"def\",\"min\",\"max\",\"abs_min\",\"abs_max\"\n    ],\n    \"value\": [\n        62940432,61996325.52,63884538.48,0.0,\"inf\",\n    ],\n    \"unit\": [\n    \"cap/yr\",\"cap/yr\",\"cap/yr\",\"cap/yr\",\"cap/yr\",\n    ],\n}\nurb_pop = pd.DataFrame(d).set_index([\"year\", \"region\", \"property\"])\n\nmy_ipcc=bonsai_ipcc.IPCC()\nmy_ipcc.waste.incineration.parameter.urb_population=urb_pop\n```\n\n\u003e **_NOTE:_** When adding own data, the user is encouraged to also specify uncertainty information. Property \"def\" is always required and specifies the mean value. For uncertainty analysis \"min\", \"max\", \"abs_min\" and \"abs_max\" are required (\"min\": 2.5 percentile, \"max\": 97.5 percentile, \"abs_min\": absolute minimum, \"abs_max\": absolute maximum).\n\nTo get a list of all parameters involved in the sequence, you can do:\n```python\nmy_ipcc.inspect(my_ipcc.waste.incineration.sequence.tier1_co2)\n```\n\nTo calculate the GHG inventory based on a tier method, specifiy the keywords of the sequence. The keywords are in most cases `year`, `region`, `product`, `activity` and `uncertainty`. Only in view cases more than these are required due to the complexity of the sequence.\n\n```python\nmy_tier = my_ipcc.waste.incineration.sequence.tier1_co2(\n          year=2010, region=\"DE\", product=\"msw_plastics\", activity=\"inc_unspecified\", uncertainty=\"def\")\n\n# show the list of steps of the sequence\nmy_tier.to_dict()\n```\nFor uncertainty calculation based on Monte Carlo use `uncertainty=\"monte_carlo\"`, for analytical error propagation use `uncertainty=\"analytical\"`.\n\nTo retrieve the result's value of a sequence's step, type:\n```python\nmy_tier.co2_emissions.value\n```\n\n\u003e **_NOTE:_** The type of `value` depends on the uncertainty assessment. For `uncertainty = \"def\"`: `type = float`, for `uncertainty = \"analytical\"`: `type = ufloat` and for `uncertainty = \"monte-carlo\"`: `type = numpy.array`. Furthermore, some tier sequences provide time series instead of one single value. If so, `value` is of type `numpy.array`, including the values for different years. The type of each years' value also depend on the uncertainty assessment.\n\n### Analyze the results for a tier sequence\n\nThe signature, steps, parameter description can be retrieved as pandas DataFrame. By using the `to_frames()` method, a dictionary is provided including the dataframes for:\n- signature (includes the arguments that has been used to run the sequence, e.g. `year`, `region`, `activity`, `product`)\n- steps (all steps of the sequence in tabular format, including the paramters values)\n- description (with the metadata of the involved paramters, including the reference to the ipcc pdf documents)\n\n```\ndfs=my_tier.to_frames(bonsai=False)\n\ndfs[\"signature\"]\ndfs[\"steps\"]\ndfs[\"description\"]\n```\n\n\n### Only for the Bonsai project\n\nFor the [Bonsai project](https://gitlab.com/bonsamurais/bonsai) additional sequences are added as so-called paramterized production functions (PPF). These sequences are based on the paramter tables and equations of the ipcc guidelines, but also include additional information required in the project.\n\n```python\nfrom bonsai_ipcc import PPF\n\nmy_ppf = PPF()\nmy_tier = my_ppf.ppf_vol.metal.sequence.coke_tier1(\n          year=2010, region=\"DE\", activity=\"by-product_recovery\", uncertainty=\"def\")\n\n# show the list of steps of the sequence\nmy_tier.to_dict()\n```\n\nContrary to the sequences of `IPCC()`, the sequences of `PPF()` include all greenhouse gas emissions at once.\n\nThe following tables are generated by a PPF for an `activity` in a certain `year` and `region`:\n- `supply`: supply of products\n- `use`: use of products\n- `emission`: emissions per activity\n- `resource`: resource use per activity\n- `transf_coeff`: transfer coefficient, defined as the proportion of a input which is present in a reference output provided by the activity. It indicates that the input is a feedstock material for the activity, and is embodied in the reference output. The transfer coefficients for one input needs to sum up to 1 accross all outputs in which the input is embodied. The transfer coefficients can be used to calculated waste outputs, when no specific information is given, as well as to ensure mass balance.\n\nThe additional dataframes can be generated by `to_frames(bonsai=True)`. In doing so, the schemes for the supply, use and emission tables of the Bonsai project are used to create pandas DataFrames, and filled with information based on the tier sequence´s result.\n```\ndfs=my_tier.to_frames(bonsai=True)\n\ndfs[\"bonsai\"][\"use\"]\ndfs[\"bonsai\"][\"supply\"]\ndfs[\"bonsai\"][\"emission\"]\ndfs[\"bonsai\"][\"transf_coeff\"]\n```\n\n\u003e **_NOTE:_** When using the option `bonsai=True`, only parameters and its values are used to fill the Bonsai tables, which fully correpond to the Bonsai tables. For instance, some sequences do not calculate the amount of the `product` which is genrereatd by the `activity` as a parameter. Thus, the `supply` table would be empty.\n","funding_links":[],"readme_doi_urls":[],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":[],"project_url":"https://ost.ecosyste.ms/api/v1/projects/191416","html_url":"https://ost.ecosyste.ms/projects/191416"}