Skip to content

Commit

Permalink
only account for dropout in find_contiguous_t0_periods_nwp after firs…
Browse files Browse the repository at this point in the history
…t dt_init
  • Loading branch information
AUdaltsova authored Aug 12, 2024
1 parent afd83fc commit f84c9c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ocf_data_sampler/select/find_contiguous_t0_time_periods.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ def find_contiguous_t0_periods_nwp(

for dt_init in datetimes[1:]:
# If the previous init time becomes stale before the next init becomes valid whilst also
# considering dropout and the need for a historic period - then the contiguous period breaks
if end_this_period < dt_init + hist_drop_buffer:
# considering dropout - then the contiguous period breaks
if end_this_period < dt_init + max_dropout:
contiguous_periods += [[start_this_period, end_this_period]]

# And start a new period
start_this_period = dt_init + hist_drop_buffer
start_this_period = dt_init + max_dropout
end_this_period = dt_init + max_staleness

contiguous_periods += [[start_this_period, end_this_period]]
Expand Down Expand Up @@ -278,4 +278,4 @@ def intersection_of_2_dataframes_of_periods(a: pd.DataFrame, b: pd.DataFrame) ->
all_intersecting_periods.append(intersection)

all_intersecting_periods = pd.concat(all_intersecting_periods)
return all_intersecting_periods.sort_values(by="start_dt").reset_index(drop=True)
return all_intersecting_periods.sort_values(by="start_dt").reset_index(drop=True)

0 comments on commit f84c9c0

Please sign in to comment.