diff --git a/saqc/core/register.py b/saqc/core/register.py index 39c1d4b14c0820f989e82672fecd1c9c9e4099c0..8cd859530713e679d5b0fdd43015ef2ce9bbbe69 100644 --- a/saqc/core/register.py +++ b/saqc/core/register.py @@ -238,7 +238,7 @@ def _maskData(data, flagger, columns, thresh) -> Tuple[dios.DictOfSeries, dios.D # we use numpy here because it is faster for c in columns: - col_mask = isflagged(flagger[c].to_numpy(), thresh) + col_mask = _isflagged(flagger[c].to_numpy(), thresh) if any(col_mask): col_data = data[c].to_numpy(dtype=np.float64) @@ -250,7 +250,7 @@ def _maskData(data, flagger, columns, thresh) -> Tuple[dios.DictOfSeries, dios.D return data, mask -def isflagged(flags: Union[np.array, pd.Series], thresh: float) -> Union[np.array, pd.Series]: +def _isflagged(flags: Union[np.array, pd.Series], thresh: float) -> Union[np.array, pd.Series]: """ Return a mask of flags accordingly to `thresh`. Return type is same as flags. """ diff --git a/saqc/funcs/interpolation.py b/saqc/funcs/interpolation.py index 5c9e8974f517c1ed556e91cb7b760583b9bf7711..a7880f4b0a067ca98b5e3d18c4975040fbdea0e8 100644 --- a/saqc/funcs/interpolation.py +++ b/saqc/funcs/interpolation.py @@ -10,7 +10,7 @@ import pandas as pd from dios import DictOfSeries from saqc.constants import * -from saqc.core.register import register, isflagged +from saqc.core.register import register, _isflagged from saqc.flagger import Flagger from saqc.flagger.history import applyFunctionOnHistory from saqc.lib.ts_operators import interpolateNANs @@ -248,7 +248,7 @@ def interpolateIndex( start, end = datcol.index[0].floor(freq), datcol.index[-1].ceil(freq) grid_index = pd.date_range(start=start, end=end, freq=freq, name=datcol.index.name) - flagged = isflagged(flagger[field], kwargs['to_mask']) + flagged = _isflagged(flagger[field], kwargs['to_mask']) # drop all points that hold no relevant grid information datcol = datcol[~flagged].dropna() diff --git a/saqc/funcs/resampling.py b/saqc/funcs/resampling.py index e64ec56f8cd46a58c1a7d5feee65079fbda30caa..0a796d726e440a544359a0f7ec084a0edf77c6f5 100644 --- a/saqc/funcs/resampling.py +++ b/saqc/funcs/resampling.py @@ -12,7 +12,7 @@ import pandas as pd from dios import DictOfSeries from saqc.constants import * -from saqc.core.register import register, isflagged +from saqc.core.register import register, _isflagged from saqc.flagger.history import applyFunctionOnHistory from saqc.flagger.flags import Flagger from saqc.funcs.tools import copy, drop, rename @@ -393,7 +393,7 @@ def _shift( -------- shift : Main caller, docstring """ - flagged = isflagged(flagger[field], kwargs['to_mask']) + flagged = _isflagged(flagger[field], kwargs['to_mask']) datcol = data[field] datcol[flagged] = np.nan freq = evalFreqStr(freq, freq_check, datcol.index) @@ -516,7 +516,7 @@ def resample( The flagger object, holding flags and additional Informations related to `data`. Flags values and shape may have changed relatively to the flagger input. """ - flagged = isflagged(flagger[field], kwargs['to_mask']) + flagged = _isflagged(flagger[field], kwargs['to_mask']) datcol = data[field] datcol[flagged] = np.nan freq = evalFreqStr(freq, freq_check, datcol.index) @@ -701,7 +701,7 @@ def reindexFlags( mask_kws = func_kws elif method[-5:] == "shift": - drop_mask = (target_datcol.isna() | isflagged(target_flagscol, kwargs['to_mask'])) + drop_mask = (target_datcol.isna() | _isflagged(target_flagscol, kwargs['to_mask'])) projection_method = METHOD2ARGS[method][0] tolerance = METHOD2ARGS[method][1](freq) func = _inverseShift