commonpower.data_forecasting.data_sources.ConstantDataSource
- class ConstantDataSource(values_dict: dict, date_range: List[datetime], frequency: timedelta = datetime.timedelta(seconds=3600))[source]
Bases:
DataSourceDummy DataSource which returns constant values.
- Parameters:
values_dict (dict) – Dict containing element names and the respective constant value that should be returned.
date_range (List[datetime]) – Date range to simulate.
frequency (timedelta, optional) – Frequency of data to simulate. Defaults to timedelta(hours=1).
Methods
Returns the date range data is available for.
Returns the limits for each variable in the data source.
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]