flagConstants behaviour at begining of time series
When trying to flag constant values in a data range, the first entries of the time series are flagged until the values of the parameter exceed the the threshold for the first time. It happens regardless if the window size is given as frequency string or numeric value.
Minimal example:
import pandas as pd
from saqc import SaQC
index = pd.date_range(start='2024-02-15 00:00:00', end = '2024-02-15 00:45:00', periods=4)
data = pd.DataFrame([9.78, 9.72, 9.22, 9.33], columns=['Temperature'])
data.index = index# try to flag constants using frequency strings
qc = SaQC(data = data, scheme = 'dmp')
qc = (qc
.flagConstants("Temperature", thresh = 0.1, window = "4H")
# set remaining values as ok
.flagUnflagged(".*", regex = True, flag = "OK")
)
flags = qc.flags
# example temperature
data['Temperature'][0:3]
flags['Temperature'][0:3]
# try to flag constants using numeric size of window
qc = SaQC(data = data, scheme = 'dmp')
qc = (qc
.flagConstants("Temperature", thresh = 0.1, window = 16)
# set remaining values as ok
.flagUnflagged(".*", regex = True, flag = "OK")
)
flags = qc.flags
# example temperature
data['Temperature'][0:3]
flags['Temperature'][0:3]
Edited by Felix Thomas