From 21a4f9b3aca9b75483431e92d0da3196961306b6 Mon Sep 17 00:00:00 2001 From: Peter Luenenschloss <peter.luenenschloss@ufz.de> Date: Tue, 25 Aug 2020 11:01:26 +0200 Subject: [PATCH] some formatting --- saqc/lib/tools.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/saqc/lib/tools.py b/saqc/lib/tools.py index f754114b3..9e9119750 100644 --- a/saqc/lib/tools.py +++ b/saqc/lib/tools.py @@ -285,14 +285,12 @@ def seasonalMask(dtindex, season_start, season_end, inclusive_selection): f"{index.minute[0]:02}", f"{index.second[0]:02}"][:-len(stamp_list)] final = index_list + stamp_list - # some hick-hack ahead, to account for the strange fact that not all the month are of same length in - # this world. + # need to account for different month's length: max_days = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) month_day = min(int(final[2]), max_days[int(index.month[0] - 1)]) return f"{final[0]}-{final[1]}-{month_day:02}T{final[3]}:{final[4]}:{final[5]}" - if pd.Timestamp(_composeStamp(dtindex, season_start)) <= pd.Timestamp(_composeStamp(dtindex, - season_end)): + if pd.Timestamp(_composeStamp(dtindex, season_start)) <= pd.Timestamp(_composeStamp(dtindex, season_end)): def _selector(x, start=season_start, end=season_end, base_bool=base_bool): x[_composeStamp(x.index, start):_composeStamp(x.index, end)] = not base_bool return x @@ -306,7 +304,6 @@ def seasonalMask(dtindex, season_start, season_end, inclusive_selection): return mask.groupby(pd.Grouper(freq=freq)).transform(_selector) - def assertDictOfSeries(df: Any, argname: str = "arg") -> None: if not isinstance(df, dios.DictOfSeries): raise TypeError(f"{argname} must be of type dios.DictOfSeries, {type(df)} was given") -- GitLab