Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 1667072

Browse files
committed
sketched out DataSource.get_contiguous_time_periods() #223
1 parent 833323d commit 1667072

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

nowcasting_dataset/data_sources/data_source.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def datetime_index(self) -> pd.DatetimeIndex:
136136
# of a list of datetimes (e.g. for DatetimeDataSource).
137137
raise NotImplementedError()
138138

139+
# TODO: Remove this function (and any tests) after get_contiguous_time_periods() is implemented.
139140
def get_t0_datetimes(self) -> pd.DatetimeIndex:
140141
"""Get all the valid t0 datetimes.
141142
@@ -158,6 +159,22 @@ def get_t0_datetimes(self) -> pd.DatetimeIndex:
158159
max_gap=self.sample_period_dur,
159160
)
160161

162+
def get_contiguous_time_periods(self) -> pd.DataFrame:
163+
"""Get all the time periods for which this DataSource has contiguous data.
164+
165+
Optionally filter out any time periods which don't make sense for this DataSource,
166+
e.g. remove nighttime.
167+
168+
Returns:
169+
pd.DataFrame where each row represents a single time period. The pd.DataFrame
170+
has two columns: `start_dt` and `end_dt` (where 'dt' is short for 'datetime').
171+
"""
172+
173+
# TODO:
174+
# Modify nd_time.get_start_datetimes so that it returns the segment boundaries
175+
# as a pd.DataFrame?
176+
raise NotImplementedError()
177+
161178
def _get_time_slice(self, t0_dt: pd.Timestamp):
162179
"""Get a single timestep of data. Must be overridden."""
163180
raise NotImplementedError()

0 commit comments

Comments
 (0)