Skip to content

[FEATURE] Set Default timeindex in edisgo.set_time_series_active_power_predefined #456

@khelfen

Description

@khelfen

Is your feature request related to a problem? Please describe.
Currently, when using edisgo.set_time_series_active_power_predefined, if the timeindex is None within an Edisgo.Timeseries object and is not explicitly provided, the module imports data for the default year of the database. However, since edisgo.set_time_series_active_power_predefined does not set the timeindex, the resulting Edisgo.Timeseries object remains empty. This can cause confusion and unexpected behavior for users. Currently there is only a warning if timeindex is empty, but this does not solve the problem automatically and could disrupt workflows.

Describe the solution you'd like
If Edisgo.Timeseries.timeindex is empty, it should automatically be set to the default year of the database before importing data. This ensures that the imported time series data is correctly linked to a valid timeindex, preventing an empty Edisgo.Timeseries object.

This could be done here:

eDisGo/edisgo/edisgo.py

Lines 559 to 566 in a0e83c9

if self.timeseries.timeindex.empty:
logger.warning(
"When setting time series using predefined profiles it is better to "
"set a time index as all data in TimeSeries class is indexed by the"
"time index. You can set the time index upon initialisation of "
"the EDisGo object by providing the input parameter 'timeindex' or by "
"using the function EDisGo.set_timeindex()."
)

Describe alternatives you've considered

  • Requiring users to explicitly set the timeindex before calling edisgo.set_time_series_active_power_predefined, but this adds an extra step that could be handled internally.

Additional context
This feature would improve the robustness of the module by preventing unexpected empty time series results. It would also align with the existing behavior of importing data for the default database year.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions