r_figs_summary_v.m 12.2 KB
function r_figs_summary_v(nbF)
% R_FIGS_SUMMARY_V - Produces summary figures for speed ans TKE.
%
%
% Syntax:  R_FIGS_SUMMARY_V
%
% Example: r_figs_summary_v
%
% Other m-files required: none
% Subfunctions: none
% MAT-files required: $fps_$f_$_summary_results_v.mat (produced by R_DATA_V)
%                     list1.mat 
%
% See also: R_DATA_V and R_FIGS_V
%
% Author: Marie-Pier Marquis, Dany Dumont
% UQAR/ISMER
% email: dany_dumont@uqar.ca
% Website: http://www.ismer.ca/dumont-dany
% 14 October 2013, Last revision: October 2014
% ______________________________________________________________________
%%
nbFStr         = num2str(nbF);
bar            =  0;      % 1 : with errorbar
                    % 0 : without errorbar

rootdir        = r_root(nbF);
listfile2      = [rootdir, '/info.mat'];
listfile       = [rootdir,'/list1.mat'];
load(listfile) 
load(listfile2)

ave            = info.average;  % from r_data_pos
aveStr         = num2str(ave);  % from r_data_pos
fps            = info.fps;
fpsStr         = num2str(fps);
dt             = info.dt;
dtStr          = num2str(dt);
sumRes        = info.sumResultV;
SumTkeTitle    = info.SumTkeTitle;
meanTkeTitle   = info.meanTkeTitle;
tkeNormDtTitle = info.tkeNormDtTitle;
meanTkeDtTitle = info.meanTkeDtTitle;

sumdir         = [rootdir,'/',fpsStr,'fps_',nbFStr,'f_',dtStr,'dt_',aveStr,'ave',sumRes];
sumdatafile    = [sumdir,'/',fpsStr,'fps_',nbFStr,'f_',dtStr,'dt_',aveStr,'ave',sumRes,'.mat'];
if ~exist(sumdir,'dir');
    mkdir(sumdir)
end
cd(sumdir)
load(sumdatafile)

lw = 1.5;
ms = 10;
tp = [6.5 8.0 9.5 11.0 12.5 14.0 15.5 17.0 18.5 20.0];

%% One figure for each row
normTke     = nan.*ones(6,10);
normStdTke  = nan.*ones(6,10);

