module wei_mig_shared_scale_mod
  use wei_wavespace_scale_mod
  use wei_file_scale_mod
  use sep

  implicit none


  contains


  subroutine check_setup_mig(wave,image)
   type(wfile) :: image
   type(wspace),pointer ::  wave
   real         :: o
   logical      :: adj,image_real,ADD
   integer      :: esize
   
#ifdef  DEBUG
   write(0,*) "IN CHECK SETUP MIG"
#endif
   o=-wave%o(3)/wave%d(3)+1.
   if(abs(o-nint(o)) >.01) then
     call seperr("Must include zero offset index")
   end if
   if(nint(o) < 1 .or. nint(o) > wave%n(3) ) then
     call seperr("Must include zero offset index")
   end if
   wave%adj=.true. !migration
   wave%opsign=-1  !migration
   call from_param("nzb",wave%nzb,1) !Depth block

   call from_param("add",add,.false.)
   if(add) then
     write(0,*) "BEFORE abb ",esize
     call from_aux("R","esize",esize,4)
     image_real=.false.
     if(esize==4) image_real=.true.
     call init_file_tag(image,wave,"R",image_real,.false.,image_axes)
     image%add=.true.
   else
     call from_param("image_real",image_real,.true.)
     call init_file_struct(image,wave,"R",image_real,.false.,image_axes)
     image%add=.false.
   end if

#ifdef  DEBUG
   write(0,*) "OUT CHECK SETUP MIG"
#endif

  end subroutine



end module
