function for temporal aggregation of station data