From 5e34dfc11387fdbe7f5c6c5a647e423ac2718b7a Mon Sep 17 00:00:00 2001 From: Zeb Nicholls Date: Mon, 15 Oct 2018 15:58:07 +0200 Subject: [PATCH] Add region sum check (#88) * Add failing tests of database checking * Pass failing tests of database checking Update tutorials a bit too Ready to give to Matt and Dan for first look * Update based on conversations * Add release note * Remove World region hardcoding * Update tutorial notebook * Update docstrings * Clean up linting errors * Attempt to pass stickler --- .gitignore | 3 + RELEASE_NOTES.md | 1 + pyam/core.py | 143 +- pyam/utils.py | 1 + tests/conftest.py | 125 + tests/test_core.py | 190 +- tutorial/checking_databases.ipynb | 4880 +++++++++++++++++++++++++++++ tutorial/pyam_first_steps.ipynb | 27 +- 8 files changed, 5353 insertions(+), 17 deletions(-) create mode 100644 tutorial/checking_databases.ipynb diff --git a/.gitignore b/.gitignore index b5d8ab7da..cb3ec68d0 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,6 @@ ENV/ # mypy .mypy_cache/ + +# pytest +.pytest_cache/ diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9f1d2bbed..ea918c0d3 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -9,6 +9,7 @@ - (#93)[https://github.com/IAMconsortium/pyam/pull/93] IamDataFrame can be initilialzed from pd.DataFrame with index - (#92)[https://github.com/IAMconsortium/pyam/pull/92] Adding `$` to the pseudo-regexp syntax in `pattern_match()`, adds override option - (#90)[https://github.com/IAMconsortium/pyam/pull/90] Adding a function to `set_panel_label()` as part of the plotting library +- (#88)[https://github.com/IAMconsortium/pyam/pull/88] Adding `check_aggregate_regions` and `check_internal_consistency` to help with database validation, especially for emissions users - (#87)[https://github.com/IAMconsortium/pyam/pull/87] Extending `rename()` to work with model and scenario names - (#85)[https://github.com/IAMconsortium/pyam/pull/85] Improved functionality for importing metadata and bugfix for filtering for strings if `nan` values exist in metadata - (#83)[https://github.com/IAMconsortium/pyam/pull/83] Extending `filter_by_meta()` to work with non-matching indices between `df` and `data diff --git a/pyam/core.py b/pyam/core.py index 614c366e9..2ec721d2d 100644 --- a/pyam/core.py +++ b/pyam/core.py @@ -31,6 +31,7 @@ cast_years_to_int, META_IDX, YEAR_IDX, + REGION_IDX, IAMC_IDX, SORT_IDX, LONG_IDX, @@ -516,7 +517,13 @@ def check_aggregate(self, variable, components=None, units=None, components = self.filter(variable='{}|*'.format(variable), level=0).variables() - # filter and groupby data, use `pd.Series.align` for machting index + if not len(components): + msg = '{} - cannot check aggregate because it has no components' + logger().info(msg.format(variable)) + + return + + # filter and groupby data, use `pd.Series.align` for matching index df_variable, df_components = ( _aggregate_by_variables(self.data, variable, units) .align(_aggregate_by_variables(self.data, components, units)) @@ -527,14 +534,133 @@ def check_aggregate(self, variable, components=None, units=None, **kwargs)] if len(diff): - msg = '{} of {} data points are not aggregates of components' - logger().info(msg.format(len(diff), len(df_variable))) + msg = '{} - {} of {} data points are not aggregates of components' + logger().info(msg.format(variable, len(diff), len(df_variable))) + + if exclude_on_fail: + self._exclude_on_fail(diff.index.droplevel([2, 3])) + + diff = pd.concat([diff], keys=[variable], names=['variable']) + + return diff.unstack().rename_axis(None, axis=1) + + def check_aggregate_regions(self, variable, region='World', + components=None, units=None, + exclude_on_fail=False, **kwargs): + """Check whether the region timeseries data match the aggregation + of components + + Parameters + ---------- + variable: str + variable to be checked for matching aggregation of components data + region: str + region to be checked for matching aggregation of components data + components: list of str, default None + list of regions, defaults to all regions except region + units: str or list of str, default None + filter variable and components for given unit(s) + exclude_on_fail: boolean, default False + flag scenarios failing validation as `exclude: True` + kwargs: passed to `np.isclose()` + """ + var_df = self.filter(variable=variable, level=0) + + if components is None: + components = var_df.filter(region=region, keep=False).regions() + + if not len(components): + msg = ( + '{} - cannot check regional aggregate because it has no ' + 'regional components' + ) + logger().info(msg.format(variable)) + + return None + + # filter and groupby data, use `pd.Series.align` for matching index + df_region, df_components = ( + _aggregate_by_regions(var_df.data, region, units) + .align(_aggregate_by_regions(var_df.data, components, units)) + ) + + df_components.index = df_components.index.droplevel( + "variable" + ) + + # Add in variables that are included in region totals but which + # aren't included in the regional components. + # For example, if we are looking at World and Emissions|BC, we need + # to add aviation and shipping to the sum of Emissions|BC for each + # of World's regional components to do a valid check. + different_region = components[0] + variable_components = self.filter( + variable="{}|*".format(variable) + ).variables() + for var_to_add in variable_components: + var_rows = self.data.variable == var_to_add + region_rows = self.data.region == different_region + var_has_regional_info = (var_rows & region_rows).any() + if not var_has_regional_info: + df_var_to_add = self.filter( + region=region, variable=var_to_add + ).data.groupby(REGION_IDX).sum()['value'] + df_var_to_add.index = df_var_to_add.index.droplevel("variable") + + if len(df_var_to_add): + df_components = df_components.add(df_var_to_add, + fill_value=0) + + df_components = pd.concat([df_components], keys=[variable], + names=['variable']) + + # use `np.isclose` for checking match + diff = df_region[~np.isclose(df_region, df_components, **kwargs)] + + if len(diff): + msg = ( + '{} - {} of {} data points are not aggregates of regional ' + 'components' + ) + logger().info(msg.format(variable, len(diff), len(df_region))) if exclude_on_fail: self._exclude_on_fail(diff.index.droplevel([2, 3])) + diff = pd.concat([diff], keys=[region], names=['region']) + return diff.unstack().rename_axis(None, axis=1) + def check_internal_consistency(self, **kwargs): + """Check whether the database is internally consistent + + We check that all variables are equal to the sum of their sectoral + components and that all the regions add up to the World total. If + the check is passed, None is returned, otherwise a dictionary of + inconsistent variables is returned. + + Note: at the moment, this method's regional checking is limited to + checking that all the regions sum to the World region. We cannot + make this more automatic unless we start to store how the regions + relate, see + [this issue](https://github.com/IAMconsortium/pyam/issues/106). + + Parameters + ---------- + kwargs: passed to `np.isclose()` + """ + inconsistent_vars = {} + for variable in self.variables(): + diff_agg = self.check_aggregate(variable, **kwargs) + if diff_agg is not None: + inconsistent_vars[variable + "-aggregate"] = diff_agg + + diff_regional = self.check_aggregate_regions(variable, **kwargs) + if diff_regional is not None: + inconsistent_vars[variable + "-regional"] = diff_regional + + return inconsistent_vars if inconsistent_vars else None + def _exclude_on_fail(self, df): """Assign a selection of scenarios as `exclude: True` in meta""" idx = df if isinstance(df, pd.MultiIndex) else _meta_idx(df) @@ -880,6 +1006,17 @@ def _aggregate_by_variables(df, variables, units=None): return df.groupby(YEAR_IDX).sum()['value'] +def _aggregate_by_regions(df, regions, units=None): + regions = [regions] if isstr(regions) else regions + df = df[df.region.isin(regions)] + + if units is not None: + units = [units] if isstr(units) else units + df = df[df.unit.isin(units)] + + return df.groupby(REGION_IDX).sum()['value'] + + def _apply_filters(data, meta, filters): """Applies filters to the data and meta tables of an IamDataFrame. diff --git a/pyam/utils.py b/pyam/utils.py index 9fd69e132..7a0e0e967 100644 --- a/pyam/utils.py +++ b/pyam/utils.py @@ -29,6 +29,7 @@ # common indicies META_IDX = ['model', 'scenario'] YEAR_IDX = ['model', 'scenario', 'region', 'year'] +REGION_IDX = ['model', 'scenario', 'variable', 'year'] IAMC_IDX = ['model', 'scenario', 'region', 'variable', 'unit'] SORT_IDX = ['model', 'scenario', 'variable', 'year', 'region'] LONG_IDX = IAMC_IDX + ['year'] diff --git a/tests/conftest.py b/tests/conftest.py index 999881aa8..46601d898 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,6 +31,119 @@ ) +mg_ascen = ['MSG-GLB', 'a_scen'] +mg_ascen_2 = ['MSG-GLB', 'a_scen_2'] +CHECK_AGG_DF = pd.DataFrame([ + ['IMG', 'a_scen', 'R5ASIA', 'Primary Energy', 'EJ/y', 1, 6], + ['IMG', 'a_scen', 'R5ASIA', 'Primary Energy|Coal', 'EJ/y', 0.75, 5], + ['IMG', 'a_scen', 'R5ASIA', 'Primary Energy|Gas', 'EJ/y', 0.25, 1], + ['IMG', 'a_scen', 'R5ASIA', 'Emissions|CO2', 'Mt CO2/yr', 3, 8], + ['IMG', 'a_scen', 'R5ASIA', 'Emissions|CO2|Cars', 'Mt CO2/yr', 1, 3], + ['IMG', 'a_scen', 'R5ASIA', 'Emissions|CO2|Tar', 'Mt CO2/yr', 2, 5], + ['IMG', 'a_scen', 'R5REF', 'Primary Energy', 'EJ/y', 0.3, 0.6], + ['IMG', 'a_scen', 'R5REF', 'Primary Energy|Coal', 'EJ/y', 0.15, 0.4], + ['IMG', 'a_scen', 'R5REF', 'Primary Energy|Gas', 'EJ/y', 0.15, 0.2], + ['IMG', 'a_scen', 'R5REF', 'Emissions|CO2', 'Mt CO2/yr', 1, 1.4], + ['IMG', 'a_scen', 'R5REF', 'Emissions|CO2|Cars', 'Mt CO2/yr', 0.6, 0.8], + ['IMG', 'a_scen', 'R5REF', 'Emissions|CO2|Tar', 'Mt CO2/yr', 0.4, 0.6], + ['IMG', 'a_scen', 'World', 'Primary Energy', 'EJ/y', 1.3, 6.6], + ['IMG', 'a_scen', 'World', 'Primary Energy|Coal', 'EJ/y', 0.9, 5.4], + ['IMG', 'a_scen', 'World', 'Primary Energy|Gas', 'EJ/y', 0.4, 1.2], + ['IMG', 'a_scen', 'World', 'Emissions|CO2', 'Mt CO2/yr', 4, 9.4], + ['IMG', 'a_scen', 'World', 'Emissions|CO2|Cars', 'Mt CO2/yr', 1.6, 3.8], + ['IMG', 'a_scen', 'World', 'Emissions|CO2|Tar', 'Mt CO2/yr', 2.4, 5.6], + ['IMG', 'a_scen_2', 'R5ASIA', 'Primary Energy', 'EJ/y', 1.4, 6.4], + ['IMG', 'a_scen_2', 'R5ASIA', 'Primary Energy|Coal', 'EJ/y', 0.95, 5.2], + ['IMG', 'a_scen_2', 'R5ASIA', 'Primary Energy|Gas', 'EJ/y', 0.45, 1.2], + ['IMG', 'a_scen_2', 'R5ASIA', 'Emissions|CO2', 'Mt CO2/yr', 3.4, 8.4], + ['IMG', 'a_scen_2', 'R5ASIA', 'Emissions|CO2|Cars', 'Mt CO2/yr', 1.2, 3.2], + ['IMG', 'a_scen_2', 'R5ASIA', 'Emissions|CO2|Tar', 'Mt CO2/yr', 2.2, 5.2], + ['IMG', 'a_scen_2', 'R5REF', 'Primary Energy', 'EJ/y', 0.7, 1.0], + ['IMG', 'a_scen_2', 'R5REF', 'Primary Energy|Coal', 'EJ/y', 0.35, 0.6], + ['IMG', 'a_scen_2', 'R5REF', 'Primary Energy|Gas', 'EJ/y', 0.35, 0.4], + ['IMG', 'a_scen_2', 'R5REF', 'Emissions|CO2', 'Mt CO2/yr', 1.4, 1.8], + ['IMG', 'a_scen_2', 'R5REF', 'Emissions|CO2|Cars', 'Mt CO2/yr', 0.8, 1.0], + ['IMG', 'a_scen_2', 'R5REF', 'Emissions|CO2|Tar', 'Mt CO2/yr', 0.6, 0.8], + ['IMG', 'a_scen_2', 'World', 'Primary Energy', 'EJ/y', 2.1, 7.4], + ['IMG', 'a_scen_2', 'World', 'Primary Energy|Coal', 'EJ/y', 1.3, 5.8], + ['IMG', 'a_scen_2', 'World', 'Primary Energy|Gas', 'EJ/y', 0.8, 1.6], + ['IMG', 'a_scen_2', 'World', 'Emissions|CO2', 'Mt CO2/yr', 4.8, 10.2], + ['IMG', 'a_scen_2', 'World', 'Emissions|CO2|Cars', 'Mt CO2/yr', 2.0, 4.2], + ['IMG', 'a_scen_2', 'World', 'Emissions|CO2|Tar', 'Mt CO2/yr', 2.8, 6.0], + mg_ascen + ['R5ASIA', 'Primary Energy', 'EJ/y', 0.8, 5.8], + mg_ascen + ['R5ASIA', 'Primary Energy|Coal', 'EJ/y', 0.65, 4.9], + mg_ascen + ['R5ASIA', 'Primary Energy|Gas', 'EJ/y', 0.15, 0.9], + mg_ascen + ['R5ASIA', 'Emissions|CO2', 'Mt CO2/yr', 2.8, 7.8], + mg_ascen + ['R5ASIA', 'Emissions|CO2|Cars', 'Mt CO2/yr', 0.9, 2.9], + mg_ascen + ['R5ASIA', 'Emissions|CO2|Tar', 'Mt CO2/yr', 1.9, 4.9], + mg_ascen + ['R5REF', 'Primary Energy', 'EJ/y', 0.1, 0.4], + mg_ascen + ['R5REF', 'Primary Energy|Coal', 'EJ/y', 0.05, 0.3], + mg_ascen + ['R5REF', 'Primary Energy|Gas', 'EJ/y', 0.05, 0.1], + mg_ascen + ['R5REF', 'Emissions|CO2', 'Mt CO2/yr', 0.8, 1.2], + mg_ascen + ['R5REF', 'Emissions|CO2|Cars', 'Mt CO2/yr', 0.5, 0.7], + mg_ascen + ['R5REF', 'Emissions|CO2|Tar', 'Mt CO2/yr', 0.3, 0.5], + mg_ascen + ['World', 'Primary Energy', 'EJ/y', 0.9, 6.2], + mg_ascen + ['World', 'Primary Energy|Coal', 'EJ/y', 0.7, 5.2], + mg_ascen + ['World', 'Primary Energy|Gas', 'EJ/y', 0.2, 1.0], + mg_ascen + ['World', 'Emissions|CO2', 'Mt CO2/yr', 3.6, 9.0], + mg_ascen + ['World', 'Emissions|CO2|Cars', 'Mt CO2/yr', 1.4, 3.6], + mg_ascen + ['World', 'Emissions|CO2|Tar', 'Mt CO2/yr', 2.2, 5.4], + mg_ascen_2 + ['R5ASIA', 'Primary Energy', 'EJ/y', -1.4, -6.4], + mg_ascen_2 + ['R5ASIA', 'Primary Energy|Coal', 'EJ/y', -0.95, -5.2], + mg_ascen_2 + ['R5ASIA', 'Primary Energy|Gas', 'EJ/y', -0.45, -1.2], + mg_ascen_2 + ['R5ASIA', 'Emissions|CO2', 'Mt CO2/yr', -3.4, -8.4], + mg_ascen_2 + ['R5ASIA', 'Emissions|CO2|Cars', 'Mt CO2/yr', -1.2, -3.2], + mg_ascen_2 + ['R5ASIA', 'Emissions|CO2|Tar', 'Mt CO2/yr', -2.2, -5.2], + mg_ascen_2 + ['R5REF', 'Primary Energy', 'EJ/y', -0.7, -1.0], + mg_ascen_2 + ['R5REF', 'Primary Energy|Coal', 'EJ/y', -0.35, -0.6], + mg_ascen_2 + ['R5REF', 'Primary Energy|Gas', 'EJ/y', -0.35, -0.4], + mg_ascen_2 + ['R5REF', 'Emissions|CO2', 'Mt CO2/yr', -1.4, -1.8], + mg_ascen_2 + ['R5REF', 'Emissions|CO2|Cars', 'Mt CO2/yr', -0.8, -1.0], + mg_ascen_2 + ['R5REF', 'Emissions|CO2|Tar', 'Mt CO2/yr', -0.6, -0.8], + mg_ascen_2 + ['World', 'Primary Energy', 'EJ/y', -2.1, -7.4], + mg_ascen_2 + ['World', 'Primary Energy|Coal', 'EJ/y', -1.3, -5.8], + mg_ascen_2 + ['World', 'Primary Energy|Gas', 'EJ/y', -0.8, -1.6], + mg_ascen_2 + ['World', 'Emissions|CO2', 'Mt CO2/yr', -5.0, -10.6], + mg_ascen_2 + ['World', 'Emissions|CO2|Cars', 'Mt CO2/yr', -2.0, -4.2], + mg_ascen_2 + ['World', 'Emissions|CO2|Tar', 'Mt CO2/yr', -2.8, -6.0], + mg_ascen_2 + ['World', 'Emissions|CO2|Agg Agg', 'Mt CO2/yr', -0.2, -0.4], + mg_ascen_2 + ['World', 'Emissions|CF4', 'kt CF4/yr', 54, 56], + mg_ascen_2 + ['World', 'Emissions|C2F6', 'kt C2F6/yr', 32, 27], + mg_ascen_2 + ['World', 'Emissions|C2F6|Solvents', 'kt C2F6/yr', 30, 33], + mg_ascen_2 + ['World', 'Emissions|C2F6|Industry', 'kt C2F6/yr', 2, -6], + mg_ascen_2 + ['World', 'Emissions|CH4', 'Mt CH4/yr', 322, 217], + mg_ascen_2 + ['R5REF', 'Emissions|CH4', 'Mt CH4/yr', 30, 201], + mg_ascen_2 + ['R5ASIA', 'Emissions|CH4', 'Mt CH4/yr', 292, 16], +], + columns=['model', 'scenario', 'region', 'variable', 'unit', 2005, 2010], +) + + +CHECK_AGG_REGIONAL_DF = pd.DataFrame([ + ['AIM', 'cscen', 'World', 'Emissions|N2O', 'Mt N/yr', 1.8, 15.6], + ['AIM', 'cscen', 'World', 'Emissions|N2O|Shipping', 'Mt N/yr', 1, 6], + ['AIM', 'cscen', 'World', 'Emissions|N2O|Solvents', 'Mt N/yr', 1.6, 3.8], + ['AIM', 'cscen', 'World', 'Emissions|N2O|Transport', 'Mt N/yr', -0.8, 5.8], + ['AIM', 'cscen', 'RASIA', 'Emissions|N2O', 'Mt N/yr', 0, 5.9], + ['AIM', 'cscen', 'RASIA', 'Emissions|N2O|Solvents', 'Mt N/yr', 0.8, 2.6], + ['AIM', 'cscen', 'RASIA', 'Emissions|N2O|Transport', 'Mt N/yr', -0.8, 3.3], + ['AIM', 'cscen', 'REUROPE', 'Emissions|N2O', 'Mt N/yr', 0.8, 3.7], + ['AIM', 'cscen', 'REUROPE', 'Emissions|N2O|Solvents', 'Mt N/yr', 0.8, 1.2], + ['AIM', 'cscen', 'REUROPE', 'Emissions|N2O|Transport', 'Mt N/yr', 0, 2.5], + ['AIM', 'cscen', 'China', 'Emissions|N2O', 'Mt N/yr', 0.2, 1.3], + ['AIM', 'cscen', 'China', 'Emissions|N2O|Transport', 'Mt N/yr', 0.2, 1.3], + ['AIM', 'cscen', 'Japan', 'Emissions|N2O', 'Mt N/yr', -1, 2], + ['AIM', 'cscen', 'Japan', 'Emissions|N2O|Transport', 'Mt N/yr', -1, 2], + ['AIM', 'cscen', 'Germany', 'Emissions|N2O', 'Mt N/yr', 2, 3], + ['AIM', 'cscen', 'Germany', 'Emissions|N2O|Transport', 'Mt N/yr', 2, 3], + ['AIM', 'cscen', 'UK', 'Emissions|N2O', 'Mt N/yr', -2, -0.5], + ['AIM', 'cscen', 'UK', 'Emissions|N2O|Transport', 'Mt N/yr', -2, -0.5], + +], + columns=['model', 'scenario', 'region', 'variable', 'unit', 2005, 2010], +) + + @pytest.fixture(scope="function") def test_df(): df = IamDataFrame(data=TEST_DF.iloc[:2]) @@ -48,6 +161,18 @@ def meta_df(): yield df +@pytest.fixture(scope="function") +def check_aggregate_df(): + df = IamDataFrame(data=CHECK_AGG_DF) + yield df + + +@pytest.fixture(scope="function") +def check_aggregate_regional_df(): + df = IamDataFrame(data=CHECK_AGG_REGIONAL_DF) + yield df + + @pytest.fixture(scope="function") def reg_df(): df = IamDataFrame(data=REG_DF) diff --git a/tests/test_core.py b/tests/test_core.py index 8c0e2ce6d..b1ad318a1 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -257,27 +257,191 @@ def test_validate_top_level(meta_df): assert list(meta_df['exclude']) == [False, True] +def test_check_aggregate_pass(check_aggregate_df): + obs = check_aggregate_df.filter( + scenario='a_scenario' + ).check_aggregate('Primary Energy') + assert obs is None + + def test_check_aggregate_fail(meta_df): obs = meta_df.check_aggregate('Primary Energy', exclude_on_fail=True) assert len(obs.columns) == 2 - assert obs.index.get_values()[0] == ('a_model', 'a_scenario', 'World') - - -def test_check_aggregate_pass(meta_df): - # make data complete so that aggregtion-test passes - df = pd.DataFrame({'model': 'a_model', 'scenario': 'a_scenario', - 'region': 'World', 'variable': 'Primary Energy|Gas', - 'unit': 'EJ/y', 'year': [2005, 2010], 'value': [.5, 3]}) - meta_df.data = meta_df.data.append(df, ignore_index=True) - obs = meta_df.filter( - scenario='a_scenario').check_aggregate('Primary Energy') - assert obs is None + assert obs.index.get_values()[0] == ( + 'Primary Energy', 'a_model', 'a_scenario', 'World' + ) def test_check_aggregate_top_level(meta_df): obs = check_aggregate(meta_df, variable='Primary Energy', year=2005) assert len(obs.columns) == 1 - assert obs.index.get_values()[0] == ('a_model', 'a_scenario', 'World') + assert obs.index.get_values()[0] == ( + 'Primary Energy', 'a_model', 'a_scenario', 'World' + ) + + +def test_df_check_aggregate_pass(check_aggregate_df): + obs = check_aggregate_df.check_aggregate('Primary Energy') + assert obs is None + + for variable in check_aggregate_df.variables(): + obs = check_aggregate_df.check_aggregate(variable) + assert obs is None + + +def test_df_check_aggregate_regions_pass(check_aggregate_df): + obs = check_aggregate_df.check_aggregate_regions('Primary Energy') + assert obs is None + + for variable in check_aggregate_df.variables(): + obs = check_aggregate_df.check_aggregate_regions(variable) + assert obs is None + + +def run_check_agg_fail(pyam_df, tweak_dict, test_type): + mr = pyam_df.data.model == tweak_dict['model'] + sr = pyam_df.data.scenario == tweak_dict['scenario'] + rr = pyam_df.data.region == tweak_dict['region'] + vr = pyam_df.data.variable == tweak_dict['variable'] + ur = pyam_df.data.unit == tweak_dict['unit'] + + row_to_tweak = mr & sr & rr & vr & ur + assert row_to_tweak.any() + + pyam_df.data.value.iloc[np.where(row_to_tweak)[0]] *= 0.99 + + # the error variable is always the top level one + expected_index = tweak_dict + agg_test = test_type == 'aggregate' + region_world_only_contrib = test_type == 'region-world-only-contrib' + if agg_test or region_world_only_contrib: + expected_index['variable'] = '|'.join( + expected_index['variable'].split('|')[:2] + ) + elif 'region' in test_type: + expected_index['region'] = 'World' + + # units get dropped during aggregation and the index is a list + expected_index = [v for k, v in expected_index.items() if k != 'unit'] + + for variable in pyam_df.variables(): + if test_type == 'aggregate': + obs = pyam_df.check_aggregate( + variable, + ) + elif 'region' in test_type: + obs = pyam_df.check_aggregate_regions( + variable, + ) + + if obs is not None: + assert len(obs.columns) == 2 + assert set(obs.index.get_values()[0]) == set(expected_index) + + +def test_df_check_aggregate_fail(check_aggregate_df): + to_tweak = { + 'model': 'IMG', + 'scenario': 'a_scen_2', + 'region': 'R5REF', + 'variable': 'Emissions|CO2', + 'unit': 'Mt CO2/yr', + } + run_check_agg_fail(check_aggregate_df, to_tweak, 'aggregate') + + +def test_df_check_aggregate_fail_no_regions(check_aggregate_df): + to_tweak = { + 'model': 'MSG-GLB', + 'scenario': 'a_scen_2', + 'region': 'World', + 'variable': 'Emissions|C2F6|Solvents', + 'unit': 'kt C2F6/yr', + } + run_check_agg_fail(check_aggregate_df, to_tweak, 'aggregate') + + +def test_df_check_aggregate_region_fail(check_aggregate_df): + to_tweak = { + 'model': 'IMG', + 'scenario': 'a_scen_2', + 'region': 'World', + 'variable': 'Emissions|CO2', + 'unit': 'Mt CO2/yr', + } + + run_check_agg_fail(check_aggregate_df, to_tweak, 'region') + + +def test_df_check_aggregate_region_fail_no_subsector(check_aggregate_df): + to_tweak = { + 'model': 'MSG-GLB', + 'scenario': 'a_scen_2', + 'region': 'R5REF', + 'variable': 'Emissions|CH4', + 'unit': 'Mt CH4/yr', + } + + run_check_agg_fail(check_aggregate_df, to_tweak, 'region') + + +def test_df_check_aggregate_region_fail_world_only_var(check_aggregate_df): + to_tweak = { + 'model': 'MSG-GLB', + 'scenario': 'a_scen_2', + 'region': 'World', + 'variable': 'Emissions|CO2|Agg Agg', + 'unit': 'Mt CO2/yr', + } + + run_check_agg_fail( + check_aggregate_df, to_tweak, 'region-world-only-contrib' + ) + + +def test_df_check_aggregate_regions_errors(check_aggregate_regional_df): + # these tests should fail because our dataframe has continents and regions + # so checking without providing components leads to double counting and + # hence failure + obs = check_aggregate_regional_df.check_aggregate_regions( + 'Emissions|N2O', 'World' + ) + + assert len(obs.columns) == 2 + assert obs.index.get_values()[0] == ( + 'World', 'AIM', 'cscen', 'Emissions|N2O' + ) + + obs = check_aggregate_regional_df.check_aggregate_regions( + 'Emissions|N2O', 'REUROPE' + ) + + assert len(obs.columns) == 2 + assert obs.index.get_values()[0] == ( + 'REUROPE', 'AIM', 'cscen', 'Emissions|N2O' + ) + + +def test_df_check_aggregate_regions_components(check_aggregate_regional_df): + obs = check_aggregate_regional_df.check_aggregate_regions( + 'Emissions|N2O', 'World', components=['REUROPE', 'RASIA'] + ) + assert obs is None + + obs = check_aggregate_regional_df.check_aggregate_regions( + 'Emissions|N2O|Solvents', 'World', components=['REUROPE', 'RASIA'] + ) + assert obs is None + + obs = check_aggregate_regional_df.check_aggregate_regions( + 'Emissions|N2O', 'REUROPE', components=['Germany', 'UK'] + ) + assert obs is None + + obs = check_aggregate_regional_df.check_aggregate_regions( + 'Emissions|N2O|Transport', 'REUROPE', components=['Germany', 'UK'] + ) + assert obs is None def test_category_none(meta_df): diff --git a/tutorial/checking_databases.ipynb b/tutorial/checking_databases.ipynb new file mode 100644 index 000000000..631ad9523 --- /dev/null +++ b/tutorial/checking_databases.ipynb @@ -0,0 +1,4880 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Checking a database\n", + "\n", + "It has happened ocassionally that the reported data is not internally consistent. Here we show how to make the most of pyam's tools to check your database so you can double check the data in the IAM database. " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "application/javascript": [ + "IPython.OutputArea.prototype._should_scroll = function(lines) { return false; }" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import time\n", + "from pprint import pprint\n", + "\n", + "import pyam\n", + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "\n", + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We start with the tutorial data, it contains only a fraction of the AR5 data so is not internally consistent and is hence the perfect dataset to start with." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Reading `tutorial_AR5_data.csv`\n" + ] + } + ], + "source": [ + "df = pyam.IamDataFrame(data='tutorial_AR5_data.csv', encoding='utf-8')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "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", + "
modelscenarioregionvariableunityearvalue
0AIM-Enduse 12.1EMF27-450-ConvASIAEmissions|CO2Mt CO2/yr200510540.74
3AIM-Enduse 12.1EMF27-450-ConvLAMEmissions|CO2Mt CO2/yr20053285.00
6AIM-Enduse 12.1EMF27-450-ConvMAFEmissions|CO2Mt CO2/yr20054302.21
9AIM-Enduse 12.1EMF27-450-ConvOECD90Emissions|CO2Mt CO2/yr200512085.85
12AIM-Enduse 12.1EMF27-450-ConvREFEmissions|CO2Mt CO2/yr20053306.95
\n", + "
" + ], + "text/plain": [ + " model scenario region variable unit year \\\n", + "0 AIM-Enduse 12.1 EMF27-450-Conv ASIA Emissions|CO2 Mt CO2/yr 2005 \n", + "3 AIM-Enduse 12.1 EMF27-450-Conv LAM Emissions|CO2 Mt CO2/yr 2005 \n", + "6 AIM-Enduse 12.1 EMF27-450-Conv MAF Emissions|CO2 Mt CO2/yr 2005 \n", + "9 AIM-Enduse 12.1 EMF27-450-Conv OECD90 Emissions|CO2 Mt CO2/yr 2005 \n", + "12 AIM-Enduse 12.1 EMF27-450-Conv REF Emissions|CO2 Mt CO2/yr 2005 \n", + "\n", + " value \n", + "0 10540.74 \n", + "3 3285.00 \n", + "6 4302.21 \n", + "9 12085.85 \n", + "12 3306.95 " + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Summary\n", + "\n", + "With the `pyam.IamDataFrame.check_internal_consistency` method, we can check the internal consistency of a database. If this method returns `None`, the database is internally consistent (i.e. the total variables are the sum of the sectoral breakdowns and the regional breakdown \n", + "\n", + "In the rest of this tutorial, we give you a chance to better understand this method. We go through what it is actually doing and show you the kind of output you can expect." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Checking variables are the sum of their components\n", + "\n", + "We are going to use the `check_aggregate` method of `IamDataFrame` to check that the components of a variable sum to its total. This method takes `np.is_close` arguments as keyword arguments, we show our recommended settings here." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "np_isclose_args = {\n", + " \"equal_nan\": True,\n", + " \"rtol\": 1e-03,\n", + " \"atol\": 1e-05,\n", + "}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Using `check_aggregate` on the `IamDataFrame` allows us to quickly check if a single variable is equal to the sum of its sectoral components (e.g. is `Emissions|CO2` equal to `Emissions|CO2|Transport` plus `Emissions|CO2|Solvents` plus `Emissions|CO2|Energy` etc.). A returned `DataFrame` will show us where the aggregate is not equal to the sum of components." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Emissions|CO2 - 1368 of 1522 data points are not aggregates of components\n" + ] + }, + { + "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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + "
20052010202020302040205020602070208020902100
variablemodelscenarioregion
Emissions|CO2AIM-Enduse 12.1EMF27-450-ConvASIA10540.7413160.1811899.389545.817355.076119.50NaNNaNNaNNaNNaN
LAM3285.003294.543367.622856.652207.361537.72NaNNaNNaNNaNNaN
MAF4302.214487.544238.913956.193490.812082.24NaNNaNNaNNaNNaN
OECD9012085.8512744.3311646.378272.304457.911625.18NaNNaNNaNNaNNaN
REF3306.953604.423325.202991.241889.38960.75NaNNaNNaNNaNNaN
World34492.0538321.7835588.6628531.6820287.4613367.27NaNNaNNaNNaNNaN
EMF27-450-NoCCSASIA10540.7413160.1111893.809478.337367.075513.79NaNNaNNaNNaNNaN
LAM3285.003286.683362.612837.111889.89899.63NaNNaNNaNNaNNaN
MAF4302.214487.494239.033619.252787.471671.29NaNNaNNaNNaNNaN
OECD9012085.8512744.1611659.298708.815488.863355.22NaNNaNNaNNaNNaN
REF3306.953604.393322.953076.671977.781181.73NaNNaNNaNNaNNaN
World34492.0538313.5935588.8528629.6520458.1013660.19NaNNaNNaNNaNNaN
EMF27-550-LimBioASIA10540.7413160.1114124.1714218.0813187.6610019.56NaNNaNNaNNaNNaN
LAM3285.003286.683445.633496.622986.081790.49NaNNaNNaNNaNNaN
MAF4302.214487.494368.484519.644294.832733.76NaNNaNNaNNaNNaN
OECD9012085.8512744.1612607.1711752.019749.336501.31NaNNaNNaNNaNNaN
REF3306.953604.393826.803615.473258.313076.27NaNNaNNaNNaNNaN
World34492.0538313.5939531.6138815.5434676.3825295.31NaNNaNNaNNaNNaN
EMF27-Base-FullTechASIA10540.7413160.1114149.8916559.1419658.6823071.34NaNNaNNaNNaNNaN
LAM3285.003286.683449.843660.683850.443866.20NaNNaNNaNNaNNaN
MAF4302.214487.494371.984751.635389.486082.37NaNNaNNaNNaNNaN
OECD9012085.8512744.1612642.7013332.2913742.9314150.35NaNNaNNaNNaNNaN
REF3306.953604.393838.824220.974866.315615.39NaNNaNNaNNaNNaN
World34492.0538313.5939612.6043835.4949027.8054552.86NaNNaNNaNNaNNaN
EMF27-G8-EEREASIA10540.7413152.5613415.9410147.897637.614435.80NaNNaNNaNNaNNaN
LAM3285.003286.523106.392825.271784.31899.06NaNNaNNaNNaNNaN
MAF4302.214487.024091.193977.503659.803336.85NaNNaNNaNNaNNaN
OECD9012085.8512750.8110276.068833.955845.243473.56NaNNaNNaNNaNNaN
REF3306.953596.743453.293468.733376.253058.68NaNNaNNaNNaNNaN
World34492.0538304.4135425.9630395.4323536.7116487.83NaNNaNNaNNaNNaN
..........................................
REMIND 1.5EMF27-450-NoCCSOECD9015111.3915254.168082.872864.75369.53328.11299.06266.24255.25245.07226.35
World33837.4138224.9425524.607358.641691.051663.771616.521555.471553.001665.201883.11
EMF27-550-LimBioASIA10193.9813239.5514218.3711920.798135.325963.844486.533100.112246.061843.161570.02
LAM2926.603478.794413.411831.961357.42934.84712.03523.57418.39359.64107.38
MAF4035.324381.034504.493368.893582.703883.523663.913349.073064.562919.433153.50
OECD9015111.3915241.5613016.5210555.137238.064454.982745.801531.01766.12275.60-82.62
World33837.4137970.1137657.4128699.5020936.8315389.2011536.738368.716360.335299.364644.20
EMF27-Base-FullTechASIA10193.9813478.7820256.0124006.74NaNNaNNaNNaN34529.7928622.8323400.42
LAM2926.603508.405067.355464.434402.985424.515869.575988.956096.945152.734074.45
MAF4035.324381.095364.845862.75NaNNaNNaNNaNNaNNaNNaN
OECD9015111.3915234.63NaNNaN16610.2416943.5616515.9015922.4314587.2211864.629683.61
World33837.4138293.0848134.4253343.8259836.1070077.8977941.2182914.1584109.2375995.0968004.38
WITCH_EMF27EMF27-450-ConvASIA9895.4513210.1813914.1212004.4910538.518767.497410.946299.163794.592865.462437.77
LAM4660.574644.171851.461537.681421.58658.62-161.02-1398.20-1659.55-1631.41-1586.79
MAF2508.312673.952224.441932.651907.501703.001588.401493.361413.901303.021118.21
OECD9012644.4012597.559780.38NaN4755.203257.792240.721399.83795.67359.17224.28
REF3870.584035.172381.752055.811733.111347.511064.51815.36611.13444.37383.41
World33579.3237161.0330152.1524091.3220355.9115734.4012143.568609.504955.743340.622576.88
EMF27-550-LimBioASIA9895.9813341.7617280.0618745.4116414.5212419.7210012.019373.388937.929270.479214.63
LAM4660.844612.382729.372515.922286.121309.501048.52677.15470.62-66.27-210.35
MAF2508.812621.972773.632885.032775.242552.542579.222758.682928.883067.603139.20
OECD9012645.7812542.8711852.60NaNNaN5310.744461.184405.414236.364016.453860.45
REF3871.044062.723764.233380.512617.251957.661686.231658.311628.481550.831510.95
World33582.4537181.7038399.8837802.0132002.0223550.1719787.1618872.9318202.2517839.0717514.87
EMF27-Base-FullTechASIA9893.4613378.3420016.5526248.4730889.3834562.4637566.0540325.6442647.5244874.7246657.52
LAM4659.584623.984524.394644.994937.365250.675698.256117.406522.666945.517358.61
MAF2506.452642.283291.194063.345028.416038.177017.408032.948851.509680.4910373.40
OECD9012639.2812598.8413097.9513835.6214969.1215784.5916540.1817249.2117924.8618566.2319180.64
REF3868.874077.284636.235039.145412.355886.806279.446439.806722.197040.237284.21
World33567.6437320.7245566.3053831.5661236.6267522.7073101.3278164.9882668.7487107.1790854.38
\n", + "

140 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " 2005 2010 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA 10540.74 13160.18 \n", + " LAM 3285.00 3294.54 \n", + " MAF 4302.21 4487.54 \n", + " OECD90 12085.85 12744.33 \n", + " REF 3306.95 3604.42 \n", + " World 34492.05 38321.78 \n", + " EMF27-450-NoCCS ASIA 10540.74 13160.11 \n", + " LAM 3285.00 3286.68 \n", + " MAF 4302.21 4487.49 \n", + " OECD90 12085.85 12744.16 \n", + " REF 3306.95 3604.39 \n", + " World 34492.05 38313.59 \n", + " EMF27-550-LimBio ASIA 10540.74 13160.11 \n", + " LAM 3285.00 3286.68 \n", + " MAF 4302.21 4487.49 \n", + " OECD90 12085.85 12744.16 \n", + " REF 3306.95 3604.39 \n", + " World 34492.05 38313.59 \n", + " EMF27-Base-FullTech ASIA 10540.74 13160.11 \n", + " LAM 3285.00 3286.68 \n", + " MAF 4302.21 4487.49 \n", + " OECD90 12085.85 12744.16 \n", + " REF 3306.95 3604.39 \n", + " World 34492.05 38313.59 \n", + " EMF27-G8-EERE ASIA 10540.74 13152.56 \n", + " LAM 3285.00 3286.52 \n", + " MAF 4302.21 4487.02 \n", + " OECD90 12085.85 12750.81 \n", + " REF 3306.95 3596.74 \n", + " World 34492.05 38304.41 \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 15111.39 15254.16 \n", + " World 33837.41 38224.94 \n", + " EMF27-550-LimBio ASIA 10193.98 13239.55 \n", + " LAM 2926.60 3478.79 \n", + " MAF 4035.32 4381.03 \n", + " OECD90 15111.39 15241.56 \n", + " World 33837.41 37970.11 \n", + " EMF27-Base-FullTech ASIA 10193.98 13478.78 \n", + " LAM 2926.60 3508.40 \n", + " MAF 4035.32 4381.09 \n", + " OECD90 15111.39 15234.63 \n", + " World 33837.41 38293.08 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 9895.45 13210.18 \n", + " LAM 4660.57 4644.17 \n", + " MAF 2508.31 2673.95 \n", + " OECD90 12644.40 12597.55 \n", + " REF 3870.58 4035.17 \n", + " World 33579.32 37161.03 \n", + " EMF27-550-LimBio ASIA 9895.98 13341.76 \n", + " LAM 4660.84 4612.38 \n", + " MAF 2508.81 2621.97 \n", + " OECD90 12645.78 12542.87 \n", + " REF 3871.04 4062.72 \n", + " World 33582.45 37181.70 \n", + " EMF27-Base-FullTech ASIA 9893.46 13378.34 \n", + " LAM 4659.58 4623.98 \n", + " MAF 2506.45 2642.28 \n", + " OECD90 12639.28 12598.84 \n", + " REF 3868.87 4077.28 \n", + " World 33567.64 37320.72 \n", + "\n", + " 2020 2030 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA 11899.38 9545.81 \n", + " LAM 3367.62 2856.65 \n", + " MAF 4238.91 3956.19 \n", + " OECD90 11646.37 8272.30 \n", + " REF 3325.20 2991.24 \n", + " World 35588.66 28531.68 \n", + " EMF27-450-NoCCS ASIA 11893.80 9478.33 \n", + " LAM 3362.61 2837.11 \n", + " MAF 4239.03 3619.25 \n", + " OECD90 11659.29 8708.81 \n", + " REF 3322.95 3076.67 \n", + " World 35588.85 28629.65 \n", + " EMF27-550-LimBio ASIA 14124.17 14218.08 \n", + " LAM 3445.63 3496.62 \n", + " MAF 4368.48 4519.64 \n", + " OECD90 12607.17 11752.01 \n", + " REF 3826.80 3615.47 \n", + " World 39531.61 38815.54 \n", + " EMF27-Base-FullTech ASIA 14149.89 16559.14 \n", + " LAM 3449.84 3660.68 \n", + " MAF 4371.98 4751.63 \n", + " OECD90 12642.70 13332.29 \n", + " REF 3838.82 4220.97 \n", + " World 39612.60 43835.49 \n", + " EMF27-G8-EERE ASIA 13415.94 10147.89 \n", + " LAM 3106.39 2825.27 \n", + " MAF 4091.19 3977.50 \n", + " OECD90 10276.06 8833.95 \n", + " REF 3453.29 3468.73 \n", + " World 35425.96 30395.43 \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 8082.87 2864.75 \n", + " World 25524.60 7358.64 \n", + " EMF27-550-LimBio ASIA 14218.37 11920.79 \n", + " LAM 4413.41 1831.96 \n", + " MAF 4504.49 3368.89 \n", + " OECD90 13016.52 10555.13 \n", + " World 37657.41 28699.50 \n", + " EMF27-Base-FullTech ASIA 20256.01 24006.74 \n", + " LAM 5067.35 5464.43 \n", + " MAF 5364.84 5862.75 \n", + " OECD90 NaN NaN \n", + " World 48134.42 53343.82 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 13914.12 12004.49 \n", + " LAM 1851.46 1537.68 \n", + " MAF 2224.44 1932.65 \n", + " OECD90 9780.38 NaN \n", + " REF 2381.75 2055.81 \n", + " World 30152.15 24091.32 \n", + " EMF27-550-LimBio ASIA 17280.06 18745.41 \n", + " LAM 2729.37 2515.92 \n", + " MAF 2773.63 2885.03 \n", + " OECD90 11852.60 NaN \n", + " REF 3764.23 3380.51 \n", + " World 38399.88 37802.01 \n", + " EMF27-Base-FullTech ASIA 20016.55 26248.47 \n", + " LAM 4524.39 4644.99 \n", + " MAF 3291.19 4063.34 \n", + " OECD90 13097.95 13835.62 \n", + " REF 4636.23 5039.14 \n", + " World 45566.30 53831.56 \n", + "\n", + " 2040 2050 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA 7355.07 6119.50 \n", + " LAM 2207.36 1537.72 \n", + " MAF 3490.81 2082.24 \n", + " OECD90 4457.91 1625.18 \n", + " REF 1889.38 960.75 \n", + " World 20287.46 13367.27 \n", + " EMF27-450-NoCCS ASIA 7367.07 5513.79 \n", + " LAM 1889.89 899.63 \n", + " MAF 2787.47 1671.29 \n", + " OECD90 5488.86 3355.22 \n", + " REF 1977.78 1181.73 \n", + " World 20458.10 13660.19 \n", + " EMF27-550-LimBio ASIA 13187.66 10019.56 \n", + " LAM 2986.08 1790.49 \n", + " MAF 4294.83 2733.76 \n", + " OECD90 9749.33 6501.31 \n", + " REF 3258.31 3076.27 \n", + " World 34676.38 25295.31 \n", + " EMF27-Base-FullTech ASIA 19658.68 23071.34 \n", + " LAM 3850.44 3866.20 \n", + " MAF 5389.48 6082.37 \n", + " OECD90 13742.93 14150.35 \n", + " REF 4866.31 5615.39 \n", + " World 49027.80 54552.86 \n", + " EMF27-G8-EERE ASIA 7637.61 4435.80 \n", + " LAM 1784.31 899.06 \n", + " MAF 3659.80 3336.85 \n", + " OECD90 5845.24 3473.56 \n", + " REF 3376.25 3058.68 \n", + " World 23536.71 16487.83 \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 369.53 328.11 \n", + " World 1691.05 1663.77 \n", + " EMF27-550-LimBio ASIA 8135.32 5963.84 \n", + " LAM 1357.42 934.84 \n", + " MAF 3582.70 3883.52 \n", + " OECD90 7238.06 4454.98 \n", + " World 20936.83 15389.20 \n", + " EMF27-Base-FullTech ASIA NaN NaN \n", + " LAM 4402.98 5424.51 \n", + " MAF NaN NaN \n", + " OECD90 16610.24 16943.56 \n", + " World 59836.10 70077.89 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 10538.51 8767.49 \n", + " LAM 1421.58 658.62 \n", + " MAF 1907.50 1703.00 \n", + " OECD90 4755.20 3257.79 \n", + " REF 1733.11 1347.51 \n", + " World 20355.91 15734.40 \n", + " EMF27-550-LimBio ASIA 16414.52 12419.72 \n", + " LAM 2286.12 1309.50 \n", + " MAF 2775.24 2552.54 \n", + " OECD90 NaN 5310.74 \n", + " REF 2617.25 1957.66 \n", + " World 32002.02 23550.17 \n", + " EMF27-Base-FullTech ASIA 30889.38 34562.46 \n", + " LAM 4937.36 5250.67 \n", + " MAF 5028.41 6038.17 \n", + " OECD90 14969.12 15784.59 \n", + " REF 5412.35 5886.80 \n", + " World 61236.62 67522.70 \n", + "\n", + " 2060 2070 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-450-NoCCS ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-550-LimBio ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-Base-FullTech ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-G8-EERE ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 299.06 266.24 \n", + " World 1616.52 1555.47 \n", + " EMF27-550-LimBio ASIA 4486.53 3100.11 \n", + " LAM 712.03 523.57 \n", + " MAF 3663.91 3349.07 \n", + " OECD90 2745.80 1531.01 \n", + " World 11536.73 8368.71 \n", + " EMF27-Base-FullTech ASIA NaN NaN \n", + " LAM 5869.57 5988.95 \n", + " MAF NaN NaN \n", + " OECD90 16515.90 15922.43 \n", + " World 77941.21 82914.15 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 7410.94 6299.16 \n", + " LAM -161.02 -1398.20 \n", + " MAF 1588.40 1493.36 \n", + " OECD90 2240.72 1399.83 \n", + " REF 1064.51 815.36 \n", + " World 12143.56 8609.50 \n", + " EMF27-550-LimBio ASIA 10012.01 9373.38 \n", + " LAM 1048.52 677.15 \n", + " MAF 2579.22 2758.68 \n", + " OECD90 4461.18 4405.41 \n", + " REF 1686.23 1658.31 \n", + " World 19787.16 18872.93 \n", + " EMF27-Base-FullTech ASIA 37566.05 40325.64 \n", + " LAM 5698.25 6117.40 \n", + " MAF 7017.40 8032.94 \n", + " OECD90 16540.18 17249.21 \n", + " REF 6279.44 6439.80 \n", + " World 73101.32 78164.98 \n", + "\n", + " 2080 2090 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-450-NoCCS ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-550-LimBio ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-Base-FullTech ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-G8-EERE ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 255.25 245.07 \n", + " World 1553.00 1665.20 \n", + " EMF27-550-LimBio ASIA 2246.06 1843.16 \n", + " LAM 418.39 359.64 \n", + " MAF 3064.56 2919.43 \n", + " OECD90 766.12 275.60 \n", + " World 6360.33 5299.36 \n", + " EMF27-Base-FullTech ASIA 34529.79 28622.83 \n", + " LAM 6096.94 5152.73 \n", + " MAF NaN NaN \n", + " OECD90 14587.22 11864.62 \n", + " World 84109.23 75995.09 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 3794.59 2865.46 \n", + " LAM -1659.55 -1631.41 \n", + " MAF 1413.90 1303.02 \n", + " OECD90 795.67 359.17 \n", + " REF 611.13 444.37 \n", + " World 4955.74 3340.62 \n", + " EMF27-550-LimBio ASIA 8937.92 9270.47 \n", + " LAM 470.62 -66.27 \n", + " MAF 2928.88 3067.60 \n", + " OECD90 4236.36 4016.45 \n", + " REF 1628.48 1550.83 \n", + " World 18202.25 17839.07 \n", + " EMF27-Base-FullTech ASIA 42647.52 44874.72 \n", + " LAM 6522.66 6945.51 \n", + " MAF 8851.50 9680.49 \n", + " OECD90 17924.86 18566.23 \n", + " REF 6722.19 7040.23 \n", + " World 82668.74 87107.17 \n", + "\n", + " 2100 \n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-450-NoCCS ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-550-LimBio ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-Base-FullTech ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-G8-EERE ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + "... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 226.35 \n", + " World 1883.11 \n", + " EMF27-550-LimBio ASIA 1570.02 \n", + " LAM 107.38 \n", + " MAF 3153.50 \n", + " OECD90 -82.62 \n", + " World 4644.20 \n", + " EMF27-Base-FullTech ASIA 23400.42 \n", + " LAM 4074.45 \n", + " MAF NaN \n", + " OECD90 9683.61 \n", + " World 68004.38 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 2437.77 \n", + " LAM -1586.79 \n", + " MAF 1118.21 \n", + " OECD90 224.28 \n", + " REF 383.41 \n", + " World 2576.88 \n", + " EMF27-550-LimBio ASIA 9214.63 \n", + " LAM -210.35 \n", + " MAF 3139.20 \n", + " OECD90 3860.45 \n", + " REF 1510.95 \n", + " World 17514.87 \n", + " EMF27-Base-FullTech ASIA 46657.52 \n", + " LAM 7358.61 \n", + " MAF 10373.40 \n", + " OECD90 19180.64 \n", + " REF 7284.21 \n", + " World 90854.38 \n", + "\n", + "[140 rows x 11 columns]" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.check_aggregate(\n", + " \"Emissions|CO2\", \n", + " **np_isclose_args\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "As we are missing most of the sectoral data in this subset of AR5, the total variables are mostly not equal to their components. The data table above shows us which model-scenario-region combinations this is the case for. As a user, we would then have to examine which sectors we have for each of these model-scenario-region combinations in order to determine what is missing." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Checking multiple variables\n", + "\n", + "We can then wrap this altogether to check all or a subset of the variables in an `IamDataFrame`." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Emissions|CO2 - 1368 of 1522 data points are not aggregates of components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Price|Carbon - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Coal - cannot check aggregate because it has no components\n" + ] + } + ], + "source": [ + "for variable in df.filter(level=1).variables():\n", + " diff = df.check_aggregate(\n", + " variable, \n", + " **np_isclose_args\n", + " )\n", + " # you could then make whatever summary you wanted\n", + " # with diff" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The output tells us where there are issues as well as where it is not possible to actually check sums because no components have been reported. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Checking that regions sum to aggregate regions\n", + "\n", + "Similarly to checking that the sum of a variable's components give the declared total, we can check that summing regions gives the intended total.\n", + "\n", + "To do this, we use the `check_aggregate_regions` method of `IamDataFrame`. By default, this method checks that all the regions in the dataframe sum to World. \n", + "\n", + "Using `check_aggregate_regions` on the `IamDataFrame` allows us to quickly check if a regional total for a single variable is equal to the sum of its regional contributors. A returned `DataFrame` will show us where the aggregate is not equal to the sum of components." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Emissions|CO2 - 503 of 503 data points are not aggregates of regional components\n" + ] + }, + { + "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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + "
20052010202020302040205020602070208020902100
regionmodelscenariovariable
WorldAIM-Enduse 12.1EMF27-450-ConvEmissions|CO234492.0538321.7835588.6628531.6820287.4613367.27NaNNaNNaNNaNNaN
EMF27-450-NoCCSEmissions|CO234492.0538313.5935588.8528629.6520458.1013660.19NaNNaNNaNNaNNaN
EMF27-550-LimBioEmissions|CO234492.0538313.5939531.6138815.5434676.3825295.31NaNNaNNaNNaNNaN
EMF27-Base-FullTechEmissions|CO234492.0538313.5939612.6043835.4949027.8054552.86NaNNaNNaNNaNNaN
EMF27-G8-EEREEmissions|CO234492.0538304.4135425.9630395.4323536.7116487.83NaNNaNNaNNaNNaN
GCAM 3.0AMPERE3-450Emissions|CO231473.4031678.1338660.7745110.9744768.1434990.0919397.621208.73-17387.30-37099.22-57844.17
AMPERE3-450P-CEEmissions|CO231473.4031678.1438603.9046071.5443844.7434636.4119108.641129.57-17399.41-37076.52-57817.45
AMPERE3-450P-EUEmissions|CO231473.4031678.1439487.8747419.6145118.7935081.5419182.911166.07-17384.21-37079.51-57832.34
AMPERE3-550Emissions|CO231473.4031678.1339660.5247541.0150744.1846992.9134172.7817064.62-2639.86-21628.98-42437.11
AMPERE3-Base-EUbackEmissions|CO231473.4031678.1341826.4152214.9563459.2975453.5081730.8386384.1789308.2992285.8196090.28
AMPERE3-CF450P-EUEmissions|CO231473.4031678.1341826.4152214.9549660.4436881.6319617.99995.01-17475.49-37146.77-57853.52
AMPERE3-RefPolEmissions|CO231473.4031678.1439787.4248131.2852770.9254537.5054976.5154792.5653594.2251287.9849551.47
EMF27-450-ConvEmissions|CO231473.6234700.9712161.3211121.986976.385488.543289.901023.41-1751.60-3619.36-6129.59
EMF27-450-NoCCSEmissions|CO231473.6234685.2911238.0613109.2512112.0710342.936317.672467.32-1664.16-4832.87-8236.19
EMF27-550-LimBioEmissions|CO231473.6234685.2919169.8823277.0121186.0415170.2510413.058098.036605.726446.215829.69
EMF27-Base-FullTechEmissions|CO231473.6234685.2943318.4851233.3657308.3663987.6468381.5972124.9875247.8477206.6177589.17
IMAGE 2.4AMPERE3-450Emissions|CO234111.2935344.2736059.3732234.6619608.8815150.286668.57-677.70-3156.89-6273.64-7112.29
AMPERE3-450P-CEEmissions|CO234111.1435343.9338844.8540453.3531255.3821628.4213883.065169.80-2754.38-6409.44-8174.45
AMPERE3-450P-EUEmissions|CO234111.1435343.9340612.2246400.3837347.9725392.0817060.167214.90-2789.63-6821.32-7928.68
AMPERE3-550Emissions|CO234111.2935318.5037365.8637226.8232352.8930493.3722154.0712673.927180.83909.23-2504.16
AMPERE3-RefPolEmissions|CO234124.3235746.9840855.5446771.3448448.4451487.3048906.5143724.9640676.9436602.4232884.37
EMF27-550-LimBioEmissions|CO234259.2735594.3437292.9336467.6628910.7224195.1919530.5413307.5810956.338196.685984.36
EMF27-Base-FullTechEmissions|CO234391.3935246.3140384.5244757.2848671.2255920.6661887.1765748.8372569.2078338.4882774.78
MERGE_EMF27EMF27-450-ConvEmissions|CO228501.2233303.1630506.6022718.8913174.434174.12-628.46-2784.94-4736.63-5526.81-6008.83
EMF27-550-LimBioEmissions|CO228501.2233303.1636019.8934031.5426705.7017872.9310598.827675.844542.866515.475797.86
EMF27-Base-FullTechEmissions|CO228501.2233303.1643021.9054681.2464214.8273116.8381405.9990072.9498476.95108882.84120493.31
EMF27-G8-EEREEmissions|CO228501.2233303.1631636.3627381.8419962.3414278.6810533.139599.279211.558061.248393.79
MESSAGE V.4AMPERE3-450Emissions|CO234474.5936035.6936941.4635238.7126747.9615173.324329.48-1304.69-5447.10-8728.73-11209.52
AMPERE3-450P-EUEmissions|CO234474.4936036.0240821.6546438.2338929.5427622.3112469.822786.95-2585.87-6268.49-8535.53
AMPERE3-550Emissions|CO234474.5136035.9639222.4142988.0740487.8034363.5620847.2610424.522479.89-2730.61-6474.82
AMPERE3-RefPolEmissions|CO234474.4636035.9840886.2347008.0451379.0953497.3950990.5746103.6441339.8334733.8927562.64
EMF27-550-LimBioEmissions|CO234491.0236087.0934675.7630326.5422000.7111312.709846.468570.057230.635834.564500.82
EMF27-Base-FullTechEmissions|CO234491.0236087.0942809.7248375.9955957.7764431.6871728.3275668.2877297.8277283.3575904.56
REMIND 1.5AMPERE3-450Emissions|CO233841.4937365.9135255.1831679.6925439.8416908.366524.72-910.93-5015.05-8196.08-10192.88
AMPERE3-450P-CEEmissions|CO233841.4937357.5839260.0443283.2534864.1720741.407005.88-622.25-4786.58-8275.44-10291.58
AMPERE3-450P-EUEmissions|CO233841.4937356.3741565.7047902.1237928.1621615.596958.30-563.45-4783.46-8277.63-10290.40
AMPERE3-550Emissions|CO233841.4937366.1238324.5139015.2736963.6631733.5122831.6613927.895749.59-327.77-3755.24
AMPERE3-550P-EUEmissions|CO233841.4937360.5841568.6347908.6746792.9637445.2524413.6214572.436804.2086.14-3693.90
AMPERE3-Base-EUbackEmissions|CO233841.4937371.8744020.6750296.8758575.0871744.5982786.7987993.1685663.0375402.5366716.49
AMPERE3-CF450P-EUEmissions|CO233841.4937365.9844028.8050295.9039726.7022501.376855.42-602.89-4769.69-8268.81-10300.93
AMPERE3-RefPolEmissions|CO233841.4937372.5341615.4448455.2255203.0561590.5764595.0464737.5962246.2056447.9951261.41
EMF27-450-ConvEmissions|CO233837.4137977.3129314.4913503.926281.743040.79787.74-526.27-1744.61-1641.29-1413.97
EMF27-450-NoCCSEmissions|CO233837.4138224.9425524.607358.641691.051663.771616.521555.471553.001665.201883.11
EMF27-550-LimBioEmissions|CO233837.4137970.1137657.4128699.5020936.8315389.2011536.738368.716360.335299.364644.20
EMF27-Base-FullTechEmissions|CO233837.4138293.0848134.4253343.8259836.1070077.8977941.2182914.1584109.2375995.0968004.38
WITCH_EMF27EMF27-450-ConvEmissions|CO233579.3237161.0330152.1524091.3220355.9115734.4012143.568609.504955.743340.622576.88
EMF27-550-LimBioEmissions|CO233582.4537181.7038399.8837802.0132002.0223550.1719787.1618872.9318202.2517839.0717514.87
EMF27-Base-FullTechEmissions|CO233567.6437320.7245566.3053831.5661236.6267522.7073101.3278164.9882668.7487107.1790854.38
\n", + "
" + ], + "text/plain": [ + " 2005 2010 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Emissions|CO2 34492.05 38321.78 \n", + " EMF27-450-NoCCS Emissions|CO2 34492.05 38313.59 \n", + " EMF27-550-LimBio Emissions|CO2 34492.05 38313.59 \n", + " EMF27-Base-FullTech Emissions|CO2 34492.05 38313.59 \n", + " EMF27-G8-EERE Emissions|CO2 34492.05 38304.41 \n", + " GCAM 3.0 AMPERE3-450 Emissions|CO2 31473.40 31678.13 \n", + " AMPERE3-450P-CE Emissions|CO2 31473.40 31678.14 \n", + " AMPERE3-450P-EU Emissions|CO2 31473.40 31678.14 \n", + " AMPERE3-550 Emissions|CO2 31473.40 31678.13 \n", + " AMPERE3-Base-EUback Emissions|CO2 31473.40 31678.13 \n", + " AMPERE3-CF450P-EU Emissions|CO2 31473.40 31678.13 \n", + " AMPERE3-RefPol Emissions|CO2 31473.40 31678.14 \n", + " EMF27-450-Conv Emissions|CO2 31473.62 34700.97 \n", + " EMF27-450-NoCCS Emissions|CO2 31473.62 34685.29 \n", + " EMF27-550-LimBio Emissions|CO2 31473.62 34685.29 \n", + " EMF27-Base-FullTech Emissions|CO2 31473.62 34685.29 \n", + " IMAGE 2.4 AMPERE3-450 Emissions|CO2 34111.29 35344.27 \n", + " AMPERE3-450P-CE Emissions|CO2 34111.14 35343.93 \n", + " AMPERE3-450P-EU Emissions|CO2 34111.14 35343.93 \n", + " AMPERE3-550 Emissions|CO2 34111.29 35318.50 \n", + " AMPERE3-RefPol Emissions|CO2 34124.32 35746.98 \n", + " EMF27-550-LimBio Emissions|CO2 34259.27 35594.34 \n", + " EMF27-Base-FullTech Emissions|CO2 34391.39 35246.31 \n", + " MERGE_EMF27 EMF27-450-Conv Emissions|CO2 28501.22 33303.16 \n", + " EMF27-550-LimBio Emissions|CO2 28501.22 33303.16 \n", + " EMF27-Base-FullTech Emissions|CO2 28501.22 33303.16 \n", + " EMF27-G8-EERE Emissions|CO2 28501.22 33303.16 \n", + " MESSAGE V.4 AMPERE3-450 Emissions|CO2 34474.59 36035.69 \n", + " AMPERE3-450P-EU Emissions|CO2 34474.49 36036.02 \n", + " AMPERE3-550 Emissions|CO2 34474.51 36035.96 \n", + " AMPERE3-RefPol Emissions|CO2 34474.46 36035.98 \n", + " EMF27-550-LimBio Emissions|CO2 34491.02 36087.09 \n", + " EMF27-Base-FullTech Emissions|CO2 34491.02 36087.09 \n", + " REMIND 1.5 AMPERE3-450 Emissions|CO2 33841.49 37365.91 \n", + " AMPERE3-450P-CE Emissions|CO2 33841.49 37357.58 \n", + " AMPERE3-450P-EU Emissions|CO2 33841.49 37356.37 \n", + " AMPERE3-550 Emissions|CO2 33841.49 37366.12 \n", + " AMPERE3-550P-EU Emissions|CO2 33841.49 37360.58 \n", + " AMPERE3-Base-EUback Emissions|CO2 33841.49 37371.87 \n", + " AMPERE3-CF450P-EU Emissions|CO2 33841.49 37365.98 \n", + " AMPERE3-RefPol Emissions|CO2 33841.49 37372.53 \n", + " EMF27-450-Conv Emissions|CO2 33837.41 37977.31 \n", + " EMF27-450-NoCCS Emissions|CO2 33837.41 38224.94 \n", + " EMF27-550-LimBio Emissions|CO2 33837.41 37970.11 \n", + " EMF27-Base-FullTech Emissions|CO2 33837.41 38293.08 \n", + " WITCH_EMF27 EMF27-450-Conv Emissions|CO2 33579.32 37161.03 \n", + " EMF27-550-LimBio Emissions|CO2 33582.45 37181.70 \n", + " EMF27-Base-FullTech Emissions|CO2 33567.64 37320.72 \n", + "\n", + " 2020 2030 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Emissions|CO2 35588.66 28531.68 \n", + " EMF27-450-NoCCS Emissions|CO2 35588.85 28629.65 \n", + " EMF27-550-LimBio Emissions|CO2 39531.61 38815.54 \n", + " EMF27-Base-FullTech Emissions|CO2 39612.60 43835.49 \n", + " EMF27-G8-EERE Emissions|CO2 35425.96 30395.43 \n", + " GCAM 3.0 AMPERE3-450 Emissions|CO2 38660.77 45110.97 \n", + " AMPERE3-450P-CE Emissions|CO2 38603.90 46071.54 \n", + " AMPERE3-450P-EU Emissions|CO2 39487.87 47419.61 \n", + " AMPERE3-550 Emissions|CO2 39660.52 47541.01 \n", + " AMPERE3-Base-EUback Emissions|CO2 41826.41 52214.95 \n", + " AMPERE3-CF450P-EU Emissions|CO2 41826.41 52214.95 \n", + " AMPERE3-RefPol Emissions|CO2 39787.42 48131.28 \n", + " EMF27-450-Conv Emissions|CO2 12161.32 11121.98 \n", + " EMF27-450-NoCCS Emissions|CO2 11238.06 13109.25 \n", + " EMF27-550-LimBio Emissions|CO2 19169.88 23277.01 \n", + " EMF27-Base-FullTech Emissions|CO2 43318.48 51233.36 \n", + " IMAGE 2.4 AMPERE3-450 Emissions|CO2 36059.37 32234.66 \n", + " AMPERE3-450P-CE Emissions|CO2 38844.85 40453.35 \n", + " AMPERE3-450P-EU Emissions|CO2 40612.22 46400.38 \n", + " AMPERE3-550 Emissions|CO2 37365.86 37226.82 \n", + " AMPERE3-RefPol Emissions|CO2 40855.54 46771.34 \n", + " EMF27-550-LimBio Emissions|CO2 37292.93 36467.66 \n", + " EMF27-Base-FullTech Emissions|CO2 40384.52 44757.28 \n", + " MERGE_EMF27 EMF27-450-Conv Emissions|CO2 30506.60 22718.89 \n", + " EMF27-550-LimBio Emissions|CO2 36019.89 34031.54 \n", + " EMF27-Base-FullTech Emissions|CO2 43021.90 54681.24 \n", + " EMF27-G8-EERE Emissions|CO2 31636.36 27381.84 \n", + " MESSAGE V.4 AMPERE3-450 Emissions|CO2 36941.46 35238.71 \n", + " AMPERE3-450P-EU Emissions|CO2 40821.65 46438.23 \n", + " AMPERE3-550 Emissions|CO2 39222.41 42988.07 \n", + " AMPERE3-RefPol Emissions|CO2 40886.23 47008.04 \n", + " EMF27-550-LimBio Emissions|CO2 34675.76 30326.54 \n", + " EMF27-Base-FullTech Emissions|CO2 42809.72 48375.99 \n", + " REMIND 1.5 AMPERE3-450 Emissions|CO2 35255.18 31679.69 \n", + " AMPERE3-450P-CE Emissions|CO2 39260.04 43283.25 \n", + " AMPERE3-450P-EU Emissions|CO2 41565.70 47902.12 \n", + " AMPERE3-550 Emissions|CO2 38324.51 39015.27 \n", + " AMPERE3-550P-EU Emissions|CO2 41568.63 47908.67 \n", + " AMPERE3-Base-EUback Emissions|CO2 44020.67 50296.87 \n", + " AMPERE3-CF450P-EU Emissions|CO2 44028.80 50295.90 \n", + " AMPERE3-RefPol Emissions|CO2 41615.44 48455.22 \n", + " EMF27-450-Conv Emissions|CO2 29314.49 13503.92 \n", + " EMF27-450-NoCCS Emissions|CO2 25524.60 7358.64 \n", + " EMF27-550-LimBio Emissions|CO2 37657.41 28699.50 \n", + " EMF27-Base-FullTech Emissions|CO2 48134.42 53343.82 \n", + " WITCH_EMF27 EMF27-450-Conv Emissions|CO2 30152.15 24091.32 \n", + " EMF27-550-LimBio Emissions|CO2 38399.88 37802.01 \n", + " EMF27-Base-FullTech Emissions|CO2 45566.30 53831.56 \n", + "\n", + " 2040 2050 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Emissions|CO2 20287.46 13367.27 \n", + " EMF27-450-NoCCS Emissions|CO2 20458.10 13660.19 \n", + " EMF27-550-LimBio Emissions|CO2 34676.38 25295.31 \n", + " EMF27-Base-FullTech Emissions|CO2 49027.80 54552.86 \n", + " EMF27-G8-EERE Emissions|CO2 23536.71 16487.83 \n", + " GCAM 3.0 AMPERE3-450 Emissions|CO2 44768.14 34990.09 \n", + " AMPERE3-450P-CE Emissions|CO2 43844.74 34636.41 \n", + " AMPERE3-450P-EU Emissions|CO2 45118.79 35081.54 \n", + " AMPERE3-550 Emissions|CO2 50744.18 46992.91 \n", + " AMPERE3-Base-EUback Emissions|CO2 63459.29 75453.50 \n", + " AMPERE3-CF450P-EU Emissions|CO2 49660.44 36881.63 \n", + " AMPERE3-RefPol Emissions|CO2 52770.92 54537.50 \n", + " EMF27-450-Conv Emissions|CO2 6976.38 5488.54 \n", + " EMF27-450-NoCCS Emissions|CO2 12112.07 10342.93 \n", + " EMF27-550-LimBio Emissions|CO2 21186.04 15170.25 \n", + " EMF27-Base-FullTech Emissions|CO2 57308.36 63987.64 \n", + " IMAGE 2.4 AMPERE3-450 Emissions|CO2 19608.88 15150.28 \n", + " AMPERE3-450P-CE Emissions|CO2 31255.38 21628.42 \n", + " AMPERE3-450P-EU Emissions|CO2 37347.97 25392.08 \n", + " AMPERE3-550 Emissions|CO2 32352.89 30493.37 \n", + " AMPERE3-RefPol Emissions|CO2 48448.44 51487.30 \n", + " EMF27-550-LimBio Emissions|CO2 28910.72 24195.19 \n", + " EMF27-Base-FullTech Emissions|CO2 48671.22 55920.66 \n", + " MERGE_EMF27 EMF27-450-Conv Emissions|CO2 13174.43 4174.12 \n", + " EMF27-550-LimBio Emissions|CO2 26705.70 17872.93 \n", + " EMF27-Base-FullTech Emissions|CO2 64214.82 73116.83 \n", + " EMF27-G8-EERE Emissions|CO2 19962.34 14278.68 \n", + " MESSAGE V.4 AMPERE3-450 Emissions|CO2 26747.96 15173.32 \n", + " AMPERE3-450P-EU Emissions|CO2 38929.54 27622.31 \n", + " AMPERE3-550 Emissions|CO2 40487.80 34363.56 \n", + " AMPERE3-RefPol Emissions|CO2 51379.09 53497.39 \n", + " EMF27-550-LimBio Emissions|CO2 22000.71 11312.70 \n", + " EMF27-Base-FullTech Emissions|CO2 55957.77 64431.68 \n", + " REMIND 1.5 AMPERE3-450 Emissions|CO2 25439.84 16908.36 \n", + " AMPERE3-450P-CE Emissions|CO2 34864.17 20741.40 \n", + " AMPERE3-450P-EU Emissions|CO2 37928.16 21615.59 \n", + " AMPERE3-550 Emissions|CO2 36963.66 31733.51 \n", + " AMPERE3-550P-EU Emissions|CO2 46792.96 37445.25 \n", + " AMPERE3-Base-EUback Emissions|CO2 58575.08 71744.59 \n", + " AMPERE3-CF450P-EU Emissions|CO2 39726.70 22501.37 \n", + " AMPERE3-RefPol Emissions|CO2 55203.05 61590.57 \n", + " EMF27-450-Conv Emissions|CO2 6281.74 3040.79 \n", + " EMF27-450-NoCCS Emissions|CO2 1691.05 1663.77 \n", + " EMF27-550-LimBio Emissions|CO2 20936.83 15389.20 \n", + " EMF27-Base-FullTech Emissions|CO2 59836.10 70077.89 \n", + " WITCH_EMF27 EMF27-450-Conv Emissions|CO2 20355.91 15734.40 \n", + " EMF27-550-LimBio Emissions|CO2 32002.02 23550.17 \n", + " EMF27-Base-FullTech Emissions|CO2 61236.62 67522.70 \n", + "\n", + " 2060 2070 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Emissions|CO2 NaN NaN \n", + " EMF27-450-NoCCS Emissions|CO2 NaN NaN \n", + " EMF27-550-LimBio Emissions|CO2 NaN NaN \n", + " EMF27-Base-FullTech Emissions|CO2 NaN NaN \n", + " EMF27-G8-EERE Emissions|CO2 NaN NaN \n", + " GCAM 3.0 AMPERE3-450 Emissions|CO2 19397.62 1208.73 \n", + " AMPERE3-450P-CE Emissions|CO2 19108.64 1129.57 \n", + " AMPERE3-450P-EU Emissions|CO2 19182.91 1166.07 \n", + " AMPERE3-550 Emissions|CO2 34172.78 17064.62 \n", + " AMPERE3-Base-EUback Emissions|CO2 81730.83 86384.17 \n", + " AMPERE3-CF450P-EU Emissions|CO2 19617.99 995.01 \n", + " AMPERE3-RefPol Emissions|CO2 54976.51 54792.56 \n", + " EMF27-450-Conv Emissions|CO2 3289.90 1023.41 \n", + " EMF27-450-NoCCS Emissions|CO2 6317.67 2467.32 \n", + " EMF27-550-LimBio Emissions|CO2 10413.05 8098.03 \n", + " EMF27-Base-FullTech Emissions|CO2 68381.59 72124.98 \n", + " IMAGE 2.4 AMPERE3-450 Emissions|CO2 6668.57 -677.70 \n", + " AMPERE3-450P-CE Emissions|CO2 13883.06 5169.80 \n", + " AMPERE3-450P-EU Emissions|CO2 17060.16 7214.90 \n", + " AMPERE3-550 Emissions|CO2 22154.07 12673.92 \n", + " AMPERE3-RefPol Emissions|CO2 48906.51 43724.96 \n", + " EMF27-550-LimBio Emissions|CO2 19530.54 13307.58 \n", + " EMF27-Base-FullTech Emissions|CO2 61887.17 65748.83 \n", + " MERGE_EMF27 EMF27-450-Conv Emissions|CO2 -628.46 -2784.94 \n", + " EMF27-550-LimBio Emissions|CO2 10598.82 7675.84 \n", + " EMF27-Base-FullTech Emissions|CO2 81405.99 90072.94 \n", + " EMF27-G8-EERE Emissions|CO2 10533.13 9599.27 \n", + " MESSAGE V.4 AMPERE3-450 Emissions|CO2 4329.48 -1304.69 \n", + " AMPERE3-450P-EU Emissions|CO2 12469.82 2786.95 \n", + " AMPERE3-550 Emissions|CO2 20847.26 10424.52 \n", + " AMPERE3-RefPol Emissions|CO2 50990.57 46103.64 \n", + " EMF27-550-LimBio Emissions|CO2 9846.46 8570.05 \n", + " EMF27-Base-FullTech Emissions|CO2 71728.32 75668.28 \n", + " REMIND 1.5 AMPERE3-450 Emissions|CO2 6524.72 -910.93 \n", + " AMPERE3-450P-CE Emissions|CO2 7005.88 -622.25 \n", + " AMPERE3-450P-EU Emissions|CO2 6958.30 -563.45 \n", + " AMPERE3-550 Emissions|CO2 22831.66 13927.89 \n", + " AMPERE3-550P-EU Emissions|CO2 24413.62 14572.43 \n", + " AMPERE3-Base-EUback Emissions|CO2 82786.79 87993.16 \n", + " AMPERE3-CF450P-EU Emissions|CO2 6855.42 -602.89 \n", + " AMPERE3-RefPol Emissions|CO2 64595.04 64737.59 \n", + " EMF27-450-Conv Emissions|CO2 787.74 -526.27 \n", + " EMF27-450-NoCCS Emissions|CO2 1616.52 1555.47 \n", + " EMF27-550-LimBio Emissions|CO2 11536.73 8368.71 \n", + " EMF27-Base-FullTech Emissions|CO2 77941.21 82914.15 \n", + " WITCH_EMF27 EMF27-450-Conv Emissions|CO2 12143.56 8609.50 \n", + " EMF27-550-LimBio Emissions|CO2 19787.16 18872.93 \n", + " EMF27-Base-FullTech Emissions|CO2 73101.32 78164.98 \n", + "\n", + " 2080 2090 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Emissions|CO2 NaN NaN \n", + " EMF27-450-NoCCS Emissions|CO2 NaN NaN \n", + " EMF27-550-LimBio Emissions|CO2 NaN NaN \n", + " EMF27-Base-FullTech Emissions|CO2 NaN NaN \n", + " EMF27-G8-EERE Emissions|CO2 NaN NaN \n", + " GCAM 3.0 AMPERE3-450 Emissions|CO2 -17387.30 -37099.22 \n", + " AMPERE3-450P-CE Emissions|CO2 -17399.41 -37076.52 \n", + " AMPERE3-450P-EU Emissions|CO2 -17384.21 -37079.51 \n", + " AMPERE3-550 Emissions|CO2 -2639.86 -21628.98 \n", + " AMPERE3-Base-EUback Emissions|CO2 89308.29 92285.81 \n", + " AMPERE3-CF450P-EU Emissions|CO2 -17475.49 -37146.77 \n", + " AMPERE3-RefPol Emissions|CO2 53594.22 51287.98 \n", + " EMF27-450-Conv Emissions|CO2 -1751.60 -3619.36 \n", + " EMF27-450-NoCCS Emissions|CO2 -1664.16 -4832.87 \n", + " EMF27-550-LimBio Emissions|CO2 6605.72 6446.21 \n", + " EMF27-Base-FullTech Emissions|CO2 75247.84 77206.61 \n", + " IMAGE 2.4 AMPERE3-450 Emissions|CO2 -3156.89 -6273.64 \n", + " AMPERE3-450P-CE Emissions|CO2 -2754.38 -6409.44 \n", + " AMPERE3-450P-EU Emissions|CO2 -2789.63 -6821.32 \n", + " AMPERE3-550 Emissions|CO2 7180.83 909.23 \n", + " AMPERE3-RefPol Emissions|CO2 40676.94 36602.42 \n", + " EMF27-550-LimBio Emissions|CO2 10956.33 8196.68 \n", + " EMF27-Base-FullTech Emissions|CO2 72569.20 78338.48 \n", + " MERGE_EMF27 EMF27-450-Conv Emissions|CO2 -4736.63 -5526.81 \n", + " EMF27-550-LimBio Emissions|CO2 4542.86 6515.47 \n", + " EMF27-Base-FullTech Emissions|CO2 98476.95 108882.84 \n", + " EMF27-G8-EERE Emissions|CO2 9211.55 8061.24 \n", + " MESSAGE V.4 AMPERE3-450 Emissions|CO2 -5447.10 -8728.73 \n", + " AMPERE3-450P-EU Emissions|CO2 -2585.87 -6268.49 \n", + " AMPERE3-550 Emissions|CO2 2479.89 -2730.61 \n", + " AMPERE3-RefPol Emissions|CO2 41339.83 34733.89 \n", + " EMF27-550-LimBio Emissions|CO2 7230.63 5834.56 \n", + " EMF27-Base-FullTech Emissions|CO2 77297.82 77283.35 \n", + " REMIND 1.5 AMPERE3-450 Emissions|CO2 -5015.05 -8196.08 \n", + " AMPERE3-450P-CE Emissions|CO2 -4786.58 -8275.44 \n", + " AMPERE3-450P-EU Emissions|CO2 -4783.46 -8277.63 \n", + " AMPERE3-550 Emissions|CO2 5749.59 -327.77 \n", + " AMPERE3-550P-EU Emissions|CO2 6804.20 86.14 \n", + " AMPERE3-Base-EUback Emissions|CO2 85663.03 75402.53 \n", + " AMPERE3-CF450P-EU Emissions|CO2 -4769.69 -8268.81 \n", + " AMPERE3-RefPol Emissions|CO2 62246.20 56447.99 \n", + " EMF27-450-Conv Emissions|CO2 -1744.61 -1641.29 \n", + " EMF27-450-NoCCS Emissions|CO2 1553.00 1665.20 \n", + " EMF27-550-LimBio Emissions|CO2 6360.33 5299.36 \n", + " EMF27-Base-FullTech Emissions|CO2 84109.23 75995.09 \n", + " WITCH_EMF27 EMF27-450-Conv Emissions|CO2 4955.74 3340.62 \n", + " EMF27-550-LimBio Emissions|CO2 18202.25 17839.07 \n", + " EMF27-Base-FullTech Emissions|CO2 82668.74 87107.17 \n", + "\n", + " 2100 \n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Emissions|CO2 NaN \n", + " EMF27-450-NoCCS Emissions|CO2 NaN \n", + " EMF27-550-LimBio Emissions|CO2 NaN \n", + " EMF27-Base-FullTech Emissions|CO2 NaN \n", + " EMF27-G8-EERE Emissions|CO2 NaN \n", + " GCAM 3.0 AMPERE3-450 Emissions|CO2 -57844.17 \n", + " AMPERE3-450P-CE Emissions|CO2 -57817.45 \n", + " AMPERE3-450P-EU Emissions|CO2 -57832.34 \n", + " AMPERE3-550 Emissions|CO2 -42437.11 \n", + " AMPERE3-Base-EUback Emissions|CO2 96090.28 \n", + " AMPERE3-CF450P-EU Emissions|CO2 -57853.52 \n", + " AMPERE3-RefPol Emissions|CO2 49551.47 \n", + " EMF27-450-Conv Emissions|CO2 -6129.59 \n", + " EMF27-450-NoCCS Emissions|CO2 -8236.19 \n", + " EMF27-550-LimBio Emissions|CO2 5829.69 \n", + " EMF27-Base-FullTech Emissions|CO2 77589.17 \n", + " IMAGE 2.4 AMPERE3-450 Emissions|CO2 -7112.29 \n", + " AMPERE3-450P-CE Emissions|CO2 -8174.45 \n", + " AMPERE3-450P-EU Emissions|CO2 -7928.68 \n", + " AMPERE3-550 Emissions|CO2 -2504.16 \n", + " AMPERE3-RefPol Emissions|CO2 32884.37 \n", + " EMF27-550-LimBio Emissions|CO2 5984.36 \n", + " EMF27-Base-FullTech Emissions|CO2 82774.78 \n", + " MERGE_EMF27 EMF27-450-Conv Emissions|CO2 -6008.83 \n", + " EMF27-550-LimBio Emissions|CO2 5797.86 \n", + " EMF27-Base-FullTech Emissions|CO2 120493.31 \n", + " EMF27-G8-EERE Emissions|CO2 8393.79 \n", + " MESSAGE V.4 AMPERE3-450 Emissions|CO2 -11209.52 \n", + " AMPERE3-450P-EU Emissions|CO2 -8535.53 \n", + " AMPERE3-550 Emissions|CO2 -6474.82 \n", + " AMPERE3-RefPol Emissions|CO2 27562.64 \n", + " EMF27-550-LimBio Emissions|CO2 4500.82 \n", + " EMF27-Base-FullTech Emissions|CO2 75904.56 \n", + " REMIND 1.5 AMPERE3-450 Emissions|CO2 -10192.88 \n", + " AMPERE3-450P-CE Emissions|CO2 -10291.58 \n", + " AMPERE3-450P-EU Emissions|CO2 -10290.40 \n", + " AMPERE3-550 Emissions|CO2 -3755.24 \n", + " AMPERE3-550P-EU Emissions|CO2 -3693.90 \n", + " AMPERE3-Base-EUback Emissions|CO2 66716.49 \n", + " AMPERE3-CF450P-EU Emissions|CO2 -10300.93 \n", + " AMPERE3-RefPol Emissions|CO2 51261.41 \n", + " EMF27-450-Conv Emissions|CO2 -1413.97 \n", + " EMF27-450-NoCCS Emissions|CO2 1883.11 \n", + " EMF27-550-LimBio Emissions|CO2 4644.20 \n", + " EMF27-Base-FullTech Emissions|CO2 68004.38 \n", + " WITCH_EMF27 EMF27-450-Conv Emissions|CO2 2576.88 \n", + " EMF27-550-LimBio Emissions|CO2 17514.87 \n", + " EMF27-Base-FullTech Emissions|CO2 90854.38 " + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.check_aggregate_regions(\n", + " \"Emissions|CO2\",\n", + " **np_isclose_args\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Again, as the AR5 snapshot is incomplete, all World sums are not equal to the regions provided.\n", + "\n", + "Once again, we can repeat this analysis over all the variables of interest in an `IamDataFrame`." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Emissions|CO2 - 503 of 503 data points are not aggregates of regional components\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry - 239 of 239 data points are not aggregates of regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry|Energy Supply - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry|Energy Supply|Electricity - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Price|Carbon - cannot check regional aggregate because it has no regional components\n", + "INFO:root:Primary Energy - 502 of 503 data points are not aggregates of regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Coal - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Fossil|w/ CCS - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Temperature|Global Mean|MAGICC6|MED - cannot check regional aggregate because it has no regional components\n" + ] + }, + { + "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", + " \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", + " \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", + " \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", + " \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", + "
20052010202020302040205020602070208020902100
regionmodelscenariovariable
WorldAIM-Enduse 12.1EMF27-450-ConvPrimary Energy458.20518.89500.15521.23569.53581.44NaNNaNNaNNaNNaN
EMF27-450-NoCCSPrimary Energy458.20518.81500.24493.64583.82614.23NaNNaNNaNNaNNaN
EMF27-550-LimBioPrimary Energy458.20518.81544.28592.53639.70679.98NaNNaNNaNNaNNaN
EMF27-Base-FullTechPrimary Energy458.20518.81545.24619.43715.12816.88NaNNaNNaNNaNNaN
EMF27-G8-EEREPrimary Energy458.20518.64487.22463.48499.48555.22NaNNaNNaNNaNNaN
GCAM 3.0AMPERE3-450Primary Energy460.41504.35618.51743.09848.71935.921001.751091.211177.401281.611418.91
AMPERE3-450P-CEPrimary Energy460.41504.35618.74753.34849.79942.161005.561092.561177.721281.711418.59
AMPERE3-450P-EUPrimary Energy460.41504.35624.50769.43857.29943.231002.711089.481177.261282.191420.23
AMPERE3-550Primary Energy458.03501.89622.66751.83863.50956.221007.661064.331146.191221.761331.16
AMPERE3-Base-EUbackPrimary Energy457.76501.61632.27788.66934.721073.331174.841261.381328.941395.491470.71
AMPERE3-CF450P-EUPrimary Energy460.41504.35635.96793.04870.95942.831001.181087.411176.791282.691420.85
AMPERE3-RefPolPrimary Energy457.76501.61622.68764.56884.66995.111080.881155.011214.591275.171325.32
EMF27-450-ConvPrimary Energy458.82504.59556.01630.79694.18749.23791.67824.53834.82822.03794.94
EMF27-450-NoCCSPrimary Energy458.82504.45546.22599.28628.39654.74684.87733.00787.27834.91NaN
EMF27-550-LimBioPrimary Energy458.82504.45576.89663.16729.41777.90817.73865.14911.34939.80964.83
EMF27-Base-FullTechPrimary Energy458.82504.45613.10730.03841.52952.451049.691139.911218.931276.801319.59
IMAGE 2.4AMPERE3-450Primary Energy441.25473.91544.13577.42638.17685.99751.05763.70778.29821.22863.04
AMPERE3-450P-CEPrimary Energy441.25473.91580.13654.46676.13695.56750.32766.26792.33837.14879.08
AMPERE3-450P-EUPrimary Energy441.25473.91598.26696.60692.53699.38747.23763.69791.18836.82879.48
AMPERE3-550Primary Energy441.25473.79559.87603.66689.49758.18815.96844.50862.31905.22942.64
\n", + "
" + ], + "text/plain": [ + " 2005 2010 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Primary Energy 458.20 518.89 \n", + " EMF27-450-NoCCS Primary Energy 458.20 518.81 \n", + " EMF27-550-LimBio Primary Energy 458.20 518.81 \n", + " EMF27-Base-FullTech Primary Energy 458.20 518.81 \n", + " EMF27-G8-EERE Primary Energy 458.20 518.64 \n", + " GCAM 3.0 AMPERE3-450 Primary Energy 460.41 504.35 \n", + " AMPERE3-450P-CE Primary Energy 460.41 504.35 \n", + " AMPERE3-450P-EU Primary Energy 460.41 504.35 \n", + " AMPERE3-550 Primary Energy 458.03 501.89 \n", + " AMPERE3-Base-EUback Primary Energy 457.76 501.61 \n", + " AMPERE3-CF450P-EU Primary Energy 460.41 504.35 \n", + " AMPERE3-RefPol Primary Energy 457.76 501.61 \n", + " EMF27-450-Conv Primary Energy 458.82 504.59 \n", + " EMF27-450-NoCCS Primary Energy 458.82 504.45 \n", + " EMF27-550-LimBio Primary Energy 458.82 504.45 \n", + " EMF27-Base-FullTech Primary Energy 458.82 504.45 \n", + " IMAGE 2.4 AMPERE3-450 Primary Energy 441.25 473.91 \n", + " AMPERE3-450P-CE Primary Energy 441.25 473.91 \n", + " AMPERE3-450P-EU Primary Energy 441.25 473.91 \n", + " AMPERE3-550 Primary Energy 441.25 473.79 \n", + "\n", + " 2020 2030 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Primary Energy 500.15 521.23 \n", + " EMF27-450-NoCCS Primary Energy 500.24 493.64 \n", + " EMF27-550-LimBio Primary Energy 544.28 592.53 \n", + " EMF27-Base-FullTech Primary Energy 545.24 619.43 \n", + " EMF27-G8-EERE Primary Energy 487.22 463.48 \n", + " GCAM 3.0 AMPERE3-450 Primary Energy 618.51 743.09 \n", + " AMPERE3-450P-CE Primary Energy 618.74 753.34 \n", + " AMPERE3-450P-EU Primary Energy 624.50 769.43 \n", + " AMPERE3-550 Primary Energy 622.66 751.83 \n", + " AMPERE3-Base-EUback Primary Energy 632.27 788.66 \n", + " AMPERE3-CF450P-EU Primary Energy 635.96 793.04 \n", + " AMPERE3-RefPol Primary Energy 622.68 764.56 \n", + " EMF27-450-Conv Primary Energy 556.01 630.79 \n", + " EMF27-450-NoCCS Primary Energy 546.22 599.28 \n", + " EMF27-550-LimBio Primary Energy 576.89 663.16 \n", + " EMF27-Base-FullTech Primary Energy 613.10 730.03 \n", + " IMAGE 2.4 AMPERE3-450 Primary Energy 544.13 577.42 \n", + " AMPERE3-450P-CE Primary Energy 580.13 654.46 \n", + " AMPERE3-450P-EU Primary Energy 598.26 696.60 \n", + " AMPERE3-550 Primary Energy 559.87 603.66 \n", + "\n", + " 2040 2050 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Primary Energy 569.53 581.44 \n", + " EMF27-450-NoCCS Primary Energy 583.82 614.23 \n", + " EMF27-550-LimBio Primary Energy 639.70 679.98 \n", + " EMF27-Base-FullTech Primary Energy 715.12 816.88 \n", + " EMF27-G8-EERE Primary Energy 499.48 555.22 \n", + " GCAM 3.0 AMPERE3-450 Primary Energy 848.71 935.92 \n", + " AMPERE3-450P-CE Primary Energy 849.79 942.16 \n", + " AMPERE3-450P-EU Primary Energy 857.29 943.23 \n", + " AMPERE3-550 Primary Energy 863.50 956.22 \n", + " AMPERE3-Base-EUback Primary Energy 934.72 1073.33 \n", + " AMPERE3-CF450P-EU Primary Energy 870.95 942.83 \n", + " AMPERE3-RefPol Primary Energy 884.66 995.11 \n", + " EMF27-450-Conv Primary Energy 694.18 749.23 \n", + " EMF27-450-NoCCS Primary Energy 628.39 654.74 \n", + " EMF27-550-LimBio Primary Energy 729.41 777.90 \n", + " EMF27-Base-FullTech Primary Energy 841.52 952.45 \n", + " IMAGE 2.4 AMPERE3-450 Primary Energy 638.17 685.99 \n", + " AMPERE3-450P-CE Primary Energy 676.13 695.56 \n", + " AMPERE3-450P-EU Primary Energy 692.53 699.38 \n", + " AMPERE3-550 Primary Energy 689.49 758.18 \n", + "\n", + " 2060 2070 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Primary Energy NaN NaN \n", + " EMF27-450-NoCCS Primary Energy NaN NaN \n", + " EMF27-550-LimBio Primary Energy NaN NaN \n", + " EMF27-Base-FullTech Primary Energy NaN NaN \n", + " EMF27-G8-EERE Primary Energy NaN NaN \n", + " GCAM 3.0 AMPERE3-450 Primary Energy 1001.75 1091.21 \n", + " AMPERE3-450P-CE Primary Energy 1005.56 1092.56 \n", + " AMPERE3-450P-EU Primary Energy 1002.71 1089.48 \n", + " AMPERE3-550 Primary Energy 1007.66 1064.33 \n", + " AMPERE3-Base-EUback Primary Energy 1174.84 1261.38 \n", + " AMPERE3-CF450P-EU Primary Energy 1001.18 1087.41 \n", + " AMPERE3-RefPol Primary Energy 1080.88 1155.01 \n", + " EMF27-450-Conv Primary Energy 791.67 824.53 \n", + " EMF27-450-NoCCS Primary Energy 684.87 733.00 \n", + " EMF27-550-LimBio Primary Energy 817.73 865.14 \n", + " EMF27-Base-FullTech Primary Energy 1049.69 1139.91 \n", + " IMAGE 2.4 AMPERE3-450 Primary Energy 751.05 763.70 \n", + " AMPERE3-450P-CE Primary Energy 750.32 766.26 \n", + " AMPERE3-450P-EU Primary Energy 747.23 763.69 \n", + " AMPERE3-550 Primary Energy 815.96 844.50 \n", + "\n", + " 2080 2090 \\\n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Primary Energy NaN NaN \n", + " EMF27-450-NoCCS Primary Energy NaN NaN \n", + " EMF27-550-LimBio Primary Energy NaN NaN \n", + " EMF27-Base-FullTech Primary Energy NaN NaN \n", + " EMF27-G8-EERE Primary Energy NaN NaN \n", + " GCAM 3.0 AMPERE3-450 Primary Energy 1177.40 1281.61 \n", + " AMPERE3-450P-CE Primary Energy 1177.72 1281.71 \n", + " AMPERE3-450P-EU Primary Energy 1177.26 1282.19 \n", + " AMPERE3-550 Primary Energy 1146.19 1221.76 \n", + " AMPERE3-Base-EUback Primary Energy 1328.94 1395.49 \n", + " AMPERE3-CF450P-EU Primary Energy 1176.79 1282.69 \n", + " AMPERE3-RefPol Primary Energy 1214.59 1275.17 \n", + " EMF27-450-Conv Primary Energy 834.82 822.03 \n", + " EMF27-450-NoCCS Primary Energy 787.27 834.91 \n", + " EMF27-550-LimBio Primary Energy 911.34 939.80 \n", + " EMF27-Base-FullTech Primary Energy 1218.93 1276.80 \n", + " IMAGE 2.4 AMPERE3-450 Primary Energy 778.29 821.22 \n", + " AMPERE3-450P-CE Primary Energy 792.33 837.14 \n", + " AMPERE3-450P-EU Primary Energy 791.18 836.82 \n", + " AMPERE3-550 Primary Energy 862.31 905.22 \n", + "\n", + " 2100 \n", + "region model scenario variable \n", + "World AIM-Enduse 12.1 EMF27-450-Conv Primary Energy NaN \n", + " EMF27-450-NoCCS Primary Energy NaN \n", + " EMF27-550-LimBio Primary Energy NaN \n", + " EMF27-Base-FullTech Primary Energy NaN \n", + " EMF27-G8-EERE Primary Energy NaN \n", + " GCAM 3.0 AMPERE3-450 Primary Energy 1418.91 \n", + " AMPERE3-450P-CE Primary Energy 1418.59 \n", + " AMPERE3-450P-EU Primary Energy 1420.23 \n", + " AMPERE3-550 Primary Energy 1331.16 \n", + " AMPERE3-Base-EUback Primary Energy 1470.71 \n", + " AMPERE3-CF450P-EU Primary Energy 1420.85 \n", + " AMPERE3-RefPol Primary Energy 1325.32 \n", + " EMF27-450-Conv Primary Energy 794.94 \n", + " EMF27-450-NoCCS Primary Energy NaN \n", + " EMF27-550-LimBio Primary Energy 964.83 \n", + " EMF27-Base-FullTech Primary Energy 1319.59 \n", + " IMAGE 2.4 AMPERE3-450 Primary Energy 863.04 \n", + " AMPERE3-450P-CE Primary Energy 879.08 \n", + " AMPERE3-450P-EU Primary Energy 879.48 \n", + " AMPERE3-550 Primary Energy 942.64 " + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "for variable in df.variables():\n", + " diff = df.check_aggregate_regions(\n", + " variable, \n", + " **np_isclose_args\n", + " )\n", + " # you could then make whatever summary you wanted\n", + " # with diff\n", + " if diff is not None:\n", + " eg = diff\n", + "\n", + "eg.head(20)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## An internally consistent database\n", + "\n", + "If we have an internally consistent database, the returned `DataFrame` will always be none. \n", + "\n", + "Repeating the same analysis as above can then confirm that all is well with the database as well as give us some insight into which variables do not have regional or sectoral breakdowns reported." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Reading `tutorial_check_database.csv`\n" + ] + } + ], + "source": [ + "consistent_df = pyam.IamDataFrame(data=\"tutorial_check_database.csv\", encoding='utf-8')" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Coal - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Gas - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CF4 - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CH4 - cannot check aggregate because it has no components\n" + ] + } + ], + "source": [ + "for variable in consistent_df.filter(level=1).variables():\n", + " diff = consistent_df.check_aggregate(\n", + " variable, \n", + " **np_isclose_args\n", + " )\n", + " assert diff is None" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING:root:Filtered IamDataFrame is empty!\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|C2F6 - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CF4 - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n" + ] + } + ], + "source": [ + "for variable in consistent_df.filter(level=1).variables():\n", + " diff = consistent_df.check_aggregate_regions(\n", + " variable, \n", + " **np_isclose_args\n", + " )\n", + " assert diff is None" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Putting it altogether\n", + "\n", + "Finally, we provide the `check_internal_consistency` method which does all the above for you and returns a dictionary with all of the dataframes which document the errors.\n", + "\n", + "Note: at the moment, this method's regional checking is limited to checking that all the regions sum to the World region. We cannot make this more automatic unless we start to store how the regions relate, see [this issue](https://github.com/IAMconsortium/pyam/issues/106). " + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Checking consistent data\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Cars - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Power - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Coal - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Gas - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|C2F6 - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|C2F6|Industry - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|C2F6|Industry - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|C2F6|Solvents - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|C2F6|Solvents - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CF4 - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CF4 - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CH4 - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Aggregate Agg - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Aggregate Agg - cannot check regional aggregate because it has no regional components\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Checking AR5 subset\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Emissions|CO2 - 1390 of 1522 data points are not aggregates of components\n", + "INFO:root:Emissions|CO2 - 503 of 503 data points are not aggregates of regional components\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry - 1258 of 1258 data points are not aggregates of components\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry - 239 of 239 data points are not aggregates of regional components\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry|Energy Supply - 239 of 239 data points are not aggregates of components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry|Energy Supply - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry|Energy Supply|Electricity - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Emissions|CO2|Fossil Fuels and Industry|Energy Supply|Electricity - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Price|Carbon - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Price|Carbon - cannot check regional aggregate because it has no regional components\n", + "INFO:root:Primary Energy - 1522 of 1522 data points are not aggregates of components\n", + "INFO:root:Primary Energy - 503 of 503 data points are not aggregates of regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Coal - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Coal - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Fossil|w/ CCS - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Primary Energy|Fossil|w/ CCS - cannot check regional aggregate because it has no regional components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Temperature|Global Mean|MAGICC6|MED - cannot check aggregate because it has no components\n", + "WARNING:root:Filtered IamDataFrame is empty!\n", + "INFO:root:Temperature|Global Mean|MAGICC6|MED - cannot check regional aggregate because it has no regional components\n" + ] + } + ], + "source": [ + "# if all is good, None is returned\n", + "print(\"Checking consistent data\"); time.sleep(0.5)\n", + "assert consistent_df.check_internal_consistency() is None\n", + "\n", + "# otherwise we get a dict back\n", + "print(\"Checking AR5 subset\"); time.sleep(0.5)\n", + "errors = df.check_internal_consistency()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Emissions|CO2-aggregate',\n", + " 'Emissions|CO2-regional',\n", + " 'Emissions|CO2|Fossil Fuels and Industry-aggregate',\n", + " 'Emissions|CO2|Fossil Fuels and Industry-regional',\n", + " 'Emissions|CO2|Fossil Fuels and Industry|Energy Supply-aggregate',\n", + " 'Primary Energy-aggregate',\n", + " 'Primary Energy-regional']\n" + ] + } + ], + "source": [ + "pprint([k for k in errors.keys()])" + ] + }, + { + "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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + "
20052010202020302040205020602070208020902100
variablemodelscenarioregion
Emissions|CO2AIM-Enduse 12.1EMF27-450-ConvASIA10540.7413160.1811899.389545.817355.076119.50NaNNaNNaNNaNNaN
LAM3285.003294.543367.622856.652207.361537.72NaNNaNNaNNaNNaN
MAF4302.214487.544238.913956.193490.812082.24NaNNaNNaNNaNNaN
OECD9012085.8512744.3311646.378272.304457.911625.18NaNNaNNaNNaNNaN
REF3306.953604.423325.202991.241889.38960.75NaNNaNNaNNaNNaN
World34492.0538321.7835588.6628531.6820287.4613367.27NaNNaNNaNNaNNaN
EMF27-450-NoCCSASIA10540.7413160.1111893.809478.337367.075513.79NaNNaNNaNNaNNaN
LAM3285.003286.683362.612837.111889.89899.63NaNNaNNaNNaNNaN
MAF4302.214487.494239.033619.252787.471671.29NaNNaNNaNNaNNaN
OECD9012085.8512744.1611659.298708.815488.863355.22NaNNaNNaNNaNNaN
REF3306.953604.393322.953076.671977.781181.73NaNNaNNaNNaNNaN
World34492.0538313.5935588.8528629.6520458.1013660.19NaNNaNNaNNaNNaN
EMF27-550-LimBioASIA10540.7413160.1114124.1714218.0813187.6610019.56NaNNaNNaNNaNNaN
LAM3285.003286.683445.633496.622986.081790.49NaNNaNNaNNaNNaN
MAF4302.214487.494368.484519.644294.832733.76NaNNaNNaNNaNNaN
OECD9012085.8512744.1612607.1711752.019749.336501.31NaNNaNNaNNaNNaN
REF3306.953604.393826.803615.473258.313076.27NaNNaNNaNNaNNaN
World34492.0538313.5939531.6138815.5434676.3825295.31NaNNaNNaNNaNNaN
EMF27-Base-FullTechASIA10540.7413160.1114149.8916559.1419658.6823071.34NaNNaNNaNNaNNaN
LAM3285.003286.683449.843660.683850.443866.20NaNNaNNaNNaNNaN
MAF4302.214487.494371.984751.635389.486082.37NaNNaNNaNNaNNaN
OECD9012085.8512744.1612642.7013332.2913742.9314150.35NaNNaNNaNNaNNaN
REF3306.953604.393838.824220.974866.315615.39NaNNaNNaNNaNNaN
World34492.0538313.5939612.6043835.4949027.8054552.86NaNNaNNaNNaNNaN
EMF27-G8-EEREASIA10540.7413152.5613415.9410147.897637.614435.80NaNNaNNaNNaNNaN
LAM3285.003286.523106.392825.271784.31899.06NaNNaNNaNNaNNaN
MAF4302.214487.024091.193977.503659.803336.85NaNNaNNaNNaNNaN
OECD9012085.8512750.8110276.068833.955845.243473.56NaNNaNNaNNaNNaN
REF3306.953596.743453.293468.733376.253058.68NaNNaNNaNNaNNaN
World34492.0538304.4135425.9630395.4323536.7116487.83NaNNaNNaNNaNNaN
..........................................
REMIND 1.5EMF27-450-NoCCSOECD9015111.3915254.168082.872864.75369.53328.11299.06266.24255.25245.07226.35
World33837.4138224.9425524.607358.641691.051663.771616.521555.471553.001665.201883.11
EMF27-550-LimBioASIA10193.9813239.5514218.3711920.798135.325963.844486.533100.112246.061843.161570.02
LAM2926.603478.794413.411831.961357.42934.84712.03523.57418.39359.64107.38
MAF4035.324381.034504.493368.893582.703883.523663.913349.073064.562919.433153.50
OECD9015111.3915241.5613016.5210555.137238.064454.982745.801531.01766.12275.60-82.62
World33837.4137970.1137657.4128699.5020936.8315389.2011536.738368.716360.335299.364644.20
EMF27-Base-FullTechASIA10193.9813478.7820256.0124006.7428404.7833016.6635977.3536397.9234529.7928622.8323400.42
LAM2926.603508.405067.355464.434402.985424.515869.575988.956096.945152.734074.45
MAF4035.324381.095364.845862.758659.6112865.8217680.1322674.4127242.6029150.2929981.48
OECD9015111.3915234.6315486.5716326.5916610.2416943.5616515.9015922.4314587.2211864.629683.61
World33837.4138293.0848134.4253343.8259836.1070077.8977941.2182914.1584109.2375995.0968004.38
WITCH_EMF27EMF27-450-ConvASIA9895.4513210.1813914.1212004.4910538.518767.497410.946299.163794.592865.462437.77
LAM4660.574644.171851.461537.681421.58658.62-161.02-1398.20-1659.55-1631.41-1586.79
MAF2508.312673.952224.441932.651907.501703.001588.401493.361413.901303.021118.21
OECD9012644.4012597.559780.386560.694755.203257.792240.721399.83795.67359.17224.28
REF3870.584035.172381.752055.811733.111347.511064.51815.36611.13444.37383.41
World33579.3237161.0330152.1524091.3220355.9115734.4012143.568609.504955.743340.622576.88
EMF27-550-LimBioASIA9895.9813341.7617280.0618745.4116414.5212419.7210012.019373.388937.929270.479214.63
LAM4660.844612.382729.372515.922286.121309.501048.52677.15470.62-66.27-210.35
MAF2508.812621.972773.632885.032775.242552.542579.222758.682928.883067.603139.20
OECD9012645.7812542.8711852.6010275.137908.885310.744461.184405.414236.364016.453860.45
REF3871.044062.723764.233380.512617.251957.661686.231658.311628.481550.831510.95
World33582.4537181.7038399.8837802.0132002.0223550.1719787.1618872.9318202.2517839.0717514.87
EMF27-Base-FullTechASIA9893.4613378.3420016.5526248.4730889.3834562.4637566.0540325.6442647.5244874.7246657.52
LAM4659.584623.984524.394644.994937.365250.675698.256117.406522.666945.517358.61
MAF2506.452642.283291.194063.345028.416038.177017.408032.948851.509680.4910373.40
OECD9012639.2812598.8413097.9513835.6214969.1215784.5916540.1817249.2117924.8618566.2319180.64
REF3868.874077.284636.235039.145412.355886.806279.446439.806722.197040.237284.21
World33567.6437320.7245566.3053831.5661236.6267522.7073101.3278164.9882668.7487107.1790854.38
\n", + "

140 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " 2005 2010 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA 10540.74 13160.18 \n", + " LAM 3285.00 3294.54 \n", + " MAF 4302.21 4487.54 \n", + " OECD90 12085.85 12744.33 \n", + " REF 3306.95 3604.42 \n", + " World 34492.05 38321.78 \n", + " EMF27-450-NoCCS ASIA 10540.74 13160.11 \n", + " LAM 3285.00 3286.68 \n", + " MAF 4302.21 4487.49 \n", + " OECD90 12085.85 12744.16 \n", + " REF 3306.95 3604.39 \n", + " World 34492.05 38313.59 \n", + " EMF27-550-LimBio ASIA 10540.74 13160.11 \n", + " LAM 3285.00 3286.68 \n", + " MAF 4302.21 4487.49 \n", + " OECD90 12085.85 12744.16 \n", + " REF 3306.95 3604.39 \n", + " World 34492.05 38313.59 \n", + " EMF27-Base-FullTech ASIA 10540.74 13160.11 \n", + " LAM 3285.00 3286.68 \n", + " MAF 4302.21 4487.49 \n", + " OECD90 12085.85 12744.16 \n", + " REF 3306.95 3604.39 \n", + " World 34492.05 38313.59 \n", + " EMF27-G8-EERE ASIA 10540.74 13152.56 \n", + " LAM 3285.00 3286.52 \n", + " MAF 4302.21 4487.02 \n", + " OECD90 12085.85 12750.81 \n", + " REF 3306.95 3596.74 \n", + " World 34492.05 38304.41 \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 15111.39 15254.16 \n", + " World 33837.41 38224.94 \n", + " EMF27-550-LimBio ASIA 10193.98 13239.55 \n", + " LAM 2926.60 3478.79 \n", + " MAF 4035.32 4381.03 \n", + " OECD90 15111.39 15241.56 \n", + " World 33837.41 37970.11 \n", + " EMF27-Base-FullTech ASIA 10193.98 13478.78 \n", + " LAM 2926.60 3508.40 \n", + " MAF 4035.32 4381.09 \n", + " OECD90 15111.39 15234.63 \n", + " World 33837.41 38293.08 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 9895.45 13210.18 \n", + " LAM 4660.57 4644.17 \n", + " MAF 2508.31 2673.95 \n", + " OECD90 12644.40 12597.55 \n", + " REF 3870.58 4035.17 \n", + " World 33579.32 37161.03 \n", + " EMF27-550-LimBio ASIA 9895.98 13341.76 \n", + " LAM 4660.84 4612.38 \n", + " MAF 2508.81 2621.97 \n", + " OECD90 12645.78 12542.87 \n", + " REF 3871.04 4062.72 \n", + " World 33582.45 37181.70 \n", + " EMF27-Base-FullTech ASIA 9893.46 13378.34 \n", + " LAM 4659.58 4623.98 \n", + " MAF 2506.45 2642.28 \n", + " OECD90 12639.28 12598.84 \n", + " REF 3868.87 4077.28 \n", + " World 33567.64 37320.72 \n", + "\n", + " 2020 2030 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA 11899.38 9545.81 \n", + " LAM 3367.62 2856.65 \n", + " MAF 4238.91 3956.19 \n", + " OECD90 11646.37 8272.30 \n", + " REF 3325.20 2991.24 \n", + " World 35588.66 28531.68 \n", + " EMF27-450-NoCCS ASIA 11893.80 9478.33 \n", + " LAM 3362.61 2837.11 \n", + " MAF 4239.03 3619.25 \n", + " OECD90 11659.29 8708.81 \n", + " REF 3322.95 3076.67 \n", + " World 35588.85 28629.65 \n", + " EMF27-550-LimBio ASIA 14124.17 14218.08 \n", + " LAM 3445.63 3496.62 \n", + " MAF 4368.48 4519.64 \n", + " OECD90 12607.17 11752.01 \n", + " REF 3826.80 3615.47 \n", + " World 39531.61 38815.54 \n", + " EMF27-Base-FullTech ASIA 14149.89 16559.14 \n", + " LAM 3449.84 3660.68 \n", + " MAF 4371.98 4751.63 \n", + " OECD90 12642.70 13332.29 \n", + " REF 3838.82 4220.97 \n", + " World 39612.60 43835.49 \n", + " EMF27-G8-EERE ASIA 13415.94 10147.89 \n", + " LAM 3106.39 2825.27 \n", + " MAF 4091.19 3977.50 \n", + " OECD90 10276.06 8833.95 \n", + " REF 3453.29 3468.73 \n", + " World 35425.96 30395.43 \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 8082.87 2864.75 \n", + " World 25524.60 7358.64 \n", + " EMF27-550-LimBio ASIA 14218.37 11920.79 \n", + " LAM 4413.41 1831.96 \n", + " MAF 4504.49 3368.89 \n", + " OECD90 13016.52 10555.13 \n", + " World 37657.41 28699.50 \n", + " EMF27-Base-FullTech ASIA 20256.01 24006.74 \n", + " LAM 5067.35 5464.43 \n", + " MAF 5364.84 5862.75 \n", + " OECD90 15486.57 16326.59 \n", + " World 48134.42 53343.82 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 13914.12 12004.49 \n", + " LAM 1851.46 1537.68 \n", + " MAF 2224.44 1932.65 \n", + " OECD90 9780.38 6560.69 \n", + " REF 2381.75 2055.81 \n", + " World 30152.15 24091.32 \n", + " EMF27-550-LimBio ASIA 17280.06 18745.41 \n", + " LAM 2729.37 2515.92 \n", + " MAF 2773.63 2885.03 \n", + " OECD90 11852.60 10275.13 \n", + " REF 3764.23 3380.51 \n", + " World 38399.88 37802.01 \n", + " EMF27-Base-FullTech ASIA 20016.55 26248.47 \n", + " LAM 4524.39 4644.99 \n", + " MAF 3291.19 4063.34 \n", + " OECD90 13097.95 13835.62 \n", + " REF 4636.23 5039.14 \n", + " World 45566.30 53831.56 \n", + "\n", + " 2040 2050 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA 7355.07 6119.50 \n", + " LAM 2207.36 1537.72 \n", + " MAF 3490.81 2082.24 \n", + " OECD90 4457.91 1625.18 \n", + " REF 1889.38 960.75 \n", + " World 20287.46 13367.27 \n", + " EMF27-450-NoCCS ASIA 7367.07 5513.79 \n", + " LAM 1889.89 899.63 \n", + " MAF 2787.47 1671.29 \n", + " OECD90 5488.86 3355.22 \n", + " REF 1977.78 1181.73 \n", + " World 20458.10 13660.19 \n", + " EMF27-550-LimBio ASIA 13187.66 10019.56 \n", + " LAM 2986.08 1790.49 \n", + " MAF 4294.83 2733.76 \n", + " OECD90 9749.33 6501.31 \n", + " REF 3258.31 3076.27 \n", + " World 34676.38 25295.31 \n", + " EMF27-Base-FullTech ASIA 19658.68 23071.34 \n", + " LAM 3850.44 3866.20 \n", + " MAF 5389.48 6082.37 \n", + " OECD90 13742.93 14150.35 \n", + " REF 4866.31 5615.39 \n", + " World 49027.80 54552.86 \n", + " EMF27-G8-EERE ASIA 7637.61 4435.80 \n", + " LAM 1784.31 899.06 \n", + " MAF 3659.80 3336.85 \n", + " OECD90 5845.24 3473.56 \n", + " REF 3376.25 3058.68 \n", + " World 23536.71 16487.83 \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 369.53 328.11 \n", + " World 1691.05 1663.77 \n", + " EMF27-550-LimBio ASIA 8135.32 5963.84 \n", + " LAM 1357.42 934.84 \n", + " MAF 3582.70 3883.52 \n", + " OECD90 7238.06 4454.98 \n", + " World 20936.83 15389.20 \n", + " EMF27-Base-FullTech ASIA 28404.78 33016.66 \n", + " LAM 4402.98 5424.51 \n", + " MAF 8659.61 12865.82 \n", + " OECD90 16610.24 16943.56 \n", + " World 59836.10 70077.89 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 10538.51 8767.49 \n", + " LAM 1421.58 658.62 \n", + " MAF 1907.50 1703.00 \n", + " OECD90 4755.20 3257.79 \n", + " REF 1733.11 1347.51 \n", + " World 20355.91 15734.40 \n", + " EMF27-550-LimBio ASIA 16414.52 12419.72 \n", + " LAM 2286.12 1309.50 \n", + " MAF 2775.24 2552.54 \n", + " OECD90 7908.88 5310.74 \n", + " REF 2617.25 1957.66 \n", + " World 32002.02 23550.17 \n", + " EMF27-Base-FullTech ASIA 30889.38 34562.46 \n", + " LAM 4937.36 5250.67 \n", + " MAF 5028.41 6038.17 \n", + " OECD90 14969.12 15784.59 \n", + " REF 5412.35 5886.80 \n", + " World 61236.62 67522.70 \n", + "\n", + " 2060 2070 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-450-NoCCS ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-550-LimBio ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-Base-FullTech ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-G8-EERE ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 299.06 266.24 \n", + " World 1616.52 1555.47 \n", + " EMF27-550-LimBio ASIA 4486.53 3100.11 \n", + " LAM 712.03 523.57 \n", + " MAF 3663.91 3349.07 \n", + " OECD90 2745.80 1531.01 \n", + " World 11536.73 8368.71 \n", + " EMF27-Base-FullTech ASIA 35977.35 36397.92 \n", + " LAM 5869.57 5988.95 \n", + " MAF 17680.13 22674.41 \n", + " OECD90 16515.90 15922.43 \n", + " World 77941.21 82914.15 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 7410.94 6299.16 \n", + " LAM -161.02 -1398.20 \n", + " MAF 1588.40 1493.36 \n", + " OECD90 2240.72 1399.83 \n", + " REF 1064.51 815.36 \n", + " World 12143.56 8609.50 \n", + " EMF27-550-LimBio ASIA 10012.01 9373.38 \n", + " LAM 1048.52 677.15 \n", + " MAF 2579.22 2758.68 \n", + " OECD90 4461.18 4405.41 \n", + " REF 1686.23 1658.31 \n", + " World 19787.16 18872.93 \n", + " EMF27-Base-FullTech ASIA 37566.05 40325.64 \n", + " LAM 5698.25 6117.40 \n", + " MAF 7017.40 8032.94 \n", + " OECD90 16540.18 17249.21 \n", + " REF 6279.44 6439.80 \n", + " World 73101.32 78164.98 \n", + "\n", + " 2080 2090 \\\n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-450-NoCCS ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-550-LimBio ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-Base-FullTech ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + " EMF27-G8-EERE ASIA NaN NaN \n", + " LAM NaN NaN \n", + " MAF NaN NaN \n", + " OECD90 NaN NaN \n", + " REF NaN NaN \n", + " World NaN NaN \n", + "... ... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 255.25 245.07 \n", + " World 1553.00 1665.20 \n", + " EMF27-550-LimBio ASIA 2246.06 1843.16 \n", + " LAM 418.39 359.64 \n", + " MAF 3064.56 2919.43 \n", + " OECD90 766.12 275.60 \n", + " World 6360.33 5299.36 \n", + " EMF27-Base-FullTech ASIA 34529.79 28622.83 \n", + " LAM 6096.94 5152.73 \n", + " MAF 27242.60 29150.29 \n", + " OECD90 14587.22 11864.62 \n", + " World 84109.23 75995.09 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 3794.59 2865.46 \n", + " LAM -1659.55 -1631.41 \n", + " MAF 1413.90 1303.02 \n", + " OECD90 795.67 359.17 \n", + " REF 611.13 444.37 \n", + " World 4955.74 3340.62 \n", + " EMF27-550-LimBio ASIA 8937.92 9270.47 \n", + " LAM 470.62 -66.27 \n", + " MAF 2928.88 3067.60 \n", + " OECD90 4236.36 4016.45 \n", + " REF 1628.48 1550.83 \n", + " World 18202.25 17839.07 \n", + " EMF27-Base-FullTech ASIA 42647.52 44874.72 \n", + " LAM 6522.66 6945.51 \n", + " MAF 8851.50 9680.49 \n", + " OECD90 17924.86 18566.23 \n", + " REF 6722.19 7040.23 \n", + " World 82668.74 87107.17 \n", + "\n", + " 2100 \n", + "variable model scenario region \n", + "Emissions|CO2 AIM-Enduse 12.1 EMF27-450-Conv ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-450-NoCCS ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-550-LimBio ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-Base-FullTech ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + " EMF27-G8-EERE ASIA NaN \n", + " LAM NaN \n", + " MAF NaN \n", + " OECD90 NaN \n", + " REF NaN \n", + " World NaN \n", + "... ... \n", + " REMIND 1.5 EMF27-450-NoCCS OECD90 226.35 \n", + " World 1883.11 \n", + " EMF27-550-LimBio ASIA 1570.02 \n", + " LAM 107.38 \n", + " MAF 3153.50 \n", + " OECD90 -82.62 \n", + " World 4644.20 \n", + " EMF27-Base-FullTech ASIA 23400.42 \n", + " LAM 4074.45 \n", + " MAF 29981.48 \n", + " OECD90 9683.61 \n", + " World 68004.38 \n", + " WITCH_EMF27 EMF27-450-Conv ASIA 2437.77 \n", + " LAM -1586.79 \n", + " MAF 1118.21 \n", + " OECD90 224.28 \n", + " REF 383.41 \n", + " World 2576.88 \n", + " EMF27-550-LimBio ASIA 9214.63 \n", + " LAM -210.35 \n", + " MAF 3139.20 \n", + " OECD90 3860.45 \n", + " REF 1510.95 \n", + " World 17514.87 \n", + " EMF27-Base-FullTech ASIA 46657.52 \n", + " LAM 7358.61 \n", + " MAF 10373.40 \n", + " OECD90 19180.64 \n", + " REF 7284.21 \n", + " World 90854.38 \n", + "\n", + "[140 rows x 11 columns]" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "errors[\"Emissions|CO2-aggregate\"]" + ] + } + ], + "metadata": { + "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.6.6" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/tutorial/pyam_first_steps.ipynb b/tutorial/pyam_first_steps.ipynb index b3eab6626..943efc540 100644 --- a/tutorial/pyam_first_steps.ipynb +++ b/tutorial/pyam_first_steps.ipynb @@ -182,6 +182,31 @@ "df.filter(model='MESSAGE*')[['model', 'scenario']].drop_duplicates()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Using keyword `keep=False` allows you to discard everything that is found by the filter rather than keeping it" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "df.filter(region=\"World\", keep=False).regions()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "df.filter(region=\"World\", keep=True).regions()" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -621,7 +646,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.4" + "version": "3.6.6" } }, "nbformat": 4,