Run a tier sequence

This tutorial explains the core functionality of the bonsai_ipcc package. Let´s assume we want to determine the CO2 emissions from waste incineration based on the tier 1 approach. According to the IPCC guidelines, different waste fractions are available. Here we chose year 2010, Germany and waste type msw_plastics, which stands for municipal plastic waste (you can check all availbe waste types by my_ipcc.waste.incineration.dimension.waste_type) and unspecified incineration technology.

import bonsai_ipcc
my_ipcc = bonsai_ipcc.IPCC()
my_ipcc.waste.incineration.sequence.tier1_co2(year=2010, region="DE",wastetype="msw_plastics", incintype="inc_unspecified", uncertainty="def")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 3
      1 import bonsai_ipcc
      2 my_ipcc = bonsai_ipcc.IPCC()
----> 3 my_ipcc.waste.incineration.sequence.tier1_co2(year=2010, region="DE",wastetype="msw_plastics", incintype="inc_unspecified", uncertainty="def")

TypeError: tier1_co2() got an unexpected keyword argument 'wastetype'

Trying to do so, generates a an KeyError mentioning that it could not find the coordinate for year 2010 and Germany in the paramter table urb_population. Let´s have a look into this parameter table.

my_ipcc.waste.incineration.parameter.urb_population

It is empty. The reason is that the IPCC guidelines do not provide default data for all parameters. In these cases we need to add the data to the specific parameter. Let´s do this for the urban population in Germany in 2010.

import pandas as pd

# urban population
d = {
    "year": [2010,2010,2010,2010,2010],
    "region": ["DE","DE","DE","DE","DE"],
    "property": [
        "def","min","max","abs_min","abs_max"
    ],
    "value": [
        62940432,61996325.52,63884538.48,0.0,"inf",
    ],
    "unit": [
    "cap/yr","cap/yr","cap/yr","cap/yr","cap/yr",
    ],
}
urb_pop = pd.DataFrame(d).set_index(["year", "region", "property"])

my_ipcc.waste.incineration.parameter.urb_population=urb_pop

And run the sequence again.

my_tier = my_ipcc.waste.incineration.sequence.tier1_co2(
          year=2010, region="DE",wastetype="msw_plastics", incintype="inc_unspecified", uncertainty="def")
my_tier.to_dict()

Each step involved in the calculation is stored in the dictionary. It starts with the input signature and ends with the final result of CO2 emsissions.