{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Algebraic operations on timeseries data\n", "\n", "The **pyam** package offers many tools to facilitate processing of scenario data.\n", "In this notebook, we illustrate algebraic operations on the timeseries data of an **IamDataFrame**:\n", "addition, subtraction, multiplication, and division.\n", "\n", "The algebraic operations are (by default) \"unit-aware\", meaning that **pyam** tries to handle units correctly.\n", "This is implemented via the [iam-units](https://github.com/IAMconsortium/units) package,\n", "an extension of [pint](https://pint.readthedocs.io) package.\n", "\n", "The **pint** package natively handles conversion of standard (SI) units and commonly used equivalents \n", "(e.g., exajoule to terawatt-hours, *EJ -> TWh*), and it can parse combined units\n", "(e.g., exajoule per year, *EJ/yr*).\n", "To better support common use cases when working with energy systems analysis and integrated-assessment scenarios,\n", "the default [pint.UnitRegistry](https://pint.readthedocs.io/en/stable/developers_reference.html#pint.UnitRegistry)\n", "used by **pyam** uses the **iam-units** registry (see [IAMconsortium/units](https://github.com/IAMconsortium/units)),\n", "which extends the pint-defaults with a wide range of conversion factors commonly used in that domain.\n", "\n", "## Overview\n", "\n", "0. Import data from file and inspect the scenario\n", "1. A simple subtraction\n", "2. Multiplying timeseries data with scalars\n", "3. Calculating shares and dealing with units\n", "4. Overriding unit handling\n", "5. Working on other dimensions of timeseries data\n", "\n", "