A Monologue with the Æther

Overthinking It

From the department of Overthinking-It, I was doing some data manipulations and
getting odd behavior from my data smoothing library. Instead of generating
interpolated elevation data, the library call was returning NaN (not a number
for the uninitiated). After checking the data at various points in the process,
I determined that the incorrect outcome resulted from concatenating data sets
together. Each data set represents a segment of my cross-continental bicycle
ride, so each succeeding segment begins with the ending data of the
preceding segment resulting in sequential duplicates when concatenating the
data sets. I solved the sequential duplicate data by deleting the duplicate
data from the succeeding data set before concatenating.

Problem solved, instead of NaN the interpolation function was returning real
values; however, I needed to add the removed data back after processing to
output the complete data set. I’m working with arrays, so I initially
attempted to figure out how to capture the index of the deleted array items.
That gave me a headache, until I realized that one of the variables that I am
tracking only changes when a new data set occurs, so I solved the problem by
writing out the data and tracking when the variable changed on output and
injecting a duplicate of the previous data into the new output thereby
restoring my data sets plus the data processing.