{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Aggregating and downscaling timeseries data\n", "\n", "The **pyam** package offers many tools to facilitate processing of scenario data.\n", "In this notebook, we illustrate methods to aggregate and downscale timeseries data of an **IamDataFrame** across regions and sectors, as well as checking consistency of given data along these dimensions.\n", "\n", "In this tutorial, we show how to make the most of **pyam** to compute such aggregate timeseries data, and to check that a scenario ensemble (or just a single scenario) is complete and that timeseries data \"add up\" across regions and along the variable tree (i.e., that the sum of values of the subcategories such as `Primary Energy|*` are identical to the values of the category `Primary Energy`).\n", "\n", "There are two distinct use cases where these features can be used.\n", "\n", "### Use case 1: compute data at higher/lower sectoral or spatial aggregation\n", "\n", "Given scenario results at a specific (usually very detailed) sectoral and spatial resolution, **pyam** offers a suite of functions to easily compute aggregate timeseries. For example, this allows to sum up national energy demand to regional or global values,\n", "or to compute the average of a global carbon price weighted by regional emissions.\n", "\n", "These functions can be used as part of an automated workflow to generate complete scenario results from raw model outputs.\n", "\n", "### Use case 2: check the consistency of data across sectoral or spatial levels\n", "\n", "In model comparison exercises or ensemble compilation projects, a user needs to verify the internal consistency of submitted scenario results (cf. Huppmann et al., 2018, doi: [10.1038/s41558-018-0317-4](http://rdcu.be/9i8a)).\n", "Such inconsistencies can be due to incomplete variable hierarchies, reporting templates incompatible with model specifications, or user error.\n", "\n", "## Overview\n", "\n", "This notebook illustrates the following features:\n", "\n", "0. Import data from file and inspect the scenario\n", "1. Aggregate timeseries over sectors (i.e., sub-categories)\n", "2. Aggregate timeseries over regions including weighted average\n", "3. Downscale timeseries given at a region level to sub-regions using a proxy variable\n", "4. Downscale timeseries using an explicit weighting dataframe\n", "5. Check the internal consistency of a scenario (ensemble)\n", "\n", "