hurricane='isabel';
 rep='unfiltered\';
files=dir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\wavelength analysis\same_psd_length\',rep,'*.mat']);
c=1;
for fil=1:length(files)
    load(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\',hurricane,'\data\wavelength analysis\same_psd_length\',rep,files(fil).name]);
    for ii=2:length(lambda)
        for jj=1:24% # of heights, up to 1500m every 25m
            psd=lambda(ii).psd(:,jj);
            height(jj).psd(c,:)=psd';
            %trans(ii).psd(fil,:)=psd';
            
        end
        c=c+1;
    end
end
c=0;
 height(1).total=[];
%trans(1).total=[];
for i=1:24
     u=find(~isnan(sum(height(i).psd,2)));
      %u=find(~isnan(sum(trans(i).psd,2)));

    if length(u)>=1
         height(i).avg=mean(height(i).psd(u,:),1);
         height(1).total=[height.total;height(i).avg];

%         trans(i).avg=mean(trans(i).psd(u,:),1);
%         trans(1).total=[trans(1).total;trans(i).avg];
    else
       
        height(i).avg=NaN*ones(1,513);
         height(1).total=[height.total;height(i).avg];
        c=c+1;
    end
end
NumUniquePts=ceil((1024+1)/2);
f=(0:NumUniquePts-1)*(1/25)/1024;
f=f';
h=0:25:600-(c+1)*25;
plan=1:13;
u=find((1./f)<=15000);
%hsp=figure;
hsp=contourf((1./(f(u))),h,height(1).total(1:length(h),u),25);
shading flat
set(gca,'Xscale','log')
%title(num2str((a)));
 set(gca,'Xtick',[300 500 800 1000 1500 3000 5000 10000]);
colorbar
v=[0,max(max(height(1).total(:,u)))];
caxis(v)
%saveas(hsp,['C:\Documents and Settings\sylvie lorsolo\My Documents\research\frances\images\wavelength analysis\average by trans\wavelength while filt\spec_avg_trans',num2str((lambda(a).trans)),'_2500.fig'])



