hurricane='frances';
rep='meanless\rhi\23';
limit_sup=1/3000;%5*10^(-3);
limit_inf=1/5000;%5*10^(-4);
files=dir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\*.dat']);
for fil=1:length(files)
    sweepfile=files(fil).name;
    data=load(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\',sweepfile]);
    rhi=data(1:length(data)-1,:);
    el=data(length(data),:);
    rg=33.35:66.7:149*66.7+33.35;
    pas=50;
    [xi,zi,vel]=new_rhi(el,rg,rhi,length(rg),pas);
    w=vel;
    %vel=[li,col]=[zi,xi]
    Fs=1/pas;
    for h=1:size(vel,1)
        vel_h=vel(h,:);
        u_NaN = find(~isnan(vel_h));
        vel_h=vel_h(u_NaN)';
        
        
       
          
             [b,a] = butter(6,limit_inf/(Fs/2),'high');  
            Hd = dfilt.df2t(b,a); 
            z = filter(Hd,vel_h);
          % freqz(b,a,512,Fs)
            if limit_sup/(Fs/2) <= 1
                [b,a] = butter(6,limit_sup/(Fs/2));
                Hd = dfilt.df2t(b,a);        
                z = filter(Hd,z);
%                  figure
%                  freqz(b,a,512,Fs)
             
            end
          vel(h,u_NaN)=z';
         
         
        end
        x=xi(1,:);
        z=zi(:,1);
        mkdir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\filtered\'],[num2str((1/limit_sup)),'_',num2str((1/limit_inf))]);
   save(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\filtered\',num2str((1/limit_sup)),'_',num2str((1/limit_inf)),'\',sweepfile(1:length(sweepfile)-3),'mat'],'vel','x','z')
    end
