TimeAggregation

time.TimeAggregation(self, time_frame, selection, grouping, aggregation)

A kind of TimeStrategy describing a group-and-aggregate operation on a time frame, with an optional sub-selection.

Typically you will create one of these by calling methods on a TimeSelection or TimeGroup instance.

TimeAggregation is a frozen dataclass.

Parameters

time_frame: TimeFrame

The original simulation time frame.

selection: tuple[slice, int | None]

The selected subset of the time frame: described as a date slice and an optional tau step index.

grouping: TimeGrouping | None

A method for grouping the time series data.

aggregation: TimeAggMethod

A method for aggregating the time series data (if no grouping is specified, the time series is reduced to a scalar).

Attributes

time_frame: TimeFrame

The original time frame.

selection: tuple[slice, int | None]

The selected subset of the time frame: described as a date slice and an optional tau step index.

grouping: TimeGrouping | None

A method for grouping the time series data.

aggregation: TimeAggMethod

A method for aggregating the time series data (if no grouping is specified, the time series is reduced to a scalar).

group_format

What scale describes the result of the grouping? Are the group keys dates? Simulation ticks? Simulation days? Or some arbitrary other type?

date_bounds: tuple[date, date]

The bounds of the selection, given as the first and last date included.

Methods

Name Description
to_time_frame Creates a TimeFrame that has the same bounds as this TimeStrategy. NOTE: this does not mean the TimeFrame contains the same number of entries (group keys) as the result of applying this strategy – groups can skip days whereas TimeFrames are contiguous.
selection_ticks Converts this into a slice for which ticks are selected (by index).