parameter(max=40000) character nin*100, nout*100 real*4 x(max), y(max) ** Read the original SAC file nin='/home/sgao/demo/04_sac/st04.sac' call rsac1(nin, x, npts, beg, dt, max, nerr) * In the subroutine above, nin, x, and max are input, and * the rest are output. * Now, do the smoothing using a 5-point average y(1)=0.0 y(2)=0.0 do i=1,npts-4 y(i+2)=(x(i)+x(i+1)+x(i+2)+x(i+3)+x(i+4))/5.0 enddo y(npts)=0.0 y(npts-1)=0.0 * Write the smoothed file out as SAC nout='output.sac' beg=0.0 call wsac1(nout, y, npts, beg, dt, nerr) * Write the smoothed file as an ASCII (plain text) file open(9,file='output.dat') do i=1,npts write(9,99) (i-1)*dt, y(i) 99 format(f10.6, 1x, f10.6) enddo close(9) print*,'The output SAC file is output.sac' print*,'and the output ASCII file is output.dat' stop end *********************************************** ** To compile the program, copy and paste the *following 3 lines into a file called Makefile and type make * Of course, you need to remove the * and make sure that * the 2nd line starts with a single Tab (and no other spaces) *08.exe:08.f * gfortran -g -m64 08.f -o 08.exe \ */home/sgao/lib/sacio.a