for r = 1 : 16
    rowNumber = num2str(r);
    
    for h = 1 : 5  
        if     h == 1
            hs = 2;
        elseif h == 2
            hs = 3;
        elseif h == 3
            hs = 4;
        elseif h == 4
            hs = 6;
        elseif h == 5
            hs = 8;
        elseif h == 6
            hs = 10;
        end
        
        normTke(h,:)    = (100.*meanTke(h,:,r))./((hs)^2);  
        normStdTke(h,:) = (100.*stdTke(h,:,r))./(hs^2);
    end
        
    figure(r); clf
    
    hold on
    if bar == 0
        plot(tp,normTke(1,:),'sqk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTke(2,:),'vk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTke(3,:),'ok','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTke(4,:),'xk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTke(5,:),'*k','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTke(6,:),'+k','MarkerSize',ms,'LineWidth',lw);
    elseif bar == 1
        errorbar(tp,normTke(1,:),normStdTke(1,:),'sqk','MarkerSize',5,...
                   'MarkerFaceColor','black');
        errorbar(tp,normTke(2,:),normStdTke(2,:),'vk','MarkerSize',5,...
                   'MarkerFaceColor','black');
        errorbar(tp,normTke(3,:),normStdTke(3,:),'ok','MarkerSize',5,...
                   'MarkerFaceColor','black');
        errorbar(tp,normTke(4,:),normStdTke(4,:),'xk','MarkerSize',5,...
                   'MarkerFaceColor','black');
        errorbar(tp,normTke(5,:),normStdTke(5,:),'*k','MarkerSize',5,...
                   'MarkerFaceColor','black');
        errorbar(tp,normTke(6,:),normStdTke(6,:),'+k','MarkerSize',5,...
                   'MarkerFaceColor','black');
    end
    plot(tp,0.*tp,'--k');
    hold off
        
    set(gca,'FontName','Times New Roman','FontSize',14);
    xlabel('\itT \rm(s)','FontName','Times New Roman','FontSize',18);
    ylabel('TKE\rm/H^2      (s^{-2})','FontName','Times New Roman',...
                   'FontSize',18);
    legend('\itH \rm= 2m','\itH \rm= 3m','\itH \rm= 4m','\itH \rm= 6m',...
             '\itH \rm= 8m','\itH \rm= 10m','location','NorthEastOutside');
    
    if bar == 0
        ylim([(min(min(min(normTke)),0)-0.001) (max(max(max(normTke)),...
            0)+0.001)])
    elseif bar == 1
        ylim([(min(min(min(normTke))- max(max(normStdTke)),0)-0.001)...
            (max(max(max(normTke))+max(max(normStdTke)),0)+0.001)])
    end
        xlim([6 21])
    
    if bar == 0
        print([SumTkeTitle,fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','row_',rowNumber,'.png'],'-dpng'); 
    elseif bar == 1
        print([SumTkeTitle,'e_',fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','row_',rowNumber,'.png'],'-dpng'); 
    end

end
    
% rows all put together

normMeanTke  = nan.*ones(6,10);
normStdTke   = nan.*ones(6,10);
for t = 1 : 10
    for        h = 1 : 5
        if     h == 1
            hs = 2;
        elseif h == 2
            hs = 3;
        elseif h == 3
            hs = 4;
        elseif h == 4
            hs = 6;
        elseif h == 5
            hs = 8;
        elseif h == 6
            hs = 10;
        end
 
        normMeanTke(h,t)  = (100.*(nanmean(meanTke(h,t,:))))./(hs^2);
        normStdTke(h,t) = (100.*(nanmean(stdTke(h,t,:))))./(hs^2);
    end  
end
figure(17);clf
hold on    
if bar == 0
    plot(tp,normMeanTke(1,:),'sqk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTke(2,:),'vk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTke(3,:),'ok','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTke(4,:),'xk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTke(5,:),'*k','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTke(6,:),'*k','MarkerSize',ms,'LineWidth',lw);
elseif bar == 1 
    errorbar(tp,normMeanTke(1,:),normStdTke(1,:),'sqk','MarkerSize',...
        5,'MarkerFaceColor','black');
    errorbar(tp,normMeanTke(2,:),normStdTke(2,:),'vk','MarkerSize',5,...
        'MarkerFaceColor','black');
    errorbar(tp,normMeanTke(3,:),normStdTke(3,:),'ok','MarkerSize',5,...
        'MarkerFaceColor','black');
    errorbar(tp,normMeanTke(4,:),normStdTke(4,:),'xk','MarkerSize',5,...
        'MarkerFaceColor','black');
    errorbar(tp,normMeanTke(5,:),normStdTke(5,:),'*k','MarkerSize',5,...
        'MarkerFaceColor','black');
    errorbar(tp,normMeanTke(6,:),normStdTke(6,:),'+k','MarkerSize',5,...
        'MarkerFaceColor','black');
end
plot(tp,0.*tp,'--k');
hold off
 
set(gca,'FontName','Times New Roman','FontSize',14);
xlabel('\itT   \rm(s)','FontName','Times New Roman','FontSize',18);
ylabel('TKE\rm/H^2      (s^{-2})','FontName','Times New Roman',...
    'FontSize',18);
legend('\itH \rm= 2m','\itH \rm= 3m','\itH \rm= 4m','\itH \rm= 6m',...
    '\itH \rm= 8m','\itH \rm= 10m','location','NorthEastOutside');

if bar == 1
    ylim([(min(min(min(normMeanTke))- max(max(normStdTke)),0)-0.001)...
        (max(max(max(normMeanTke))+max(max(normStdTke)),0)+0.001)])
elseif bar == 0
    ylim([(min(min(min(normMeanTke)),0)-0.001)...
        (max(max(max(normMeanTke)),0)+0.001)])
end
xlim([6 21])

if bar == 0
    print([meanTkeTitle,fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','.png'],'-dpng');
elseif bar == 1
    print([meanTkeTitle,'e_',fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','.png'],'-dpng');
end














%% dt
normTkeDt = nan.*ones(6,10);
normStdDt = nan.*ones(6,10);
for r = 1 : 16
    rowNumber = num2str(r);
    
    for h = 1 : 5  
        if     h == 1
            hs = 2;
        elseif h == 2
            hs = 3;
        elseif h == 3
            hs = 4;
        elseif h == 4
            hs = 6;
        elseif h == 5
            hs = 8;
        elseif h == 6
            hs = 10;
        end
        normTkeDt(h,:)  = (100.*(meanTkeDt(h,:,r)))./((hs)^2); 
        normStdDt(h,:)  = (100.*stdTkeDt(h,:,r))./(hs^2);
    end
        
    figure(17+r); clf
    
    hold on
    if bar == 0
        plot(tp,normTkeDt(1,:),'sqk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTkeDt(2,:),'vk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTkeDt(3,:),'ok','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTkeDt(4,:),'xk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTkeDt(5,:),'*k','MarkerSize',ms,'LineWidth',lw);
        plot(tp,normTkeDt(6,:),'+k','MarkerSize',ms,'LineWidth',lw);
        
        
    elseif bar == 1
        errorbar(tp,normTkeDt(1,:),normStdDt(1,:),'sqk','MarkerSize',...
            5,'MarkerFaceColor','black');
        errorbar(tp,normTkeDt(2,:),normStdDt(2,:),'vk','MarkerSize',...
            5,'MarkerFaceColor','black');
        errorbar(tp,normTkeDt(3,:),normStdDt(3,:),'ok','MarkerSize',...
            5,'MarkerFaceColor','black');
        errorbar(tp,normTkeDt(4,:),normStdDt(4,:),'xk','MarkerSize',...
            5,'MarkerFaceColor','black');
        errorbar(tp,normTkeDt(5,:),normStdDt(5,:),'*k','MarkerSize',...
            5,'MarkerFaceColor','black');
        errorbar(tp,normTkeDt(6,:),normStdDt(6,:),'+k','MarkerSize',...
            5,'MarkerFaceColor','black');
    end
    plot(tp,0.*tp,'--k');
    hold off
        
    set(gca,'FontName','Times New Roman','FontSize',14);
    xlabel('\itT \rm(s)','FontName','Times New Roman','FontSize',18);
    ylabel('TKE\rm/H^2      (s^{-2})','FontName','Times New Roman',...
        'FontSize',18);
    legend('\itH \rm= 2m','\itH \rm= 3m','\itH \rm= 4m','\itH \rm= 6m',...
        '\itH \rm= 8m','\itH \rm= 10m','location','NorthEastOutside');
    
    if bar == 0
        ylim([(min(min(min(normTkeDt)),0)-0.001)...
            (max(max(max(normTkeDt)),0)+0.001)])
    elseif bar == 1
        ylim([(min(min(min(normTkeDt))- max(max(normStdDt)),0)-0.001)...
            (max(max(max(normTkeDt))+max(max(normStdDt)),0)+0.001)])
    end
    xlim([6 21])
    
    if bar == 0
        print([tkeNormDtTitle,fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','row_',...
            rowNumber,'.png'],'-dpng');
    elseif bar == 1
        print([tkeNormDtTitle,'e_',fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','row_',...
            rowNumber,'.png'],'-dpng');
    end
        
        
        
end
    

% rows all put together
normMeanTkeDt  = nan.*ones(6,10);
normMeanStdDt  = nan.*ones(6,10);

for t = 1 : 10
    for        h = 1 : 5
        if     h == 1
            hs = 2;
        elseif h == 2
            hs = 3;
        elseif h == 3
            hs = 4;
        elseif h == 4
            hs = 6;
        elseif h == 5
            hs = 8;
        elseif h == 6
            hs = 10;
        end
 
        normMeanTkeDt(h,t)  = (100.*nanmean(meanTkeDt(h,t,:)))./(hs^2);
        normMeanStdDt(h,t)  = (100.*nanmean(stdTkeDt(h,t,:)))./(hs^2);
        
    end  
end
figure(17+17);clf
hold on  
if bar == 0
    plot(tp,normMeanTkeDt(1,:),'sqk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTkeDt(2,:),'vk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTkeDt(3,:),'ok','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTkeDt(4,:),'xk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTkeDt(5,:),'*k','MarkerSize',ms,'LineWidth',lw);
    plot(tp,normMeanTkeDt(6,:),'+k','MarkerSize',ms,'LineWidth',lw);
elseif bar == 1
    errorbar(tp,normMeanTkeDt(1,:),normMeanStdDt(1,:),'sqk',...
        'MarkerSize',5,'MarkerFaceColor','black');
    errorbar(tp,normMeanTkeDt(2,:),normMeanStdDt(2,:),'vk',...
        'MarkerSize',5,'MarkerFaceColor','black');
    errorbar(tp,normMeanTkeDt(3,:),normMeanStdDt(3,:),'ok',...
        'MarkerSize',5,'MarkerFaceColor','black');
    errorbar(tp,normMeanTkeDt(4,:),normMeanStdDt(4,:),'xk',...
        'MarkerSize',5,'MarkerFaceColor','black');
    errorbar(tp,normMeanTkeDt(5,:),normMeanStdDt(5,:),'*k',...
        'MarkerSize',5,'MarkerFaceColor','black');
    errorbar(tp,normMeanTkeDt(6,:),normMeanStdDt(6,:),'+k',...
        'MarkerSize',5,'MarkerFaceColor','black');
end
plot(tp,0.*tp,'--k');
hold off
 
set(gca,'FontName','Times New Roman','FontSize',14);
xlabel('\itT   \rm(s)','FontName','Times New Roman','FontSize',18);
ylabel('TKE\rm/H^2      (s^{-2})','FontName','Times New Roman',...
    'FontSize',18);
legend('\itH \rm= 2m','\itH \rm= 3m','\itH \rm= 4m','\itH \rm= 8m',...
    '\itH \rm= 10m','location','NorthEastOutside');
if bar == 0 
    ylim([(min(min(min(normMeanTkeDt)),0)-0.001)...
        (max(max(max(normMeanTkeDt)),0)+0.001)])
elseif bar == 1
    ylim([(min(min(min(normMeanTkeDt))- max(max(normMeanStdDt)),...
        0)-0.001) (max(max(max(normMeanTkeDt))+max(max(normMeanStdDt)),...
        0)+0.001)])
end
xlim([6 21])

if bar == 0
    print([meanTkeDtTitle,fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','.png'],...
        '-dpng');
elseif bar == 1
    print([meanTkeDtTitle,'e_',fpsStr,'fps',nbFStr,'f_',dtStr,'dt_',aveStr,'ave_','.png'],...
        '-dpng');
end







end