Merge pull request #213 from lyricnz/bugfix/zero-left

Fix edge case with resample min-time
pull/219/head
Miguel Mota 3 years ago committed by GitHub
commit dfaa8d0c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 {

Loading…
Cancel
Save