Derived timeseries data

class pyam.compute.IamComputeAccessor(df)[source]

Perform computations on the timeseries data of an IamDataFrame

An IamDataFrame has a module for computation of (advanced) indicators from the timeseries data.

The methods in this module can be accessed via

IamDataFrame.compute.<method>(*args, **kwargs)

Methods

bias(name, method, axis)

Compute the bias weights and add to 'meta'

growth_rate(mapping[, append])

Compute the annualized growth rate of a timeseries along the time dimension

learning_rate(name, performance, experience)

Compute the implicit learning rate from timeseries data

quantiles(quantiles[, weights, level, append])

Compute the optionally weighted quantiles of data grouped by level.

bias(name, method, axis)[source]

Compute the bias weights and add to ‘meta’

Parameters:
namestr

Column name in the ‘meta’ dataframe

methodstr

Method to compute the bias weights, see the notes

axisstr

Index dimensions on which to apply the method

Notes

The following methods are implemented:

  • “count”: use the inverse of the number of scenarios grouped by axis names.

    Using the following method on an IamDataFrame with three scenarios

    df.compute.bias(name="bias-weight", method="count", axis="scenario")
    

    results in the following column to be added to df.meta:

    model

    scenario

    bias-weight

    model_a

    scen_a

    0.5

    model_a

    scen_b

    1

    model_b

    scen_a

    0.5

growth_rate(mapping, append=False)[source]

Compute the annualized growth rate of a timeseries along the time dimension

The growth rate parameter in period t is computed based on the changes to the subsequent period, i.e., from period t to period t+1.

Parameters:
mappingdict

Mapping of variable item(s) to the name(s) of the computed data, e.g.,

{"variable": "name of growth-rate variable", ...}
appendbool, optional

Whether to append computed timeseries data to this instance.

Returns:
IamDataFrame or None

Computed timeseries data or None if append=True.

Raises:
ValueError

Math domain error when timeseries crosses 0.

learning_rate(name, performance, experience, append=False)[source]

Compute the implicit learning rate from timeseries data

Experience curves are based on the concept that a technology’s performance improves as experience with this technology grows.

The “learning rate” indicates the performance improvement (e.g., cost reduction) for each doubling of the accumulated experience (e.g., cumulative capacity).

The experience curve parameter b is equivalent to the (linear) slope when plotting performance and experience timeseries on double-logarithmic scales. The learning rate can be computed from the experience curve parameter as \(1 - 2^{b}\).

The learning rate parameter in period t is computed based on the changes to the subsequent period, i.e., from period t to period t+1.

Parameters:
namestr

Variable name of the computed timeseries data.

performancestr

Variable of the “performance” timeseries (e.g., specific investment costs).

experiencestr

Variable of the “experience” timeseries (e.g., installed capacity).

appendbool, optional

Whether to append computed timeseries data to this instance.

Returns:
IamDataFrame or None

Computed timeseries data or None if append=True.

quantiles(quantiles, weights=None, level=['model', 'scenario'], append=False)[source]

Compute the optionally weighted quantiles of data grouped by level.

For example, the following will provide the interquartile range and median value of CO2 emissions across all models and scenarios in a given dataset:

df.filter(variable="Emissions|CO2").compute.quantiles([0.25, 0.5, 0.75])
Parameters:
quantilescollection

Group of quantile values to compute

weightspd.Series, optional

Series indexed by level

levelcollection, optional

The index columns to compute quantiles over

appendbool, optional

Whether to append computed timeseries data to this instance.

Returns:
IamDataFrame or None

Computed data or None if append=True.

Raises:
ValueError

If more than one variable provided or if argument weights is malformed.