Time projectors API

Time projectors

The classes in this module are used to infer values for a scenario at later times given the trends before that time.

Extend latest time quantile

Module for the database cruncher which uses the ‘latest time quantile’ technique.

class silicone.time_projectors.extend_latest_time_quantile.ExtendLatestTimeQuantile(db)[source]

Bases: object

Time projector which extends the timeseries of a variable by assuming that it remains that a fixed quantile in the infiller database, the quantile it is in at the last available time. This is the natural counterpart to the equal quantile walk extending a single variable over time rather than over different emissions.

It assumes that the target timeseries is shorter than the infiller timeseries.

derive_relationship(variable, smoothing=None, weighting=None)[source]

Derives the quantiles of the variable in the infiller database. Note that this takes only one variable as an argument, whereas most crunchers take two.

Parameters
  • variable (str) – The variable for which we want to calculate timeseries (e.g. "Emissions|CO2").

  • smoothing (float or string) – By default, no smoothing is done on the distribution. If a value is provided, it is fed into scipy.stats.gaussian_kde() - see full documentation there. In short, if a float is input, we fit a Gaussian kernel density estimator with that width to the points. If a string is used, it must be either “scott” or “silverman”, after those two methods of determining the best kernel bandwidth.

  • weighting (None or dict{(str, str): float}) – The dictionary, mapping the (model and scenario) tuple onto the weight ( relative to a weight of 1 for the default). This does not have to include all scenarios in df, but cannot include scenarios not in df.

Returns

Function which takes a pyam.IamDataFrame containing variable timeseries and returns these timeseries extended until the latest time in the infiller database.

Return type

func

Raises

ValueError – There is no data for variable in the database.

Extend RMS closest

Module for the database cruncher that uses the rms closest extension method

class silicone.time_projectors.extend_rms_closest.ExtendRMSClosest(db)[source]

Bases: object

Time projector which extends the timeseries of a variable with future timesteps infilled using the values from the ‘closest’ pathway in the infilling database.

We define the closest pathway as the pathway with the smallest time-averaged (over the reported time steps) root mean squared difference

derive_relationship(variable)[source]

Derives the values for the model/scenario combination in the database with the least RMS error.

Parameters

variable (str) – The variable for which we want to calculate the timeseries (e.g. Emissions|CO2).

Returns

Filled in data (without original source data)

Return type

obj: pyam.IamDataFrame

Linear extender

Module for the database cruncher which extends using a linear trend

class silicone.time_projectors.linear_extender.LinearExtender(db=None)[source]

Bases: object

Time projector which extends the timeseries of a variable using a linear trend. You can either specify a gradient for the line (possibly zero) or a point in the future.

derive_relationship(variable, gradient=None, year_value=None, times=None)[source]

Derives the function to return a linear trend following from the last datapoint

Parameters
  • variable (str) – The variable for which we want to calculate timeseries (e.g. "Emissions|CO2").

  • gradient (float or None) – The gradient of the variable after its last available datapoint, in the emissions units per year. If not provided, year_value must be provided instead.

  • year_value (None or tuple(int or datetime, float)) – The value of the variable at a given future time, e.g. (2050, 0) to extend the data to net zero in 2050. If not provided, gradient must be provided instead.

  • times (None or list[int or datetime]) – The times to return entries at. Only required if no database was used during initalisation.

Returns

Function which takes a pyam.IamDataFrame containing variable timeseries and returns these timeseries extended until the latest time in the infiller database.

Return type

func

Raises

ValueError – There is no data for variable in the database.