bulum.stoch.generate module

Generate stochastic data.

from_pattern(dates: list[datetime], daily_pattern=None, monthly_pattern=None, annual_pattern=None)

Generate a list of daily values from either a daily, monthly, or annual pattern.

The behaviour depends on what type of pattern is supplied. - Annual pattern =>

  • annual totals are disaggregated to daily by dividing by 365 or 366 as appropriate.

  • Monthly pattern =>
    • if 1 value is provided, it is used for every month and disaggregated to daily by dividing by the days in the month;

    • if 12 values are provided, each month has its own total and which is disaggregated to daily by dividing by the days in the month.

  • Daily pattern =>
    • if 1 value is provided, it is used for every day;

    • if 7 values are provided, they are taken to represent a week and are repeated accordingly;

    • if 366 values are provided, they will be taken to represent days in the calendar year and the last value ignored in non-leap-years.

Annual patterns are preferred to monthly are preferred to daily. Default behaviour is to fill with 1.

Parameters:
  • dates (list of datetime)

  • daily_pattern (list of float, optional) – Defaults to [1].

  • monthly_pattern (list of float, optional) – Defaults to [].

  • annual_pattern (list of float, optional) – Defaults to [].

Raises:

ValueError – Invalid number of arguments provided for pattern

Returns:

Disaggregated pattern as daily values.

Return type:

list of float