def _get_t_max_demand(self):
        t_max_demands = utils.AttrDict()
        for c in self.data._c:
            ys = [y for y in self.data._y
                  if self.get_option(y + '.carrier') == c]
            # r_carrier is summed up over all techs ys and all locations (dim_1)
            r_carrier = (xr.Dataset(self.data.r.as_dict())[ys]
                           .sum(dim='dim_1').to_dataframe())
            t_max_demand = r_carrier[r_carrier < 0].sum(axis=1).idxmin()
            # Adjust for reduced resolution, only if t_max_demand not 0 anyway
            if t_max_demand != 0:
                t_max_demand = max([t for t in self.data._dt.index
                                    if t <= t_max_demand])
            t_max_demands[c] = t_max_demand
        return t_max_demands
Return timestep index with maximum demand
dataset/ETHPy150Open calliope-project/calliope/calliope/core.py/Model._get_t_max_demand