{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using the aggregation functionality of pymrio" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Pymrio offers various possibilities to achieve an aggregation of a existing MRIO system.\n", "The following section will present all of them in turn, using the test MRIO system included in pymrio.\n", "The same concept can be applied to real life MRIOs." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Some of the examples rely in the [country converter coco](https://github.com/IndEcol/country_converter). The minimum version required is coco >= 0.6.3 - install the latest version with\n", "```\n", "pip install country_converter --upgrade\n", "```\n", "Coco can also be installed from the Anaconda Cloud - see the coco readme for further infos." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading the test mrio" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we load and explore the test MRIO included in pymrio:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "import pymrio" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io = pymrio.load_test()\n", "io.calc_all()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Sectors: ['food', 'mining', 'manufactoring', 'electricity', 'construction', 'trade', 'transport', 'other'],\n", "Regions: ['reg1', 'reg2', 'reg3', 'reg4', 'reg5', 'reg6']\n" ] } ], "source": [ "print(f\"Sectors: {io.get_sectors().tolist()},\\nRegions: {io.get_regions().tolist()}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Aggregation using a numerical concordance matrix" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is the standard way to aggregate MRIOs when you work in Matlab.\n", "To do so, we need to set up a concordance matrix in which the columns correspond to the orignal classification and the rows to the aggregated one." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "sec_agg_matrix = np.array(\n", " [[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1]]\n", ")\n", "\n", "reg_agg_matrix = np.array([[1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1]])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io.aggregate(region_agg=reg_agg_matrix, sector_agg=sec_agg_matrix)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Sectors: ['sec0', 'sec1', 'sec2'],\n", "Regions: ['reg0', 'reg1']\n" ] } ], "source": [ "print(f\"Sectors: {io.get_sectors().tolist()},\\nRegions: {io.get_regions().tolist()}\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io.calc_all()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionreg0reg1
sectorsec0sec1sec2sec0sec1sec2
stressorcompartment
emission_type1air9.041149e+063.018791e+081.523236e+082.469465e+073.468742e+082.454117e+08
emission_type2water2.123543e+064.884509e+079.889757e+076.000239e+064.594530e+071.892731e+08
\n", "
" ], "text/plain": [ "region reg0 \\\n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 9.041149e+06 3.018791e+08 1.523236e+08 \n", "emission_type2 water 2.123543e+06 4.884509e+07 9.889757e+07 \n", "\n", "region reg1 \n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 2.469465e+07 3.468742e+08 2.454117e+08 \n", "emission_type2 water 6.000239e+06 4.594530e+07 1.892731e+08 " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io.emissions.D_cba" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To use custom names for the aggregated sectors or regions, pass a list of names in order of rows in the concordance matrix:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "io = (\n", " pymrio.load_test()\n", " .calc_all()\n", " .aggregate(\n", " region_agg=reg_agg_matrix,\n", " region_names=[\"World Region A\", \"World Region B\"],\n", " inplace=False,\n", " )\n", ")" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['World Region A', 'World Region B'], dtype='object', name='region')" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io.get_regions()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Aggregation using a numerical vector" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Pymrio also accepts the aggregatio information as numerical or string vector.\n", "For these, each entry in the vector assignes the sector/region to a aggregation group.\n", "Thus the two aggregation matrices from above (*sec_agg_matrix* and *reg_agg_matrix*) can also be represented as numerical or string vectors/lists:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "sec_agg_vec = np.array([0, 1, 1, 1, 1, 2, 2, 2])\n", "reg_agg_vec = [\"R1\", \"R1\", \"R1\", \"R2\", \"R2\", \"R2\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "can also be represented as aggregation vector:" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "io_vec_agg = (\n", " pymrio.load_test()\n", " .calc_all()\n", " .aggregate(region_agg=reg_agg_vec, sector_agg=sec_agg_vec, inplace=False)\n", ")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Sectors: ['sec0', 'sec1', 'sec2'],\n", "Regions: ['R1', 'R2']\n" ] } ], "source": [ "print(\n", " f\"Sectors: {io_vec_agg.get_sectors().tolist()},\\nRegions: {io_vec_agg.get_regions().tolist()}\"\n", ")" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionR1R2
stressorcompartment
emission_type1air6.690192e+081.686954e+09
emission_type2water5.337682e+085.902081e+08
\n", "
" ], "text/plain": [ "region R1 R2\n", "stressor compartment \n", "emission_type1 air 6.690192e+08 1.686954e+09\n", "emission_type2 water 5.337682e+08 5.902081e+08" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io_vec_agg.emissions.D_cba_reg" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Regional aggregation using the country converter coco" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The previous examples are best suited if you want to reuse existing aggregation information.\n", "For new/ad hoc aggregation, the most user-friendly solution is to build the concordance with the [country converter coco](https://github.com/IndEcol/country_converter). The minimum version of coco required is 0.6.2. You can either use coco to build independent aggregations (first case below) or use the predefined classifications included in coco (second case - Example WIOD below)." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "import country_converter as coco" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Independent aggregation" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "io = pymrio.load_test().calc_all()" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "reg_agg_coco = coco.agg_conc(\n", " original_countries=io.get_regions(),\n", " aggregates={\n", " \"reg1\": \"World Region A\",\n", " \"reg2\": \"World Region A\",\n", " \"reg3\": \"World Region A\",\n", " },\n", " missing_countries=\"World Region B\",\n", ")" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io.aggregate(region_agg=reg_agg_coco)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Sectors: ['food', 'mining', 'manufactoring', 'electricity', 'construction', 'trade', 'transport', 'other'],\n", "Regions: ['World Region A', 'World Region B']\n" ] } ], "source": [ "print(f\"Sectors: {io.get_sectors().tolist()},\\nRegions: {io.get_regions().tolist()}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This can be passed directly to pymrio:" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionWorld Region AWorld Region B
stressorcompartment
emission_type1air6.690192e+081.686954e+09
emission_type2water5.337682e+085.902081e+08
\n", "
" ], "text/plain": [ "region World Region A World Region B\n", "stressor compartment \n", "emission_type1 air 6.690192e+08 1.686954e+09\n", "emission_type2 water 5.337682e+08 5.902081e+08" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io.emissions.D_cba_reg" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A pandas DataFrame corresponding to the output from *coco* can also be passed to *sector_agg* for aggregation.\n", "A sector aggregation package similar to the country converter is planned." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using the build-in classifications - WIOD example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The country converter is most useful when you work with a MRIO which is included in coco. In that case you can just pass the desired country aggregation to coco and it returns the required aggregation matrix:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For the example here, we assume that a raw WIOD download is available at:" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "wiod_raw = \"/tmp/mrios/WIOD2013\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will parse the year 2000 and calculate the results:" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "wiod_orig = pymrio.parse_wiod(path=wiod_raw, year=2000).calc_all()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and then aggregate the database to first the EU countries and group the remaining countries based on OECD membership. In the example below, we single out Germany (DEU) to be not included in the aggregation:" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "wiod_agg_DEU_EU_OECD = wiod_orig.aggregate(\n", " region_agg=coco.agg_conc(\n", " original_countries=\"WIOD\",\n", " aggregates=[{\"DEU\": \"DEU\"}, \"EU\", \"OECD\"],\n", " missing_countries=\"Other\",\n", " merge_multiple_string=None,\n", " ),\n", " inplace=False,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can then rename the regions to make the membership clearer:" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "wiod_agg_DEU_EU_OECD.rename_regions({\"OECD\": \"OECDwoEU\", \"EU\": \"EUwoGermany\"})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To see the result for the air emission footprints:" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionOECDwoEUEUwoGermanyOtherDEU
stressor
CO21.029626e+073.120346e+069.232742e+061.123772e+06
CH46.595964e+072.605212e+071.487615e+087.953304e+06
N2O2.312456e+061.055048e+066.166586e+062.941486e+05
NOX3.986117e+071.130268e+075.103133e+073.164278e+06
SOX3.567011e+071.034605e+075.137882e+072.045926e+06
CO2.032219e+084.789266e+074.424992e+081.296816e+07
NMVOC3.680383e+071.280083e+078.186918e+072.870176e+06
NH36.013446e+063.307710e+061.674807e+078.656818e+05
\n", "
" ], "text/plain": [ "region OECDwoEU EUwoGermany Other DEU\n", "stressor \n", "CO2 1.029626e+07 3.120346e+06 9.232742e+06 1.123772e+06\n", "CH4 6.595964e+07 2.605212e+07 1.487615e+08 7.953304e+06\n", "N2O 2.312456e+06 1.055048e+06 6.166586e+06 2.941486e+05\n", "NOX 3.986117e+07 1.130268e+07 5.103133e+07 3.164278e+06\n", "SOX 3.567011e+07 1.034605e+07 5.137882e+07 2.045926e+06\n", "CO 2.032219e+08 4.789266e+07 4.424992e+08 1.296816e+07\n", "NMVOC 3.680383e+07 1.280083e+07 8.186918e+07 2.870176e+06\n", "NH3 6.013446e+06 3.307710e+06 1.674807e+07 8.656818e+05" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "wiod_agg_DEU_EU_OECD.AIR.D_cba_reg" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For further examples on the capabilities of the country converter see the [coco tutorial notebook](http://nbviewer.jupyter.org/github/IndEcol/country_converter/blob/master/doc/country_converter_aggregation_helper.ipynb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Aggregation by renaming" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "One alternative method for aggregating the MRIO system is to rename specific regions and/or sectors to duplicated names. \n", "Duplicated sectors and regions can then be automatically aggregated. This makes most sense when having some categories of some kind (e.g. consumption categories) or detailed classification which can easily be broadened (e.g. A01, A02, which could be renamed all to A).\n", "In the example below, we will aggregate sectors to consumption categories using some predefined categories included in pymrio. Check the [Adjusting, Renaming and Restructuring notebook for more details.](adjusting.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mrio = pymrio.load_test()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "class_info = pymrio.get_classification(\"test\")\n", "rename_dict = class_info.get_sector_dict(\n", " orig=class_info.sectors.TestMrioName, new=class_info.sectors.Type\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we take a look at the rename_dict, we see that it maps several sectors of the original MRIO to combined regions (technically a many to one mapping). " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "rename_dict" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using this dict to rename sectors leads to an index with overlapping labels." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mrio.rename_sectors(rename_dict)\n", "mrio.Z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Which can then be aggregated with" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mrio.aggregate_duplicates()\n", "mrio.Z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This method also comes handy when aggregating parts of the MRIO regions. E.g.:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "region_convert = {\"reg1\": \"Antarctica\", \"reg2\": \"Antarctica\"}\n", "mrio.rename_regions(region_convert).aggregate_duplicates()\n", "mrio.Z" ] }, { "cell_type": "markdown", "metadata": { "lines_to_next_cell": 2 }, "source": [ "Which lets us calculate the footprint of the consumption category 'eat' in 'Antarctica':" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "lines_to_next_cell": 2 }, "outputs": [], "source": [ "mrio.calc_all()\n", "mrio.emissions.D_cba.loc[:, (\"Antarctica\", \"eat\")]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Aggregation to one total sector / region" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Both, *region_agg* and *sector_agg*, also accept a string as argument. This leads to the aggregation to one total region or sector for the full IO system." ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionglobal
sectortotal
stressorcompartment
emission_type1air1.080224e+09
emission_type2water3.910848e+08
\n", "
" ], "text/plain": [ "region global\n", "sector total\n", "stressor compartment \n", "emission_type1 air 1.080224e+09\n", "emission_type2 water 3.910848e+08" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pymrio.load_test().calc_all().aggregate(\n", " region_agg=\"global\", sector_agg=\"total\"\n", ").emissions.D_cba" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Pre- vs post-aggregation account calculations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It is generally recommended to calculate MRIO accounts with the highest detail possible and aggregated the results afterwards (post-aggregation - see for example [Steen-Olsen et al 2014](http://dx.doi.org/10.1080/09535314.2014.934325), [Stadler et al 2014](https://zenodo.org/record/1137670#.WlOSOhZG1O8) or [Koning et al 2015](https://doi.org/10.1016/j.ecolecon.2015.05.008).\n", "\n", "Pre-aggregation, that means the aggregation of MRIO sectors and regions before calculation of footprint accounts, might be necessary when dealing with MRIOs on computers with limited RAM resources. However, one should be aware that the results might change.\n", "\n", "Pymrio can handle both cases and can be used to highlight the differences. To do so, we use the two concordance matrices defined at the beginning (*sec_agg_matrix* and *reg_agg_matrix*) and aggregate the test system before and after the calculation of the accounts:" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "io_pre = (\n", " pymrio.load_test()\n", " .aggregate(region_agg=reg_agg_matrix, sector_agg=sec_agg_matrix)\n", " .calc_all()\n", ")\n", "io_post = (\n", " pymrio.load_test()\n", " .calc_all()\n", " .aggregate(region_agg=reg_agg_matrix, sector_agg=sec_agg_matrix)\n", ")" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionreg0reg1
sectorsec0sec1sec2sec0sec1sec2
stressorcompartment
emission_type1air7.722782e+063.494413e+081.388764e+082.695396e+073.354598e+082.217703e+08
emission_type2water1.862161e+065.240950e+071.583465e+086.399685e+064.080509e+071.312619e+08
\n", "
" ], "text/plain": [ "region reg0 \\\n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 7.722782e+06 3.494413e+08 1.388764e+08 \n", "emission_type2 water 1.862161e+06 5.240950e+07 1.583465e+08 \n", "\n", "region reg1 \n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 2.695396e+07 3.354598e+08 2.217703e+08 \n", "emission_type2 water 6.399685e+06 4.080509e+07 1.312619e+08 " ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io_pre.emissions.D_cba" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionreg0reg1
sectorsec0sec1sec2sec0sec1sec2
stressorcompartment
emission_type1air9.041149e+063.018791e+081.523236e+082.469465e+073.468742e+082.454117e+08
emission_type2water2.123543e+064.884509e+079.889757e+076.000239e+064.594530e+071.892731e+08
\n", "
" ], "text/plain": [ "region reg0 \\\n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 9.041149e+06 3.018791e+08 1.523236e+08 \n", "emission_type2 water 2.123543e+06 4.884509e+07 9.889757e+07 \n", "\n", "region reg1 \n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 2.469465e+07 3.468742e+08 2.454117e+08 \n", "emission_type2 water 6.000239e+06 4.594530e+07 1.892731e+08 " ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io_post.emissions.D_cba" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The same results as in io_pre are obtained for io_post, if we recalculate the footprint accounts based on the aggregated system:" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
regionreg0reg1
sectorsec0sec1sec2sec0sec1sec2
stressorcompartment
emission_type1air7.722782e+063.494413e+081.388764e+082.695396e+073.354598e+082.217703e+08
emission_type2water1.862161e+065.240950e+071.583465e+086.399685e+064.080509e+071.312619e+08
\n", "
" ], "text/plain": [ "region reg0 \\\n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 7.722782e+06 3.494413e+08 1.388764e+08 \n", "emission_type2 water 1.862161e+06 5.240950e+07 1.583465e+08 \n", "\n", "region reg1 \n", "sector sec0 sec1 sec2 \n", "stressor compartment \n", "emission_type1 air 2.695396e+07 3.354598e+08 2.217703e+08 \n", "emission_type2 water 6.399685e+06 4.080509e+07 1.312619e+08 " ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io_post.reset_all_full().calc_all().emissions.D_cba" ] } ], "metadata": { "jupytext": { "formats": "ipynb,py:percent" }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }