module OW_grabvel

implicit none

contains


subroutine owgrab_vel(ixs,velint,vel,ni)

integer					:: ni, ixs
real					:: velint, vel


! workspace origin 
    owrk=(ixs-1)*rec%x%d+rec%x%o+rec%h%o
! grab velocity in the workspace       
    nv = ceiling((owrk-v%xm%o)/v%xm%d)
    ni = nv-ceiling((img%xm%o-v%xm%o)/img%xm%d)

    vel=0;
    vel(:,:)=velint(:,nv:nv+rec%h%n-1);

    if (owrk < img%xm%o .or. owrk > img%xm%o+img%xm%d*(img%xm%n-1)) &
         call seperr('WORKING SPACE GREATER THAN IMAGE SPACE FOR SHOT # ',ixs)
