diff --git a/saqc/funcs/harm_functions.py b/saqc/funcs/harm_functions.py index 81a71aa9c6c8dd1bdd9f514ec87534fcd5b008e8..bbf7bca7fb21aeaf2e530ff8c7de630114c1e02d 100644 --- a/saqc/funcs/harm_functions.py +++ b/saqc/funcs/harm_functions.py @@ -332,8 +332,12 @@ def _interpolateGrid( closed = 'right' # all values in a sampling interval get aggregated with agg_method and assigned to the next grid point # some consistency cleanup: + # we are not trusting resamples interplay with sum and others - so we check for empty intervals: + to_nan = data.resample(freq_string, loffset=loffset, base=base, closed=closed, + label=label).count() == 0 data = data.resample(freq_string, loffset=loffset, base=base, closed=closed, label=label).apply(agg_method) + data[to_nan] = np.nan if total_range is None: data = data.reindex(ref_index)