commonpower.data_forecasting.base.DataSource

class DataSource(frequency: timedelta = datetime.timedelta(seconds=3600))[source]

Bases: object

Data source. Data sources manage data for e.g. renewable power generation, demand, or market prices.

Parameters:

frequency (timedelta, optional) – Frequency of the data. Defaults to timedelta(hours=1).

Methods

get_date_range

Returns the date range data is available for.

get_limits

Returns the limits for each variable in the data source.

get_variables

Returns the list of element names that data is available for.

__call__(from_time: datetime, to_time: datetime) ndarray[source]

Return the data in this date range.

Parameters:
  • from_time (datetime) – Start time of observation.

  • to_time (datetime) – End time of observation.

Returns:

np.ndarray – Data of shape (n_horizon, n_vars).

get_date_range() List[datetime][source]

Returns the date range data is available for.

Returns:

List[datetime] – [start_date, end_date]

get_limits() dict[str, tuple[float, float]][source]

Returns the limits for each variable in the data source.

Returns:

dict[str, tuple[float, float]]

{“element1”: (lower_bound, upper_bound),

”element2”: (lower_bound, upper_bound)}

get_variables() List[str][source]

Returns the list of element names that data is available for.

Returns:

List[str] – List of available elements.