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

Merge branch 'resample-meta' into 'develop'

make resample write meta entries

See merge request !660
parents b9e71435 3ff8c896
No related branches found
No related tags found
3 merge requests!685Release 2.4,!684Release 2.4,!660make resample write meta entries
Pipeline #161492 passed with stages
in 9 minutes and 55 seconds
......@@ -20,6 +20,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
### Fixed
- `func` arguments in text configurations were not parsed correctly
- fail on duplicated arguments to test methods
- `reample` was not writing meta entries
## [2.3.0](https://git.ufz.de/rdm-software/saqc/-/tags/v2.3.0) - 2023-01-17
[List of commits](https://git.ufz.de/rdm-software/saqc/-/compare/v2.2.1...v2.3.0)
......
......@@ -15,6 +15,7 @@ import numpy as np
import pandas as pd
from typing_extensions import Literal
from saqc.constants import UNFLAGGED
from saqc.core import register
from saqc.funcs.interpolation import _SUPPORTED_METHODS
from saqc.lib.tools import evalFreqStr, filterKwargs, getFreqDelta, isflagged
......@@ -238,6 +239,24 @@ class ResamplingMixin:
func=aggregate2Freq,
func_kws=kws,
)
meta = {
"func": "resample",
"args": (),
"kwargs": {
"freq": freq,
"func": func,
"method": method,
"maxna": maxna,
"maxna_group": maxna_group,
"maxna_flags": maxna_flags,
"maxna_group_flags": maxna_group_flags,
"flag_func": flag_func,
"freq_check": freq_check,
**kwargs,
},
}
flagcol = pd.Series(UNFLAGGED, index=history.index)
history.append(flagcol, meta)
self._data[field] = datcol
self._flags.history[field] = history
......
......@@ -113,6 +113,7 @@ def test_resampleAggregateInvert(data, method, freq, expected):
qc = qc.resample(field_aggregated, freq, func=np.sum, method=method)
assert qc._data[field_aggregated].index.freq == pd.Timedelta(freq)
assert qc._data[field_aggregated].equals(expected)
assert qc._flags.history[field_aggregated].meta[-1]["func"] == "resample"
checkInvariants(qc._data, qc._flags, field_aggregated, identical=True)
qc = qc.concatFlags(field_aggregated, target=field, method="inverse_" + method)
......
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