C NCLFORTSTART subroutine taper_ncl (x,n,p,xt,iopt) implicit none C NCL: xTaper = taper(x,p,iopt) c this subroutine applies split-cosine-bell tapering tothe series x. c . the series will be tapered to the mean of x. c . See Bloomfield's "Intro to Fourier .." c . This is used prior performing an fft on non-cyclic data c arguments: c . x series to be tapered (tapering done in place) c . **missing data not allowed** c . n series length c . p the proportion of the time series to be tapered [p=0.10 means 10 %] c . xt tapered series c . iopt option not used ... set to zero C INPUT integer n, iopt real x(n), p C OUTPUT real xt(n) C NCLEND integer i, m real weight, pi, pim, xav data pi /3.141592653589/ xav = 0.0 do i=1,n xt = x(i) xav = xav+x(i) end do xav = xav/n m = max0( 1 , int(p*float(n)+0.5)/2 ) pim = pi/float(m) do i=1,m weight = 0.5-0.5*cos(pim*(float(i)-0.5) ) xt(i) = (x(i)-xav)*weight + xav xt(n+1-i) = (x(n+1-i)-xav)*weight + xav enddo c . cft correction factor for taper (not used , for info only) c c c cft = 0.5*(128.-93.*p)/(8.-5.*p)**2 return end