program RWEmig_
  use sep
  use util_
  use fft
  use rwekernel_

  implicit none
  type(myaxis)            :: aw,ax,az
  character(len=128)      :: name
  integer                 :: method

  complex, pointer        :: img(:,:)
  real,    pointer        :: rcp(:,:,:)

  call sep_init()
  call from_param("method",method,1)

  name="rcp"
  call ainaxis(az,1,name)
  call hinaxis(ax,2)
  call hinaxis(aw,3)
  call houaxis(az,1)
  call houaxis(ax,2)

  call to_history("n3",1)
  call to_history("esize",8)
  call sep_close()

  allocate(rcp(az%n,ax%n,5))
  allocate(img(az%n,ax%n))

  call sreed("rcp",rcp,size(rcp)*4)

  write(0,*) "a",minval(rcp(:,:,1)),maxval(rcp(:,:,1))
  write(0,*) "b",minval(rcp(:,:,2)),maxval(rcp(:,:,2))
  write(0,*) "c",minval(rcp(:,:,3)),maxval(rcp(:,:,3))
  write(0,*) "d",minval(rcp(:,:,4)),maxval(rcp(:,:,4))
  write(0,*) "s",minval(rcp(:,:,5)),maxval(rcp(:,:,5))

  ! init migration
  call rwemig_init(aw,ax,az)
  img = 0.

  if(method==2) then
     
  else if(method==1) then
     call rwemig_f15(img,rcp)
  else
     call rwemig_ssf(img,rcp)  
  end if

  call exit (0)
end program RWEMIG_




