From fc1d8818f7f7efcfc416a1a427cf2d870fbb4c3d Mon Sep 17 00:00:00 2001 From: luenensc <peter.luenenschloss@ufz.de> Date: Tue, 17 Jan 2023 20:51:10 +0100 Subject: [PATCH] black/isort --- saqc/funcs/interpolation.py | 2 +- saqc/lib/ts_operators.py | 3 ++- tests/lib/test_ts_operators.py | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/saqc/funcs/interpolation.py b/saqc/funcs/interpolation.py index 97a4c2a6b..d4b16bbd1 100644 --- a/saqc/funcs/interpolation.py +++ b/saqc/funcs/interpolation.py @@ -213,7 +213,7 @@ class InterpolationMixin: method: _SUPPORTED_METHODS, order: int = 2, limit: int | None = 2, - extrapolate: Literal['forward', 'backward', 'both'] = None, + extrapolate: Literal["forward", "backward", "both"] = None, **kwargs, ) -> "SaQC": """ diff --git a/saqc/lib/ts_operators.py b/saqc/lib/ts_operators.py index 3615ce644..0c5533ec0 100644 --- a/saqc/lib/ts_operators.py +++ b/saqc/lib/ts_operators.py @@ -21,6 +21,7 @@ import pandas as pd from scipy.signal import butter, filtfilt from scipy.stats import iqr, median_abs_deviation from sklearn.neighbors import NearestNeighbors + from saqc.lib.tools import getFreqDelta @@ -351,7 +352,7 @@ def interpolateNANs(data, method, order=2, gap_limit=2, extrapolate=None): # correction for initial gap if isinstance(gap_limit, int): - gap_mask.iloc[:gap_limit]=True + gap_mask.iloc[:gap_limit] = True if gap_limit == 2: # for the common case of gap_limit=2 (default "harmonisation"), we efficiently back propagate the False diff --git a/tests/lib/test_ts_operators.py b/tests/lib/test_ts_operators.py index 63711f468..c7288ce2e 100644 --- a/tests/lib/test_ts_operators.py +++ b/tests/lib/test_ts_operators.py @@ -208,7 +208,7 @@ def test_rateOfChange(data, expected): ), ( 2, - 'backward', + "backward", [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], [0, 0, np.nan, np.nan, np.nan, 4, np.nan], ), @@ -226,7 +226,7 @@ def test_rateOfChange(data, expected): ), ( 3, - 'forward', + "forward", [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], [np.nan, 0, np.nan, np.nan, np.nan, 4, 4], ), @@ -238,7 +238,7 @@ def test_rateOfChange(data, expected): ), ( 4, - 'both', + "both", [np.nan, 0, np.nan, np.nan, np.nan, 4, np.nan], [np.nan, 0, 1, 2, 3, 4, np.nan], ), @@ -251,8 +251,10 @@ def test_rateOfChange(data, expected): ], ) def test_interpolatNANs(limit, extrapolate, data, expected): - got = interpolateNANs(pd.Series(data), gap_limit=limit, method="linear", extrapolate=extrapolate) + got = interpolateNANs( + pd.Series(data), gap_limit=limit, method="linear", extrapolate=extrapolate + ) try: assert got.equals(pd.Series(expected, dtype=float)) except AssertionError: - print('stop') \ No newline at end of file + print("stop") -- GitLab