function [ws_mean,wd_mean, mean_rad_vel]=remove_mean(V_dopp,az,el)

[li,col]=size(V_dopp);
num_az_in_scan=90;
num_of_scans=fix(col/num_az_in_scan);
total=NaN*ones(li,col);
mean_Vr_az=NaN*ones(li,col);
ws=NaN*ones(li,num_of_scans);
wd=NaN*ones(li,num_of_scans);

for rg=1:57
    for sc=1:num_of_scans
        [ws_mean,wd_mean]=vad((az(1:num_az_in_scan))',V_dopp(rg,(sc-1)*90+1:sc*90),el(1));
        ws(rg,sc)=ws_mean;
        wd(rg,sc)=wd_mean;
        
    end
end
wd_mean=NaN*ones(57,col);
ws_mean=NaN*ones(57,col);
for i=1:num_of_scans
    ws_mean(:,(i-1)*90+1:i*90)=ws(:,i)*ones(1,90);
    wd_mean(:,(i-1)*90+1:i*90)=wd(:,i)*ones(1,90);
end
mean_rad_vel=NaN*ones(57,col);
meanless=NaN*ones(57,col);
az1=ones(57,1)*az;
beta=abs(az1-wd_mean);
 u_toward=find(beta < 90  | beta >= 270);
mean_rad_vel(u_toward)=-ws_mean(u_toward).*cos(deg2rad(beta(u_toward)))*cos(deg2rad(el(1)));
u_away=find(beta >= 90  & beta <270);
beta(u_away)=abs(beta(u_away)-180);
mean_rad_vel(u_away)=ws_mean(u_away).*cos(deg2rad(beta(u_away)))*cos(deg2rad(el(1)));;