%Removes the mean at every timestep from a periodic signal. For example,
%For several years of daily data, feed in a signal with daily resolution
%and give the "period" parameter as 365. This will give you the daily
%anomaly. The slider width is applied to limit the mean to a certain
%number of periods after the data point - making each value the anomaly
%from the mean of the next "sliderWidth" values at the same position in
%signalMat is an n-column matrix where n variables are represented as a
%timeseries- columns are variables, rows are timeseries records
%period is the length of the repeating pattern in the data- if using
%FluxNet data with 30 min resolution, the period is 48 or one day
%sliderWidth is the number of periods to base the anomaly on - for a five
%day moving anomaly, set sliderWidth to 5.
%NoDataCode is a data value that will be ignored.
if avg(i,s) == NoDataCode | signalMat(i,s) == NoDataCode