function find_orientation_grid_vol(hauteur,A,B)
hurricane='frances';
%hauteur=400;
rep='meanless\vert\filtered\2000\gridded_data\';
files=dir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'*.mat']);
final_results=[];
for fil=1:length(files)
    fil
    load (['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,files(fil).name]);
    mean_var=[];
    %for truly cartesian data
     u_count=find(count < 15);
        vel(u_count)=NaN;
    data=vel;

    [x_3dgrid,y_3dgrid,z_3dgrid]=meshgrid(xc,yc,zc);
    pas=25;
    x1=xc;%for frances 0:pas:8000;
    y1=yc;%for frances0:pas:8000;
    L=length(x1);
    for rot_angle=130:-0.5:30%for Frances0:0.5:70
        hsp = surf(x1,y1,zeros(length(x1)));
        rotate(hsp,[0,0,1],rot_angle);
        xd = get(hsp,'XData');
        yd = get(hsp,'YData');
        zd =hauteur+ get(hsp,'ZData');
        h=slice(x_3dgrid,y_3dgrid,z_3dgrid,data,xd,yd,zd);
        x_section = get(h,'CData');
        
%         pcolor(x_section)
%         shading interp
%         caxis([-6,6])
%         figure
        %x_section=x_section';%for frances vert4Z
        
        [m,n]=size(x_section);
        num_pts=[];
        for li=1:m
            u_NaN=find(~isnan(x_section(li,:)));
            num_pts=[num_pts length(u_NaN)];
        end
        
        u_sample=find(num_pts >=1);
        milieu=u_sample(1)+round((u_sample(length(u_sample))-u_sample(1))/2);
        lim_min=milieu-25;
        lim_max=milieu+25;
        u_min_pt=find(num_pts(lim_min:lim_max)>=A);%for Frances:u_min_pt=find(num_pts(lim_min:lim_max)<180);
        if length(u_min_pt)<30
            rot_angle
            mean_var=[mean_var;NaN];
           
        else
            
            
            data2examine=x_section((lim_min:lim_max),:);
            
            mat_var=[];
            for i=1:size(data2examine,1)
                temp=data2examine(i,:);
                u_NaN=find(~isnan(temp));
                temp=temp(u_NaN);
                vert_num_pt=B;%For frances vert_num_pt=200;
                if length(temp)>vert_num_pt
                    mil=round(length(temp)/2);
                    temp=temp(mil-(vert_num_pt/2):mil+(vert_num_pt/2));
                end
                
                mat_var=[mat_var var(temp)];
                
            end
            mu=mean(mat_var);
            sigma=std(mat_var);
            outliers = abs(mat_var - mu) > 2*sigma;
            u=find(outliers==1);
            mat_var(u)=[];
            mean_var=[mean_var;mean(mat_var)];
        end
end
    final_results=[final_results mean_var];
    
    save(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\orientation\orientation_var',num2str(hauteur),'.mat'],'final_results','rot_angle');
    
end
rot_angle=130:-0.5:30;
    save(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\modified\',rep,'\orientation\orientation_var',num2str(hauteur),'.mat'],'final_results','rot_angle');
