diff options
author | Miguel Mota <hello@miguelmota.com> | 2021-10-09 09:04:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-09 09:04:19 -0700 |
commit | dfaa8d0c3aba6f55735c4e5df6ac5673bfd08109 (patch) | |
tree | 57b7ac6df59da9fac02ad969ebddcbdb60270b28 | |
parent | cf5270623d0af5ec59d83af74c2044b0f4f98248 (diff) | |
parent | e843b79ac19fa27044fcfb6f0922c91f9fee24b4 (diff) |
Merge pull request #213 from lyricnz/bugfix/zero-left
Fix edge case with resample min-time
-rw-r--r-- | pkg/timedata/timedata.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/timedata/timedata.go b/pkg/timedata/timedata.go index e04074b..369ae44 100644 --- a/pkg/timedata/timedata.go +++ b/pkg/timedata/timedata.go @@ -18,7 +18,11 @@ func ResampleTimeSeriesData(data [][]float64, start float64, end float64, numSte idx := sort.Search(l, func(i int) bool { return data[i][0] >= pos }) var val float64 if idx == 0 { - val = math.NaN() // off the left + if data[0][0] == pos { + val = data[0][1] // exactly left + } else { + val = math.NaN() // off the left + } } else if idx == l { val = math.NaN() // off the right } else { |