hurricane='frances';
rep='meanless\vert';
limit_sup=1/1000;%*10^(-3);
limit_inf=1/3000;%1*10^(-3);
files=dir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\*.dat']);
for fil=1:84%length(files)
    sweepfile=files(fil).name;
    data=load(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\',sweepfile]);
    vel=data(1:length(data)-1,:);
    az=data(length(data),:);
    for rg=1:200%length(vel)
        vel_rg=vel(rg,:);
        u_NaN = find(~isnan(vel_rg));
        vel_rg=vel_rg(u_NaN)';
        rge=(rg-1)*66.7+33.35;
        Fs=1/(rge*deg2rad(1.5));
        
%         if (rge*tan(deg2rad(0.75))*2) < 66.7
%             limit_sup = 1/(66.7*2);
%         else
%             
%             rge*tan(deg2rad(0.75))*2*2;
%             limit_sup = 1/(rge*tan(deg2rad(0.75))*2*2);
%         end
        if length(vel_rg)> 30
          
             [b,a] = butter(6,limit_inf/(Fs/2),'high');  
            Hd = dfilt.df2t(b,a); 
            z = filter(Hd,vel_rg);
%            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(rg,u_NaN)=z';
        end
        
    end
   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],'vel','az','-ascii')

   %save(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\filtered\900\',sweepfile],'vel','az','-ascii')
end