Skip to content
Snippets Groups Projects
Commit 02dd7f3c authored by Peter Lünenschloß's avatar Peter Lünenschloß
Browse files

tired

parent 66f9a340
No related branches found
No related tags found
3 merge requests!271Static expansion of regular expressions,!260Follow-Up Translations,!237Flagger Translations
......@@ -151,8 +151,7 @@ def interpolateInvalid(
method,
order=inter_order,
inter_limit=inter_limit,
downgrade_interpolation=downgrade_interpolation,
return_chunk_bounds=False,
downgrade_interpolation=downgrade_interpolation
)
interpolated = data[field].isna() & inter_data.notna()
......@@ -168,12 +167,13 @@ def interpolateInvalid(
def _overlap_rs(x, freq='1min', fill_value=-np.inf):
end = x.index[-1].ceil(freq)
x = x.resample(freq).max()
x = x.combine(x.shift(1, fill_value=fill_value), max)
# we are appending last regular grid entry (if necessary), to conserve integrity of groups of regularized
# timestamps originating all from the same logger.
try:
x = x.append(pd.Series([-np.inf], index=[x.index[-1].ceil(freq)]), verify_integrity=True)
x = x.append(pd.Series([-np.inf], index=[end]), verify_integrity=True)
except ValueError:
pass
return x
......@@ -293,8 +293,8 @@ def interpolateIndex(
flagger = applyFunctionOnHistory(
flagger,
field,
hist_func=_overlap_rs, hist_kws=dict(fill_value=UNFLAGGED),
mask_func=_overlap_rs, mask_kws=dict(fill_value=False),
hist_func=_overlap_rs, hist_kws=dict(freq=freq, fill_value=UNFLAGGED),
mask_func=_overlap_rs, mask_kws=dict(freq=freq, fill_value=False),
last_column=flagscol
)
......
......@@ -10,6 +10,8 @@ import pandas as pd
import dios
from test.common import TESTFLAGGER
from saqc.flagger import Flagger, initFlagsLike
from saqc.common import BAD
from saqc.funcs.resampling import (
linear,
......@@ -43,10 +45,10 @@ def data():
@pytest.mark.parametrize("flagger", TESTFLAGGER)
@pytest.mark.parametrize("reshaper", RESHAPERS)
def test_harmSingleVarIntermediateFlagging(data, flagger, reshaper):
flagger = flagger.initFlags(data)
flagger = initFlagsLike(data)
# make pre harm copies:
pre_data = data.copy()
pre_flags = flagger.getFlags()
pre_flags = flagger['data']
freq = "15min"
assert len(data.columns) == 1
field = data.columns[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment