Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit ae7705e

Browse files
committed
Update docstring LiveTimeSlice
1 parent 2f339e7 commit ae7705e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ocf_datapipes/select/select_live_time_slice.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@ def __init__(
1919
history_duration: timedelta,
2020
dim_name: str = "time_utc",
2121
):
22+
"""
23+
Select the history for the live time slice
24+
25+
Args:
26+
source_datapipe: Datapipe emitting Xarray object
27+
t0_datapipe: Datapipe emitting t0 timestamps
28+
history_duration: Amount of time for the history
29+
dim_name: Time dimension name
30+
"""
2231
self.source_datapipe = source_datapipe
2332
self.t0_datapipe = t0_datapipe
2433
self.history_duration = np.timedelta64(history_duration)
2534
self.dim_name = dim_name
2635

2736
def __iter__(self):
37+
"""Select the recent live data"""
2838
for xr_data, t0 in Zipper(self.source_datapipe, self.t0_datapipe):
2939
xr_data = xr_data.sel({self.dim_name: slice(t0 - self.history_duration, t0)})
3040
yield xr_data

0 commit comments

Comments
 (0)