TimeGrouping.map

time.TimeGrouping.map(dim, ticks, dates)

Produce a column that describes the group membership of each “row”, where each entry of ticks and dates describes a row of the time series. This column will be used as the basis of a groupby operation.

The result must correspond element-wise to the given ticks and dates arrays. dim contains dimensional info relevant to this grouping operation. Note that we may have sub-selected the geo and/or the time frame, so these dimensions may differ from those of the simulation as a whole.

ticks and dates will be nodes * days * tau_steps in length. Values will be in order, but each tick will be represented nodes times, and each date will be represented nodes * tau_steps times. Since we may be grouping a slice of the simulation time frame, ticks may start after 0 and end before the last tick of the simulation.

Parameters

dim: Dim

The simulation dimensions for time grouping.

ticks: NDArray[np.int64]

The series of simulation ticks.

dates: NDArray[np.datetime64]

The series of calendar dates corresponding to simulation ticks.

Returns

NDArray[GroupKeyType]

The group membership of each tick. For example, if the first three ticks were in group 0 and the next three ticks were in group 1, etc., the returned array would contain [0,0,0,1,1,1,...].