function [results]=rmw_scaling_interp(input_data)

top_height=14000;
rmw_height=2000;
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:0.05:3];
L_interval=length(intervals);
indice=0;
max_row=round((M/2));%    % M/2 to consider only the tle files (or thr windfield files) because we want a matrix big enough 

param_scaled=NaN*ones(L_interval,max_row,max_col);
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);
    if (type_data == 0 & input_data.tke==0)
        M_a =ang_mom(tgwind,x_fill,input_data);
        vort = vort_calculation(tgwind,x_fill);
    else
        M_a=[];
        vort = [];
    end
    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,rmw_pos]=rmw_at_one_height(flight_data, tgwind, x_fill,z_axis,rmw_height);
        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)
            temp_var=param(:,col);
            temp_x_scaled=x_scaled(:,col);
            u_nan=find(isnan(param(:,col))==1);
            temp_var(u_nan)=[];
            temp_x_scaled(u_nan)=[];
            if length(temp_var)<20
                param_scaled(:,indice,col)=L_interval*NaN;
            else
                param_interp=interp1(temp_x_scaled,temp_var,intervals,'linear');
                param_scaled(:,indice,col)=param_interp';
            end
        end
        
    elseif (type_data ~= 0 & input_data.tke==1)
        indice=indice+1;
        for col=1:length(z_axis)
            temp_var=param(:,col);
            temp_x_scaled=x_scaled(:,col);
            u_nan=find(isnan(param(:,col))==1);
            temp_var(u_nan)=[];
            temp_x_scaled(u_nan)=[];
            if length(temp_var)<20
                param_scaled(:,indice,col)=L_interval*NaN;
            else
                param_interp=interp1(temp_x_scaled,temp_var,intervals,'linear');
                param_scaled(:,indice,col)=param_interp';
            end
        end
        
    end
    
end


for i=1:max_col
    temp=squeeze(param_scaled(:,:,i));
    temp2=nanmean(temp')';
    b(:,i)=temp2;
end
results(1).scaled_mean=b;
results(1).xaxis=intervals;
results(1).zaxis=z_axis;
results(1).param_scaled=param_scaled;



% contourf(intervals,z_axis,b',25)
% disp('stop')
