Commit 7a07b57f authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

WIP: complete refactoring of stratification application.

parent b149fe6a
......@@ -26,16 +26,15 @@ def get_period_intervals(date_file, md=[1, 1], duration=365):
except:
continue
delta = dates[-1] - dates[-2]
dates.append(dates[-1] + delta)
periods = []
s, e = 0, 0
S = 0
while s is not None and e is not None:
s = find_first_month_day(dates, md[0], md[1])
if s is not None:
e = find_next_date(dates, dates[s] + datetime.timedelta(days=duration))
e = find_next_date(dates, dates[s] + datetime.timedelta(days=duration) - delta)
if e is not None:
periods.append((S + s, S + e))
periods.append((S + s, S + e + 1))
S += s + 1
dates = dates[s + 1:]
return periods
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment