subroutine apply_taper(datas,n,n1,ierr) c c tapering of datas(n) at beginning and end, padding with 0 up to n1 c a.tento 5/03 c c datas(n) = real data to be tapered (input) c data tapered (output) c implicit none integer n, n1, ierr real datas dimension datas(n1) c include 'parameters.h' c character*200 argout(10) character*1 sep2 parameter ( sep2 = ':' ) real p1, r, pi, rm1, w integer m1, i, j, nw data pi/3.1415927/ c c ierr = 0 c call split3(taper,argout,sep2,nw) cc if ( argout(1) .eq. 'cos' ) then if ( nw .ne. 2 ) then write(*,100) taper ierr = 1 return endif read(argout(2),*)p1 if ( p1 .gt. 50.0 ) then write(*,110) taper ierr = 1 return endif r=(p1*float(n))/100.0 m1=int(r) rm1=float(m1-1) c do 1 i=1,m1 j = n - i + 1 r=float(i-1)/rm1 w=0.5*(1. - cos(pi*r)) datas(i)=w*datas(i) datas(j)=w*datas(j) 1 continue c elseif (argout(1).ne.'box' .and. argout(1).ne.'boxcar')then write(*,200)taper ierr = 1 return endif cc if ( n1 .gt. n ) then do 2 i = n + 1, n1 datas(i) = 0.0 2 continue endif cc return c 100 format(' ERROR in taper parameter:', a80,/, # ' A percentage must be supplied') 110 format(' ERROR in taper parameter:', a80,/, # ' Percentage must be less than 50') 200 format(' ERROR in taper parameter:', a80,/,' The key is NOT', # ' recognised') c end