A Technique for Removing Large-scale Variations in Regularly and Irregularly Spaced Data