program FirstArrival
  use sep
  implicit none
  real, allocatable, dimension(:,:):: data
  integer::n1,n2,i,ii,j
  logical::energy=.false.

  call sep_init()
  call from_history("n1",n1); call from_history("n2",n2)
  call sep_close()

  allocate(data(n1,n2))
  call sep_read(data)
  energy=.false.
  do j=1,n2
     i=1
!write(0,*) j,'--------------------------------------------'
     do while (i .le. n1)
        if(data(i,j).lt.0.01) then
           i=i+1
        else
           data(i+19:n1,j)=0.0
           i=n1+1
        end if
     end do
  end do

call sep_write(data)
end program FirstArrival
