;despuvwt2.pro despikes sonic anemometer data using a simple variance ;threshhold technique. Spikes found in any of the four variables are replaced ;by badvals in all four variables from the sonic (u,v,w,t). ;Use is as follows: ; despuvwt2,u,v,w,t,nsig,badval ;Where ; input | nsig = multiple of standard deviation to use as ; | the threshhold value for despiking ; |badval = -999., a bad value marker ; ; input/output | u,v,w = wind velocities from sonic anemometer (m/s) ; | t = virtual temperature from sonic anemometer (C) ; ;Written by K.Davis? V.Sinha? ;Modified by BWBerger 8/99 to add descriptional header and to remove old ;commented out lines dealing with counting badvals. pro despuvwt2,u,v,w,t,nsig,badval despike,u,nsig,badval,hnew despike,v,nsig,badval,hnew despike,w,nsig,badval,hnew despike,t,nsig,badval,hnew ;Place badvals in all variables if one has a spike. ;This is done by creating a template that keeps track of all badvals ;and then places them in each variable. ggu=where(u eq badval) ggv=where(v eq badval) ggw=where(w eq badval) ggt=where(t eq badval) template=fltarr(n_elements(u)) if (ggu(0) gt -1) then template(ggu)=badval if (ggv(0) gt -1) then template(ggv)=badval if (ggw(0) gt -1) then template(ggw)=badval if (ggt(0) gt -1) then template(ggt)=badval gtemp=where(template eq badval) if (gtemp(0) gt -1) then begin u(gtemp)=badval v(gtemp)=badval w(gtemp)=badval t(gtemp)=badval endif return end