# Path: calliope/time/funcs.py
# def get_daily_timesteps(data, check_uniformity=False):
# def normalized_copy(data):
# def _copy_non_t_vars(data0, data1):
# def _combine_datasets(data0, data1):
# def _drop_timestep_vars(data, timesteps):
# def apply_clustering(
#     data,
#     timesteps,
#     clustering_func,
#     how,
#     normalize=True,
#     scale_clusters="mean",
#     storage_inter_cluster=True,
#     model_run=None,
#     **kwargs,
# ):
# def resample(data, timesteps, resolution):
#     def _resample(var, how):
# def drop(data, timesteps):
# def lookup_clusters(dataset):
# 
# Path: calliope/exceptions.py
# def _formatwarning(message, category, filename, lineno, line=None):
# def warn(message, _class=ModelWarning):
# def print_warnings_and_raise_errors(warnings=None, errors=None):
# class ModelError(Exception):
# class BackendError(Exception):
# class ModelWarning(Warning):
# class BackendWarning(Warning):


import pandas as pd
from calliope.time import funcs
from calliope import exceptions
    data : xarray.Dataset
    tech : str
        Technology whose `var` to find extreme for.
    var : str, optional
        default 'resource'
    how : str, optional
        'max' (default) or 'min'.
    length : str, optional
        Defaults to '1D'.
    n : int, optional
        Number of periods of `length` to look for, default is 1.
    groupby_length : str, optional
        Group time series and return `n` periods of `length`
        for each group.
    padding : str, optional
        Either Pandas frequency (e.g. '1D') or 'calendar_week'.
        If Pandas frequency, symmetric padding is undertaken, either side of `length`
        If 'calendar_week', padding is fit to the calendar week in which the
        extreme day(s) are found.
    normalize : bool, optional
        If True (default), data is normalized
        using :func:`~calliope.time.funcs.normalized_copy`.
    kwargs : dict, optional
        Dimensions of the selected var over which to index. Any remaining
        dimensions will be flattened by mean

    """
    if normalize:
        # Only normalise the desired var as rest of data may contain
        # non-numeric variables!

# Path: calliope/time/funcs.py
# def get_daily_timesteps(data, check_uniformity=False):
# def normalized_copy(data):
# def _copy_non_t_vars(data0, data1):
# def _combine_datasets(data0, data1):
# def _drop_timestep_vars(data, timesteps):
# def apply_clustering(
#     data,
#     timesteps,
#     clustering_func,
#     how,
#     normalize=True,
#     scale_clusters="mean",
#     storage_inter_cluster=True,
#     model_run=None,
#     **kwargs,
# ):
# def resample(data, timesteps, resolution):
#     def _resample(var, how):
# def drop(data, timesteps):
# def lookup_clusters(dataset):
# 
# Path: calliope/exceptions.py
# def _formatwarning(message, category, filename, lineno, line=None):
# def warn(message, _class=ModelWarning):
# def print_warnings_and_raise_errors(warnings=None, errors=None):
# class ModelError(Exception):
# class BackendError(Exception):
# class ModelWarning(Warning):
# class BackendWarning(Warning):


# Path: calliope/time/masks.py
import pandas as pd
from calliope.time import funcs
from calliope import exceptions

    data : xarray.Dataset
    tech : str
        Technology whose `var` to find extreme for.
    var : str, optional
        default 'resource'
    how : str, optional
        'max' (default) or 'min'.
    length : str, optional
        Defaults to '1D'.
    n : int, optional
        Number of periods of `length` to look for, default is 1.
    groupby_length : str, optional
        Group time series and return `n` periods of `length`
        for each group.
    padding : str, optional
        Either Pandas frequency (e.g. '1D') or 'calendar_week'.
        If Pandas frequency, symmetric padding is undertaken, either side of `length`
        If 'calendar_week', padding is fit to the calendar week in which the
        extreme day(s) are found.
    normalize : bool, optional
        If True (default), data is normalized
        using :func:`~calliope.time.funcs.normalized_copy`.
    kwargs : dict, optional
        Dimensions of the selected var over which to index. Any remaining
        dimensions will be flattened by mean

    """
    if normalize:
        # Only normalise the desired var as rest of data may contain
        # non-numeric variables!

        data_n = funcs.normalized_copy(data[var].to_dataset(name=var))