Fix edge case with resample min-time

pull/213/head
Simon Roberts 3 years ago
parent b22c040ffb
commit bbf4144ebb
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

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