Skip to content

Fix freq y closed to both#3

Open
semvijverberg wants to merge 19 commits intomainfrom
fix_freq_y_closed_to_both
Open

Fix freq y closed to both#3
semvijverberg wants to merge 19 commits intomainfrom
fix_freq_y_closed_to_both

Conversation

@semvijverberg
Copy link
Copy Markdown

@semvijverberg semvijverberg commented Feb 26, 2024

Close pandas interval on both sides. Needed to get this working for yield data. In general this is a more robust solution.

Comment on lines +495 to +496
# adaptation now that intervals are defined as closed="both".
while self._map_year(min_year).iloc[-1].right < self._first_timestamp:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core adaptation to closed on both sides here.

Comment on lines 378 to +393
for block in list_periods:
left_date += block.gap_dateoffset
right_date = left_date + block.length_dateoffset
intervals.append(pd.Interval(left_date, right_date, closed="left"))
right_date = left_date + block.length_dateoffset - pd.Timedelta(days=1)
intervals.append(pd.Interval(left_date, right_date, closed="both"))
# update left date
left_date = right_date
left_date = right_date + pd.Timedelta(days=1)
else:
# build from right to left
right_date = self._get_anchor(year)
right_date = self._get_anchor(year) - pd.Timedelta(days=1)
# loop through all the building blocks to
for block in list_periods:
right_date -= block.gap_dateoffset
left_date = right_date - block.length_dateoffset
intervals.append(pd.Interval(left_date, right_date, closed="left"))
left_date = right_date - block.length_dateoffset + pd.Timedelta(days=1)
intervals.append(pd.Interval(left_date, right_date, closed="both"))
# update right date
right_date = left_date
right_date = left_date - pd.Timedelta(days=1)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core adaptation to closed on both sides here.

…ily_data-check-fails-datasize-is-2-copy-lilio-adaptation

small bug fix for xarray with time.size < 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants