function [lambda]=wavelength(plan_perp_roll)
 limit_sup=1/1000;
limit_inf=1/3000;
R_max_unaliased=5800;
hurricane='frances';
rep='meanless\vert\filtered\1000_3000\gridded_data';
 files=dir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\*.mat']);
 for fil=1:length(files)
    trans=200:400:3400;
    for ii=1:length(trans)
        load(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\',files(fil).name]);
        u_count=find(count < 15);

        vel(u_count)=NaN;
        [x_3dgrid,y_3dgrid,z_3dgrid]=meshgrid(xc,yc,zc);
        pas=25;
        x1=-10000:pas:10000;
        y1=-10000:pas:10000;
        L=length(x1);
        plan_axis=ones(L,1)*x1;
        hsp = surf(x1,y1,zeros(length(x1)));
        rotate(hsp,[1,0,0],90);
        rotate(hsp,[0,0,1],plan_perp_roll);
        xd = get(hsp,'XData');
        yd = get(hsp,'YData');
        zd = get(hsp,'ZData');
        xd1=xd+trans(ii);
        yd1=yd+trans(ii);
        comple=180-plan_perp_roll;
        d_to_y_axis=abs(trans(ii)/cos(deg2rad(comple))); %180-122, 122 is the value that would be in the 2nd rotate line
        d_perp_to_xsection=(trans(ii) + (trans(ii)/tan(deg2rad(comple))))*sin(deg2rad(comple));
        d_from_trans_origin= (2*trans(ii)^2 - d_perp_to_xsection^2)^0.5;
        O_prime_Max=(sqrt((R_max_unaliased^2)-(d_perp_to_xsection^2)))-d_from_trans_origin;
        O_prime_min=-((sqrt((R_max_unaliased^2)-(d_perp_to_xsection^2)))+d_from_trans_origin);
        O_prime_to_x_axis=trans(ii)/deg2rad(comple);
        x_limit_of_max=(trans(ii) + (trans(ii)/tan(deg2rad(comple))))-((O_prime_Max + ( trans (ii)/sin(deg2rad(comple))))*cos(deg2rad(comple)));
        x_limit_of_min=(trans(ii) + (trans(ii)/tan(deg2rad(comple))))+((abs(O_prime_min) - ( trans (ii)/sin(deg2rad(comple))))*cos(deg2rad(comple)));
        if min(O_prime_Max,d_to_y_axis) ==O_prime_Max
            u_limit_good_data=find(xd1(1,:) >= x_limit_of_max & xd1(1,:) <= x_limit_of_min );
            xd2=ones(L,1)*xd1(1,u_limit_good_data);
            yd2=ones(L,1)*yd1(1,u_limit_good_data);
            zd2=zd(:,1:length(u_limit_good_data));
            plan_axis2=plan_axis(:,u_limit_good_data);
        else
            u_limit=find(xd1(1,:)>=0 & xd1(1,:) <= x_limit_of_min  );
            xd2=ones(L,1)*xd1(1,u_limit);
            yd2=ones(L,1)*yd1(1,u_limit);
            zd2=zd(:,1:length(u_limit));
            plan_axis2=plan_axis(:,u_limit);
        end

%             %%%%% isabel
%             xd2=xd1;
%             yd2=yd1;
%             zd2=zd;
%             plan_axis2=plan_axis;
%         %%%%%% fin isabel
        
            h=slice(x_3dgrid,y_3dgrid,z_3dgrid,vel,xd2,yd2,zd2);
        x_section = get(h,'CData');
        
        delta_x=pas;
        
        u=find(zd2(:,1)>=0 & zd2(:,1) <=max(zc));
        x_section=x_section(u,:);
        plan_axis2=plan_axis2(u,:);
        yd2=yd2(u,:);
        zd2=zd2(u,:);
        close all
        z_data=[];
        lambda(ii).trans=trans(ii);
        for height=1:600/fix(zc(2)-zc(1))
            temp=x_section(height,:);
            
%             
%             
%             
%             
%             %%%%%%%%%%%%%Filtering%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%             
            u_NaN = find(~isnan(temp));
        temp2=temp(u_NaN)';
        Fs=1/(delta_x);
        NFFT=length(temp2);
        NumUniquePts = ceil((NFFT+1)/2);
        f = (0:NumUniquePts-1)*Fs/NFFT;
       
        
        if length(temp2)> 40
             [b,a] = butter(5,limit_inf/(Fs/2),'high');  
            Hd = dfilt.df2t(b,a); 
            zfilt = filter(Hd,temp2);
           
            if limit_sup/(Fs/2) <= 1
                [b,a] = butter(5,limit_sup/(Fs/2));
                Hd = dfilt.df2t(b,a);        
                zfilt = filter(Hd,zfilt);
            end
          temp(u_NaN)=zfilt';
       end
% %             
%             
%             %%%%%%%%%%Fin de %%%%%%%%%%filtering%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            z_data=[z_data temp'];   
          
        
        
        end
        
        [li,col]=size(z_data);
        fqcy=[];
        psd=[];
        peaks=zeros(li,col);
%         for jj=1:col
%             v_peaks=[];
%             [psd_final,t,f,f1,aver_FFT,check]=fft_analysis(z_data(:,jj),(1/delta_x(1)),rectwin(100),0,0,0);
%             [mfcy,nfcy]=size(fqcy);
%             [mpsd,npsd]=size(psd);
%             if length(f1) < mfcy
%                 add=abs(length(f1)-mfcy);
%                 add=NaN*ones(add,1);
%                 f1=[f1;add];
%                 fqcy=[fqcy f1];
%                 
%                 add=abs(length(aver_FFT)-mpsd);
%                 add=NaN*ones(add,1);
%                 aver_FFT=[aver_FFT;add];
%                 psd=[psd aver_FFT];
%             elseif length(f1) > mfcy
%                 add=abs(length(f1)-mfcy);
%                 add=NaN*ones(add,nfcy);
%                 fqcy=[fqcy;add];
%                 fqcy=[fqcy f1];
%                 
%                 add=abs(length(aver_FFT)-mpsd);
%                 add=NaN*ones(add,npsd);
%                 psd=[psd;add];
%                 psd=[psd aver_FFT];
%             elseif length(f1) == mfcy
%                 fqcy=[fqcy f1];
%                 psd=[psd aver_FFT];
%             end
%             u_peaks=find(aver_FFT >= 0.6*max(aver_FFT));
%             if length(u_peaks)>0
%                 if u_peaks(1)==1
%                     u_peaks(1)=[];
%                 end
%                 for i_local_max=1:length(u_peaks)
%                     if aver_FFT(u_peaks(i_local_max)) >= aver_FFT(u_peaks(i_local_max)+1) & aver_FFT(u_peaks(i_local_max)) > aver_FFT(u_peaks(i_local_max)-1) 
%                         v_peaks=[v_peaks u_peaks(i_local_max)];
%                     end
%                 end
%                 peaks(v_peaks,jj)=1./f1(v_peaks);
%             end
%             
%   end
%          lambda(ii).fqcy=fqcy;
%          lambda(ii).psd=psd;

        lambda(ii).plan_axis2=plan_axis2;
        lambda(ii).zd2=zd2;
        lambda(ii).z_data=z_data;
        %lambda(ii).peaks=peaks;
end
    
    
    save(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\wavelength analysis\same_psd_length\filtered\1000_3000\rect_',files(fil).name(4:9),'_1024'],'lambda');
    clear('lambda')
end

