Skip to content
Snippets Groups Projects
Commit b04be6ca authored by David Schäfer's avatar David Schäfer
Browse files

track interpolation routines in history

parent 59e5c183
No related branches found
No related tags found
4 merge requests!685Release 2.4,!684Release 2.4,!567Release 2.2.1,!566Release 2.2
......@@ -15,6 +15,7 @@ This changelog starts with version 2.0.0. Basically all parts of the system, inc
- translation of `dfilter`
- new generic function `clip`
- parameter `min_periods` to `SaQC.flagConstants`
- tracking interpolation routines in `History`
### Changed
- test function interface changed to `func(saqc: SaQC, field: str | Sequence[str], *args, **kwargs)`
- lib function `butterFilter` returns `NaN` for too-short series
......
......@@ -113,13 +113,23 @@ class InterpolationMixin:
datcol[na_mask] = rolled[na_mask]
self._data[field] = datcol
new_col = pd.Series(np.nan, index=self._flags[field].index)
new_col.loc[interpolated] = np.nan if flag is None else flag
flagcol = pd.Series(np.nan, index=self._flags[field].index)
flagcol.loc[interpolated] = np.nan if flag is None else flag
# todo kwargs must have all passed args except data,field,flags
self._flags.history[field].append(
new_col, {"func": "interpolateByRolling", "args": (), "kwargs": kwargs}
)
meta = {
"func": "interpolateByRolling",
"args": (field,),
"kwargs": {
"window": window,
"func": func,
"center": center,
"min_periods": min_periods,
"flag": flag,
**kwargs,
},
}
self._flags.history[field].append(flagcol, meta)
return self
......@@ -286,8 +296,24 @@ class InterpolationMixin:
history = self._flags.history[field].apply(
index=self._data[field].index,
func=_resampleOverlapping,
func_kws=dict(freq=freq, fill_value=UNFLAGGED),
func_kws=dict(freq=freq, fill_value=np.nan),
)
meta = {
"func": "interpolateIndex",
"args": (field,),
"kwargs": {
"freq": freq,
"method": method,
"order": order,
"limit": limit,
"downgrade": downgrade,
**kwargs,
},
}
flagcol = pd.Series(UNFLAGGED, index=inter_data.index)
history.append(flagcol, meta)
self._flags.history[field] = history
return self
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