%  ---------------------------------------------------------
%           Off2ang     
%  ---------------------------------------------------------
%  function adcig = off2ang(h,z,odcig,ang);
%  ---------------------------------------------------------
%  Input   Description                    Type      Size
%  ---------------------------------------------------------
%  h       offset coordinate             Vector     1 by nh
%  z       Depth Coordinate              Vector     1 by nz
%  ang     angle coordinate              Vector     1 by nang
%  odcig   Sub.surf-offset gathers       Matrix     nz by nh
%-----------------------------------------------------------
%  Output  Description                    Type      Size
%-----------------------------------------------------------
%  adcig   angle gathers                 Matrix     nz by nang
%-----------------------------------------------------------
%
function adcig = off2ang(h,z,odcig,ang);
%
nh = length(h); dh = h(2)-h(1);
nz = length(z); dz = z(2) - z(1);
na = length(ang); da = ang(2)-ang(1);
adcig = zeros(nz,na);
%
odcig = half(1,odcig,dz);
%
for ia = 1 : na;
    inc = tan(-ang(ia)*pi/180);
    disp(num2str((ia-1)*da+ang(1)));
%
    for ih = 1 : nh;    
        z0 = z-h(ih)*inc;
        df = interp1(z,odcig(:,ih),z0);%size(df)
%tira nan
        indn = find(isnan(df));
        df(indn) = 0;
        adcig(:,ia) = adcig(:,ia) + df';
    end;
%
end;
%

