WaveDuration function

Heat and cold waves duration for n-dimensional arrays