function smlltr(x[*]:numeric) ; local y,w,istrt,ilast,missing,dims begin w = (/0.1421/2.0, 0.13567, 0.11742, 0.0903, 0.05856, 0.027/) nptmx = dimsizes(x) if (nptmx.lt.11) then return(-9) end if ; find the 1st and last non-msg values if(isatt(x,"_FillValue")) then if (all(ismissing(x))) then return(-9) else if(any(ismissing(x))) then missing = ind(ismissing(x)) istrt = missing(0) ilast = missing(dimsizes(missing)-1) else istrt = 0 ilast = nptmx -1 end if end if y = x(:) y(:) = x@_FillValue else y = x y(:) = 0 istrt = 0 ilast = nptmx -1 end if do i=istrt+5,ilast-5 ; y(i)=x(i)*w(0) ; do k=1,5 ; y(i)=y(i)+w(k)*(x(i+k)+x(i-k)) ; end do y(i) = sum(w*(x(i:i+5)+x(i:i-5))) end do ; binomial filter over the end points do i=istrt+1,istrt+4 k=ilast+1-i y(i)=0.25*(x(i-1)+2.*x(i)+x(i+1)) end do do i=ilast-4,ilast-1 y(i)=0.25*(x(i-1)+2.*x(i)+x(i+1)) end do ;print(y) return(y) end