function [results]=rmw_scaling(input_data)
top_height=14000;
z=150:150:150*121; % 121 is the number of column (and the number of height levels) 
u_z1=find(z <=top_height);
max_col=length(u_z1);
file_dir=dir(['C:\Documents and Settings\sylvie.lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\',input_data.hurricane,'\',input_data.jour,'\*.w']) ;
M=length(file_dir);
intervals=[0.025:0.05:3];
L_interval=length(intervals);
indice=0;
max_row=round((M/2))*20;   %round((M/2));%    % M/2 to consider only the tle files (or thr windfield files) because we want a matrix big enough 
for i=1:L_interval-1
    
    results(i).param=NaN*ones(max_row, max_col);
end

for file_number = 1:M
    input_data.file_number=file_number;
    [ws,radwind,tgwind,w,dbz, x_fill, y_fill, z_fill, type_data]=read_w_files(input_data);
    param=eval(input_data.param);
    u_z=find(z_fill <=top_height);
    h1=(u_z(end));
    z_axis=z_fill(1:h1);
    radius_max=length(x_fill);
    if (type_data == 0 )
        filename=[file_dir(input_data.file_number).name(1:16),'_flt'];
        path1=['C:\Documents and Settings\sylvie.lorsolo\My Documents\research\HRD research\Gamache_soft\wfiles\',input_data.hurricane,'\',input_data.jour(1:2),'\'];
        [flight_data]=flight_level_data(path1,filename);
        [rmw,rmw_pos]=rmw_find(flight_data, tgwind, x_fill,z_axis);
        rmw;
        x_fill2=x_fill'*ones(1,length(z_axis));
        rmw2=ones(radius_max,1)*rmw;
        x_scaled=x_fill2./rmw2;
    end
    
    
    if (type_data == 0 & input_data.tke==0)
        indice=indice+1;
        for col=1:length(z_axis)
            for interv = 1:L_interval-1
                u_interv=find(x_scaled(:,col)>= intervals(interv) & x_scaled(:,col)< intervals(interv+1));
                results(interv).param((indice-1)*15+1:(indice-1)*15 + length(u_interv),col)=param(u_interv,col);
                av_x(interv)=median([intervals(interv) intervals(interv+1)]);
               
            end
       
        end
        
    elseif (type_data ~= 0 & input_data.tke==1)
         indice=indice+1;
        for col=1:length(z_axis)
            for interv = 1:L_interval-1
                u_interv=find(x_scaled(:,col)>= intervals(interv) & x_scaled(:,col)< intervals(interv+1));
                results(interv).param((indice-1)*15+1:(indice-1)*15 + length(u_interv),col)=param(u_interv,col);
                av_x(interv)=median([intervals(interv) intervals(interv+1)]);
                 
            end
       
        end
    end
end

temp=[];
for i=1:length(results)
    temp=[temp;nanmean(results(i).param)];
    
end
results(1).scaled_param=temp;
results(1).xaxis=av_x;
results(1).zaxis=z_axis;