This function shifts a channel in time by an integer number of samples or seconds in time, specified by the argument
lag. A negative lag shifts the channel backwards in time (earlier), while a positive lag shifts the channel forward in time (later). Shifting a channel is most commonly used to align conductivity to temperature to minimize salinity spiking. It could also be used to adjust for the time delay caused by sensors with relatively slow adjustment times (e.g., dissolved oxygen sensors).
shiftfill parameter describes what values will replace the shifted values. The default treatment is
eroOrderhold, in which the first (or last) value is used to fill in the unknown data if the lag is positive (or negative). When
nan, missing values are filled with NaNs. When
mirror the edge values are mirrored to fill in the missing values. When
nion, all channels are truncated by
lag samples. The diagram below illustrates the
RSKalignchannel to minimize salinity spiking:
Salinity is derived with an empirical formula that requires measurements of conductivity, temperature, and pressure. The conductivity, temperature, and pressure sensors all have to be aligned in time and space to achieve salinity with the highest possible accuracy. Poorly-aligned conductivity and temperature data will result in salinity spikes in regions where the temperature and salinity gradients are strong.
RSKcalculateCTlag can be used to estimate the optimal lag by minimizing the spikes in the salinity time series, or the lag can be estimated by calculating the transit time for water to pass from the conductivity sensor to the thermistor.
RSKalignchannel can then be used to shift the conductivity channel by the desired lag, and then salinity needs to be recalculated using