A Global Averaging Method For Dynamic Time Warping With Applications To Clustering