The defects are flagged with the bad value. The defects are found by looking for pixels that deviate from the spectrum or image's smoothed version by more than an arbitrary number of standard deviations from the local mean, and that lie within a specified range of values. Therefore, the data array must be substantially flat. The data variances provide the local noise estimate for the threshold, but if these are not available a variance for the whole of the data array is derived from the mean squared deviations of the original and smoothed versions. The smoothed version of the data array is obtained by block averaging over a rectangular box. An iterative process progressively removes the outliers from the data array.
By default, a null (!) value is used for WLIM, which causes the pattern of bad pixels to be propagated from the input image to the output image unchanged. In this case, smoothed output values are only calculated for those pixels which are not bad in the input image.
If a numerical value is given for WLIM, then it specifies the minimum fraction of good pixels which must be present in the smoothing box in order to generate a good output pixel. If this specified minimum fraction of good input pixels is not present, then a bad output pixel will result, otherwise a smoothed output value will be calculated. The value of this parameter should lie between 0.0 and 1.0 (the actual number used will be rounded up if necessary to correspond to at least 1 pixel). [!]
KAPPA --- Kernel Application Package