Shape analysis for time series