forked from AI4S2S/lilio
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix freq y closed to both #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
semvijverberg
wants to merge
19
commits into
main
Choose a base branch
from
fix_freq_y_closed_to_both
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d2f912d
linux gave error because of differently inferred data_freq string
semvijverberg 417223d
Fixing pandas version to be below 2.2
semvijverberg f9cde74
fixe for new data_freq formatting (ME and MS) and hack for allowing y…
semvijverberg 41272a4
np.timedelta64 has no length, hence, fix now within if statement
semvijverberg 6b43b9b
yearly data works, but intervals now overlapping with closed==both
semvijverberg 3c1b12d
attempt to get old behavior with closed=both
semvijverberg efa1fd4
fix that precursor intervals are equal with closed=both
semvijverberg d8e8d17
Edge case when data has only 1 datapoint and timestamp
semvijverberg 86b1e98
Fix for when data.size < 3, infer_freq will crash in that case
semvijverberg c97e3e3
fixed tests
320ff22
Merge branch 'main' into fix_freq_y_closed_to_both
pimmeerdink b42b11e
adapt docstrings
d9b7f6c
merge
50a2643
fix some linting
bb4c031
real lint
7a9aa78
update docstring tests
58c316b
fix ds tests
0246989
small bug fix for xarray with time.size < 3
semvijverberg 9e3d59a
Merge pull request #4 from Beyond-Weather-Git/semvijverberg/be-182-da…
semvijverberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| """Calendar plotting implementations (bokeh specific code).""" | ||
|
|
||
| import sys | ||
| import typing | ||
| import numpy as np | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| """Lilio's main Calendar module.""" | ||
|
|
||
| import copy | ||
| import re | ||
| import warnings | ||
|
|
@@ -376,20 +377,20 @@ def _concatenate_periods(self, year, list_periods, is_target): | |
| # loop through all the building blocks to | ||
| 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) | ||
|
|
||
| return intervals | ||
|
|
||
|
|
@@ -491,7 +492,8 @@ def _set_year_range_from_timestamps(self): | |
| if self._map_year(max_year).iloc[0].right > self._last_timestamp: | ||
| max_year -= 1 | ||
| # first date check | ||
| while self._map_year(min_year).iloc[-1].right <= self._first_timestamp: | ||
| # adaptation now that intervals are defined as closed="both". | ||
| while self._map_year(min_year).iloc[-1].right < self._first_timestamp: | ||
|
Comment on lines
+495
to
+496
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. core adaptation to closed on both sides here. |
||
| min_year += 1 | ||
|
|
||
| # map year(s) and generate year realized advent calendar | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| """Calendar shifter to create staggered calendars.""" | ||
|
|
||
| import copy | ||
| from typing import Union | ||
| import xarray as xr | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.