;The function momentbadval uses the idl function moment to calculate the ;mean, variance, skewness and kurtosis of a vector excluding a selected badval. ;Use is as follows: ; m=momentbadval(x,badval) ;Where ; input | x = data vector ; | badval = value of points in data vector to exclude when ; calculating statistics ; ;output | m = array of statistics ; | m(0)=mean ; | m(1)=variance ; | m(2)=skewness ; | m(3)=kurtosis ; ;Note: There must be at least 2 good values in the vector x or statistics ; are not calculated and m is returned as an array of badvals. ; ;Written by BWBerger 8/99 function momentbadval,x,badval r=where(x ne badval,c) if c ge 2 then begin mom=moment(x(r)) endif else begin mom=[badval,badval,badval,badval] endelse return,mom end