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

added offset2seconds transformation to tools.py

parent 2a09a30e
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,7 @@ def estimateSamplingRate(index):
# harmonized with skips)
return pd.tseries.frequencies.to_offset(str(int(hist[1][:-1][hist[0] > 0].min())) + 's')
def retrieveTrustworthyOriginal(dataseries, dataflags=None, flagger=None):
"""Columns of data passed to the saqc runner may not be sampled to its original sampling rate - thus
differenciating between missng value - nans und fillvalue nans is impossible. This function evaluates flags for a
......@@ -148,3 +149,12 @@ def retrieveTrustworthyOriginal(dataseries, dataflags=None, flagger=None):
data_rate = estimateSamplingRate(dataseries.index)
# resample dataseries to its original sampling rate (now certain, to only get nans, indeed denoting "missing" data)
return dataseries.resample(data_rate).asfreq(), data_rate
def offset2seconds(offset):
"""Function returns total seconds upon "offset like input
:param offset: offset string or pandas offset object.
"""
return pd.Timedelta.total_seconds(pd.Timedelta(offset))
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