flag_bad

Last updated Sun Sep 19 14:20:32 1999


Flag data as bad in a vector

1. SYNOPSIS

[v, mask] = flag_bad(v, sig_max )

2. DESCRIPTION

Calculate the mean value of the non-NaN in a vector, standard deviation and residuals for each element. An element is considered as bad if the absolute value of its residual is larger than a certain threshold value. The latter is determined as a factor times the standard deviation.

This function can be used to detect vector elements that are much more different than the other ones.

3. PARAMETERS



v

Data vector.



sig_max

Factor used to calculate the threshold value. A typical value is 2.5.

4. RETURNS



v

Vector with bad elements replaced by NaN.



mask

Vector of ones or zeros,zeros specifying elements in v that have been flagged as bad,or that were already set to NaN on input.

5. AUTHORS

Pierre Jaccard, Geophysical Institute, University of Bergen, 1999