From b7297e41b7b8c5fc245090835d2ecba83a97a1b3 Mon Sep 17 00:00:00 2001 From: Bert Palm <bert.palm@ufz.de> Date: Fri, 13 Aug 2021 15:19:05 +0200 Subject: [PATCH] fixed core signatures again --- saqc/__init__.py | 2 +- saqc/core/modules/changepoints.py | 4 ++-- saqc/core/modules/flagtools.py | 2 +- saqc/core/modules/generic.py | 8 +++++--- saqc/core/modules/noise.py | 5 +++-- saqc/core/modules/pattern.py | 16 ++-------------- saqc/core/modules/resampling.py | 5 ++--- saqc/core/modules/rolling.py | 2 +- 8 files changed, 17 insertions(+), 27 deletions(-) diff --git a/saqc/__init__.py b/saqc/__init__.py index 4cdea6565..9ca423c8f 100644 --- a/saqc/__init__.py +++ b/saqc/__init__.py @@ -9,8 +9,8 @@ from saqc.core import ( flagging, initFlagsLike, Flags, - SaQC, FloatTranslator, DmpTranslator, PositionalTranslator, + SaQC, ) diff --git a/saqc/core/modules/changepoints.py b/saqc/core/modules/changepoints.py index bd17c93c9..09f692c37 100644 --- a/saqc/core/modules/changepoints.py +++ b/saqc/core/modules/changepoints.py @@ -28,7 +28,7 @@ class ChangePoints(ModuleBase): reduce_window: FreqString = None, reduce_func: Callable[[np.ndarray, np.ndarray], int] = lambda x, _: x.argmax(), flag: float = BAD, - **kwargs + **kwargs, ) -> saqc.SaQC: return self.defer("flagChangePoints", locals()) @@ -51,6 +51,6 @@ class ChangePoints(ModuleBase): flag_changepoints: bool = False, assign_cluster: bool = True, flag: float = BAD, - **kwargs + **kwargs, ) -> saqc.SaQC: return self.defer("assignChangePointCluster", locals()) diff --git a/saqc/core/modules/flagtools.py b/saqc/core/modules/flagtools.py index 0822d51d0..4f1a03cea 100644 --- a/saqc/core/modules/flagtools.py +++ b/saqc/core/modules/flagtools.py @@ -36,6 +36,6 @@ class FlagTools(ModuleBase): mflag: Any = 1, method: Literal["plain", "ontime", "left-open", "right-open"] = "plain", flag: float = BAD, - **kwargs + **kwargs, ) -> saqc.SaQC: return self.defer("flagManual", locals()) diff --git a/saqc/core/modules/generic.py b/saqc/core/modules/generic.py index 27f63a6a5..990d19804 100644 --- a/saqc/core/modules/generic.py +++ b/saqc/core/modules/generic.py @@ -7,7 +7,7 @@ from typing import Callable import numpy as np import pandas as pd -from saqc.constants import BAD +from saqc.constants import UNFLAGGED, BAD from saqc.core.modules.base import ModuleBase import saqc @@ -18,7 +18,8 @@ class Generic(ModuleBase): field: str, func: Callable[[pd.Series], pd.Series], nodata: float = np.nan, - **kwargs + to_mask: float = UNFLAGGED, + **kwargs, ) -> saqc.SaQC: return self.defer("process", locals()) @@ -28,6 +29,7 @@ class Generic(ModuleBase): func: Callable[[pd.Series], pd.Series], nodata: float = np.nan, flag: float = BAD, - **kwargs + to_mask: float = UNFLAGGED, + **kwargs, ) -> saqc.SaQC: return self.defer("flag", locals()) diff --git a/saqc/core/modules/noise.py b/saqc/core/modules/noise.py index 7f7685de3..62bdd0007 100644 --- a/saqc/core/modules/noise.py +++ b/saqc/core/modules/noise.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- from __future__ import annotations -import numpy +import numpy as np import pandas as pd from typing import Callable @@ -17,12 +17,13 @@ class Noise(ModuleBase): def flagByStatLowPass( self, field: ColumnName, - stat: Callable[[numpy.array, pd.Series], float], + stat: Callable[[np.array, pd.Series], float], winsz: FreqString, thresh: PositiveFloat, sub_winsz: FreqString = None, sub_thresh: PositiveFloat = None, min_periods: PositiveInt = None, flag: float = BAD, + **kwargs ) -> saqc.SaQC: return self.defer("flagByStatLowPass", locals()) diff --git a/saqc/core/modules/pattern.py b/saqc/core/modules/pattern.py index 5f1ffd07a..ace5d429f 100644 --- a/saqc/core/modules/pattern.py +++ b/saqc/core/modules/pattern.py @@ -11,23 +11,11 @@ import saqc class Pattern(ModuleBase): def flagPatternByDTW( - self, - field: str, - ref_field: str, - max_distance: float = 0.0, - normalize=True, - flag: float = BAD, - **kwargs + self, field, ref_field, max_distance=0.0, normalize=True, flag=BAD, **kwargs ) -> saqc.SaQC: return self.defer("flagPatternByDTW", locals()) def flagPatternByWavelet( - self, - field: str, - ref_field: str, - widths: Sequence[int] = (1, 2, 4, 8), - waveform: str = "mexh", - flag: float = BAD, - **kwargs + self, field, ref_field, widths=(1, 2, 4, 8), waveform="mexh", flag=BAD, **kwargs ) -> saqc.SaQC: return self.defer("flagPatternByWavelet", locals()) diff --git a/saqc/core/modules/resampling.py b/saqc/core/modules/resampling.py index 8bb6911b4..eedaee724 100644 --- a/saqc/core/modules/resampling.py +++ b/saqc/core/modules/resampling.py @@ -33,9 +33,7 @@ class Resampling(ModuleBase): field: str, freq: str, method: Literal["fshift", "bshift", "nshift"] = "nshift", - freq_check: Optional[ - Literal["check", "auto"] - ] = None, # TODO: not a user decision + freq_check: Optional[Literal["check", "auto"]] = None, **kwargs, ) -> saqc.SaQC: return self.defer("shift", locals()) @@ -66,6 +64,7 @@ class Resampling(ModuleBase): "inverse_fshift", "inverse_bshift", "inverse_nshift", + "inverse_interpolation", ], source: str, freq: Optional[str] = None, diff --git a/saqc/core/modules/rolling.py b/saqc/core/modules/rolling.py index 89df03cda..daa0fdba6 100644 --- a/saqc/core/modules/rolling.py +++ b/saqc/core/modules/rolling.py @@ -6,7 +6,7 @@ from typing import Union, Callable import numpy as np import pandas as pd -from saqc.constants import * +from saqc.constants import BAD from saqc.core.modules.base import ModuleBase import saqc -- GitLab