Calculate mean value in certain time interval in irregular data set