prepareTimeseries function

Helper function to validate and clean the input time series