function [u_10_mean,x_km]=matching_axis(input_data);

filename=dir(['C:\Documents and Settings\sylvie.lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\',input_data.hurricane,'\',input_data.jour,'\*.w']) ;
fichier=filename(input_data.file_number).name
filename2=dir(['C:\Documents and Settings\sylvie.lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\',input_data.hurricane,'\',input_data.jour(1:2),'\*.nc']) ;
ncload(['C:\Documents and Settings\sylvie.lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\',input_data.hurricane,'\',input_data.jour(1:2),'\',filename2(1).name]);




    file_info=dir([['C:\Documents and Settings\sylvie.lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\',input_data.hurricane,'\',input_data.jour(1:2)],'\*',fichier(10:13),'*leg*']) 
    fichier2=['C:\Documents and Settings\sylvie.lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\',input_data.hurricane,'\',input_data.jour(1:2),'\',file_info.name];
    
    leg_data=textread(fichier2,'%s','bufsize', 8191);
    
    inb_az=str2num(cell2mat(leg_data(17)))
    ti=str2num(cell2mat(leg_data(1)))
    tf=str2num(cell2mat(leg_data(4)))
    tc=str2num(cell2mat(leg_data(7)))

u_t=find( TIME >=ti & TIME <= tf);
sfmr_ws1=SWS(u_t);
fwd1=FDIR(u_t);
fws1=FWS(u_t);
lat1=LAT(u_t);
lon1=LON(u_t);
t1=TIME(u_t);
alt_rad1=RALT(u_t);
L=length(u_t);

[pres_du_centre,u_center]=min(abs(t1-tc))
    
    
    
    lat0=repmat(lat1(u_center),L,1);
    lon0=repmat(lon1(u_center),L,1);
    xaxis1=distdim(distance(lat0, lon0, lat1, lon1),'deg','m');
    i_center=u_center(1);
    xaxis1(i_center:L)=-xaxis1(i_center:L);
    
    
    x_inb_leg=flipud((750:1500:xaxis1(1)+700)');
    x_oub_leg=(-750:-1500:xaxis1(L)-750)';
    x_leg=[x_inb_leg;x_oub_leg];
    
    
    figure
    axesm('mercator','MapLatLimit',[min(lat1)-15 max(lat1)+15],'MapLonLimit',[min(lon1)-15 max(lon1)+15]);
    plotm(lat1,lon1);
    
    reply = input('Did they circle in the center? y/n [y]: ','s');
    if strcmp(reply,'y')==1
        
        disp('first start point')
        [start_lat,start_long]=inputm(1);%find((diff(xaxis))>0);
        disp('now end point')
        [end_lat,end_long]=inputm(1);
        dist_up=distdim(distance(lat0(1,1), lon0(1,1), start_lat,start_long),'deg','m');
        dist_down=distdim(distance(lat0(1,1), lon0(1,1), end_lat,end_long),'deg','m');
        no_looping=find(xaxis1 > dist_up | xaxis1 < -dist_down);
        
        
        xaxis2=xaxis1(no_looping);%[xaxis(1:start_pt(1));xaxis(u_neg(length(u_neg)):length(xaxis))];
        u_102=sfmr_ws1(no_looping);
        alt_rad2=alt_rad1(no_looping);
        t2=t1(no_looping);
        close
    else
        u_102=sfmr_ws1;
        xaxis2=xaxis1;
        alt_rad2=alt_rad1;
        t2=t1;
         close
    end


u_zeros=find((diff(xaxis2))~=0);
    
    if length(u_zeros) > 0
        u_103=u_102(u_zeros);
        xaxis3=xaxis2(u_zeros);
        alt_rad3=alt_rad2(u_zeros);
        t3=t2(u_zeros);
    end






u_good = find(u_103 >0);
u_10=u_103(u_good);
t=t3(u_good);
height=alt_rad2(u_good);
xaxis=xaxis3(u_good);


u_10_mean=[];
z_mean=[];


    
    temp=[xaxis;x_leg];
    xi2=flipud(sort(temp));
    
    u_zeros=find((diff(xi2))~=0);
    
    if length(u_zeros) > 0
       xi=xi2(u_zeros);
        
    end
    
    [test1,index1]=sort(xaxis);
 test1=flipud(test1);
 index1=flipud(index1);

 u_double=find(diff(index1)~=1);
 xaxis(u_double)=[];
 u_10(u_double)=[];
 
    u_10_leg=interp1(xaxis,u_10,xi);
    
    for i=1:length(x_leg)-1
        u_1500=find(xi<=x_leg(i) & xi > x_leg(i+1));
        u_10_mean(i,1)=nanmean(u_10_leg(u_1500));
        x_km(i,1)=(x_leg(i)-750)/1000;
    end
end


u_0_abs=find(x_km == 0);
x_km(u_0_abs)=[];
u_10_mean(u_0_abs)=[];



