-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
onset move daylight saving check to a checks module, add ambiguous in…
…put and timezone to both xlsx and csv outputs
- Loading branch information
1 parent
6347627
commit c73550f
Showing
2 changed files
with
51 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pandas as pd | ||
from loguru import logger | ||
|
||
def check_daylight_saving(time:pd.Series) -> bool: | ||
|
||
# Test daylight saving issue | ||
dt = time.diff() | ||
sampling_interval = dt.median() | ||
dst_fall = -pd.Timedelta("1h") + sampling_interval | ||
dst_spring = pd.Timedelta("1h") + sampling_interval | ||
has_issue = False | ||
if any(dt == dst_fall): | ||
logger.warning( | ||
( | ||
"Time gaps (=%s) for sampling interval of %s " | ||
"suggest a Fall daylight saving issue is present" | ||
), | ||
dst_fall, | ||
sampling_interval, | ||
) | ||
has_issue = True | ||
|
||
if any(dt == dst_spring): | ||
logger.warning( | ||
( | ||
"Time gaps (=%s) for sampling interval of %s " | ||
"suggest a Spring daylight saving issue is present" | ||
), | ||
dst_fall, | ||
sampling_interval, | ||
) | ||
has_issue = True | ||
return has_issue |
This file contains 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