energy_analysis_toolbox.load_profiles.localization module#

Define Mixins to manage localized timeseries.

class energy_analysis_toolbox.timeseries.profiles.localization.LocalizedMeanProfile(period: str = 'D', *, is_max: bool = True, window: int = 1)[source]#

Bases: LocalizedProfileMixin, MeanProfile

Compute the mean profile with timezone data.

see MeanProfile

class energy_analysis_toolbox.timeseries.profiles.localization.LocalizedProfileMixin[source]#

Bases: object

A profile version where time-zoned data is managed, including DSTs.

The compute method of the profile class with which this mixin is combined is overloaded in such a way that passing time-localized data is possible. On and across DSTs, the data remains aligned “on the clock” (VS on the sun).

compute(history: DataFrame, time: Timestamp, **kwargs) DataFrame[source]#

Compute the profile at time from the history.

The computation is managed as follows :

  • just fall back to the parent compute method in case the data is time-naive.

  • Else, unlocalize the history and target date before passing them to the parent class’ compute such that the data remains aligned based on “local time” for each day.

  • Relocalize the resulting profile to the history timezone. This part takes care of DST days :

    • In case the target date is summer DST (23h long day) the extra profile hours is just dumped.

    • In case the target date is winter DST(25h long day), the data for the 2am to 3am period is associated with the first occurrence of this time-of-day and a gap is let on the second.

Warning

If winter DST is included in the history, the timestamps from 2am to 3am on this day appears “twice” in the time-naive history passed to the aggregation. Therefore, the aggregation should be robust to this situation.

class energy_analysis_toolbox.timeseries.profiles.localization.LocalizedRollingProfile(window: int | str | Timedelta, aggregation: Callable[[ndarray], float], as_mean_offset: bool | None = None, offset_factor: float = 1.0, column_name: str | int = 'value')[source]#

Bases: LocalizedProfileMixin, RollingProfile

Compute a rolling profile with timezone data.

see RollingProfile

class energy_analysis_toolbox.timeseries.profiles.localization.LocalizedRollingQuantileProfile(window: int | str | Timedelta, threshold_quantile: float, as_mean_offset: bool | None = None, offset_factor: float = 1.0, column_name: str | int = 'value')[source]#

Bases: LocalizedProfileMixin, RollingQuantileProfile

Compute a rolling quantile with timezone data.

see RollingQuantProfile