%-------------------------------------------------------------------------
%   Show calculated Transports and show measured against calculated
%
%   Created by René Buijsrogge 9-jan-2009
%   modified 27 jan 2009  
%   modified juli/aug 2009
%   University of Twente
%   Santoss project
%-------------------------------------------------------------------------

function showresults(inn_rs,n,alphas,alphar,m,Qs,Qsx,Qsy,Unet,CAL,N,Ref,Tflow,Tosc)
    GraphType='tiff' ;
    inn_rst = inn_rs' ;%  transponeren ivm displayen
    
%     disp(['SFLTc : ',num2str(inn_rst(1,:))])
%     disp(['wss    : ',num2str(inn_rst(2,:))])    
%     disp(['Tc      : ',num2str(inn_rst(3,:))])   
%     disp(['SFLTt  : ',num2str(inn_rst(4,:))])
%     disp(['Tt       : ',num2str(inn_rst(5,:))])    
%     disp(['Rh       : ',num2str(inn_rst(6,:))])    
%     disp(['Sc       : ',num2str(inn_rst(7,:))])
%     disp(['Scr      : ',num2str(inn_rst(8,:))])    
%     disp(['St       : ',num2str(inn_rst(9,:))])    
%     disp(['Delta   : ',num2str(inn_rst(10,:))])
%     disp(['D50     : ',num2str(inn_rst(11,:))])    
%     disp(['t         : ',num2str(inn_rst(12,:))])   
%     disp(['ucx     : ',num2str(inn_rst(14,:))])    
%     disp(['ucy     : ',num2str(inn_rst(15,:))])    
%     disp(['uc       : ',num2str(inn_rst(16,:))])
%     disp(['utx      : ',num2str(inn_rst(17,:))])    
%     disp(['uty      : ',num2str(inn_rst(18,:))])    
%     disp(['ut        : ',num2str(inn_rst(19,:))])    
%  
%     disp(['n         : ',num2str(n)])
%     disp(['alphas  : ',num2str(alphas)])
%     disp(['alphar  : ',num2str(alphar)])
%     disp(['m        : ',num2str(m)])  
%     
%     disp(['Qs       : ',num2str(inn_rst(13,:))])
%     disp(['Qsx     : ',num2str(Qsx')])  
%     disp(['Qsy     : ',num2str(Qsy')])   
    
%% ====================================================================
    figure(1)   % III.1  
%====================================================================    
    set(gcf, 'DefaultAxesFontName', 'Times New Roman'); 
    set(gcf, 'DefaultTextFontName', 'Times New Roman'); 
%     set(gca,'FontSize',15);
    pos=get(gca,'position');
    set(gca,'position', [pos(1) pos(2)  0.85*pos(3)  pos(4) ] ) ;
    dset1 = strcmp(Tflow,'w')==1  ;
    dset2=max([strcmp(Tosc,'ia'),strcmp(Tosc,'ra')],[],2);
    SelectedDataset = dset1==1 & dset2==1;
    inn_rs_Qsx1 =[ inn_rs,Qsx,SelectedDataset]; % Add Qsx and Grad also
    inn_a_Qsx=inn_rs_Qsx1(find(inn_rs_Qsx1(:,29) == 1),:);% Selected dataset       
    clear SelectedDataset dset1  dset2;
    dset1 = strcmp(Tflow,'w')==1  ;
    dset2=max([strcmp(Tosc,'ias'),strcmp(Tosc,'iss'),strcmp(Tosc,'ras'),strcmp(Tosc,'rss')],[],2);
    SelectedDataset = dset1==1 & dset2==1;
    inn_rs_Qsx1 =[ inn_rs,Qsx,SelectedDataset]; % Add Qsx and Grad also
    inn_b_Qsx=inn_rs_Qsx1(find(inn_rs_Qsx1(:,29) == 1),:);% Selected dataset   
    clear SelectedDataset;
    SelectedDataset = strcmp(Tflow,'wc')==1; %  convert  character notation to numeric notation
    inn_rs_Qsx2 =[ inn_rs,Qsx,SelectedDataset]; % Add Qsx and Grad also
    inn_c_Qsx=inn_rs_Qsx2(find(inn_rs_Qsx2(:,29) == 1),:);% Selected dataset 
    clear SelectedDataset;
    SelectedDataset = strcmp(Tflow,'sw')==1; %  convert  character notation to numeric notation
    inn_rs_Qsx3 =[ inn_rs,Qsx,SelectedDataset]; % Add Qsx and Grad also
    inn_d_Qsx=inn_rs_Qsx3(find(inn_rs_Qsx3(:,29) == 1),:);% Selected dataset
    inn_rs_Qsx =[ inn_rs,Qsx]; % Add Qsx and Grad also    
    hold on
    plot(1e6*inn_a_Qsx(:,13),1e6*inn_a_Qsx(:,28), 'ob','Markersize',4)
    plot(1e6*inn_b_Qsx(:,13),1e6*inn_b_Qsx(:,28), 'ob','markerfacecolor','y','Markersize',4)
    plot(1e6*inn_c_Qsx(:,13),1e6*inn_c_Qsx(:,28), 'ob','markerfacecolor','r','Markersize',4)  % 13 = Qs  28=Qsx 
    plot(1e6*inn_d_Qsx(:,13),1e6*inn_d_Qsx(:,28), 'ob','markerfacecolor','g','Markersize',4)  % 13 = Qs  28=Qsx     

    %%%% Unselect to show graded sand results
%     plot(Qs(1),Qsx(1),'ob','markerfacecolor','b','Markersize',6)
%     hold on
%     plot(Qs(2:5),Qsx(2:5),'ob','markerfacecolor','r','Markersize',6)
%     plot(Qs(6:13),Qsx(6:13),'ob','markerfacecolor','g','Markersize',6)
%     plot(Qs(14:19),Qsx(14:19),'ob','markerfacecolor','y','Markersize',6)
%     plot(Qs(9:15),Qsx(9:15),'xb','markerfacecolor','b','Markersize',6)
%     legend('Inui et al (1995)','Hamm et al (1998)','Hassan (2003)','O\prime D. & Wright (2004)','fine sand',2)
    %%%%% End graded sand results
    set(gca,'box', 'on');
    set(gca,'linewidth',1);
%     set(gca,'GridLineStyle','-');
    axis(1e6*[-.00025  0.00025   -0.00025   0.00025]);
    ylabel('Calculated: q_s (\times 10^{-6} m^2/s)')
    xlabel('Measured:  q_s (\times 10^{-6} m^2/s)')
    plot(1e6*[-0.005, 0.04], 1e6*[-0.005, 0.04], 'k-')
    plot(1e6*[-0.005, 0.04], 1e6*[-0.01, 0.08], 'k--')    
    plot(1e6*[-0.005, 0.04], 1e6*[-0.0025, 0.02], 'k--')   
    plot(1e6*[-0.005, 0.04], 1e6*[0, 0.], 'k-','Linewidth',2)
    plot(1e6*[0, 0.], 1e6*[-0.005, 0.04], 'k-','Linewidth',2)      
    grid on
    hl = legend('velocity-skewed waves','acceleration-skewed waves','waves + current','surface waves');
    set(hl,'Location','northwest');    
    print -depsc transportrates.eps
    print -dpng transportrates.png
    
% %====================================================================
%     figure(2)   % III.2 uit overzicht
% %====================================================================    
%     clear SelectedDataset inn_rs_Qsx inn_a_Qsx inn_b_Qsx
%     pos=get(gca,'position');
%     set(gca,'position', [pos(1) pos(2)  0.85*pos(3)  pos(4) ] ) ;
%     % Select dataset  Tflow = 'w' or 'wc', no other options in dataset
%     inn_rs_Qsx =[ inn_rs,Qsx]; % Add Qsx
%     inn_a_Qsx=inn_rs_Qsx(find(inn_rs_Qsx(:,11) <0.0002),:);% fine sand
%     inn_b_Qsx=inn_rs_Qsx(find(inn_rs_Qsx(:,11) >= 0.0002),:);% medium sand
%     hold on
%     %     set(gca,'XScale','log','YScale','log');    
%     plot(inn_a_Qsx(:,13),inn_a_Qsx(:,28), 'ob','markerfacecolor','g')  % 13 = Qs  28=Qsx 
%     plot(inn_b_Qsx(:,13),inn_b_Qsx(:,28), 'ob','markerfacecolor','y')  % 13 = Qs  28=Qsx 
%     %     plot(Qs,Qsx, 'bo') 
%     %     axis([-1e-4 1e-4  -1e-4  1e-4]);
%     %      axis([-.005 0.04 -.005 0.04]); % maximum curr alone included
%    set(gca,'FontSize',10);
%    set(gca,'Fontname','Arial');
%    set(gca,'fontweight','b'); % normal = 'n'
%    set(gca,'box', 'on');
%    set(gca,'linewidth',1);
%    set(gca,'GridLineStyle', '-');
%    %     set(gca,'xtick',[-25:25:125])
%    %     set(gca,'ytick',[-25:25:125])   
%    %     figure
%    %     h=plot(randn(100,1));
%    % get(gcf)
%    % get(gca)
%    %     get(h)
%    axis([-.00025  0.00025   -0.00025   0.00025]);
%    % title('21 oct 2009 v2.05')   
%     legend('fine sand', 'medium sand','FontSize', 20,'Location', 'southeast')
%     ylabel('Calculated: Qsx [m^2/s]','fontsize',11,'fontweight','b')
%     xlabel('Measured:  Qs [m^2/s]','fontsize',11,'fontweight','b')
%     plot([-0.005, 0.04], [-0.005, 0.04], 'k-')
%     plot([-0.005, 0.04], [-0.01, 0.08], 'k--')    
%     plot([-0.005, 0.04], [-0.0025, 0.02], 'k--')   
%     plot([-0.005, 0.04], [0, 0.], 'k-','Linewidth',2)
%     plot([0, 0.], [-0.005, 0.04], 'k-','Linewidth',2)      
%     text(-.0003,-0.00031 , ['N: ',num2str(N)], 'Fontsize',8,'Fontname', 'Arial' )
%     dim=size(inn_a_Qsx);
%     text(-0.00025,-0.00031 , ['n sub1 ',num2str(dim(1,1))], 'Fontsize',8,'Fontname', 'Arial' )
%     dim=size(inn_b_Qsx);
%     text(-0.0002,-0.00031 , ['n sub2 ',num2str(dim(1,1))], 'Fontsize',8,'Fontname', 'Arial' )
%     text(-0.00015,-0.00031 , ['alphar ',num2str(alphar)], 'Fontsize',8,'Fontname', 'Arial' )
%     text(-0.00010,-0.00031 , ['alphas : ',num2str(alphas)], 'Fontsize',8,'Fontname', 'Arial' )
%     text(-0.00005,-0.00031 , ['Rs ',num2str(CAL(2))], 'Fontsize',8,'Fontname', 'Arial' )
%     text(-0.00000,-0.00031 , ['fac2 ',num2str(CAL(3))], 'Fontsize',8,'Fontname', 'Arial' )
%     text(0.00005,-0.00031, ['fac5 ',num2str(CAL(4))], 'Fontsize',8,'Fontname', 'Arial' )
%     text(0.00010,-0.00031, ['fac10 ',num2str(CAL(5))], 'Fontsize',8,'Fontname', 'Arial' )
%     text(0.00015,-0.00031, ['betahat ',num2str(CAL(1))], 'Fontsize',8,'Fontname', 'Arial' )
%     text(0.00022,-0.00031, ['n ',num2str(n)], 'Fontsize',8,'Fontname', 'Arial' )
%     text(0.00025,-0.00031, ['m ',num2str(m)], 'Fontsize',8,'Fontname', 'Arial' )
%     grid on
%     GraphType='tiff' ;
%     saveas(gcf,strcat('figIIIp2'),GraphType)  
%     GraphType='fig' ;
%     saveas(gcf,strcat('figIIIp2'),GraphType) 
% %====================================================================
%     figure(3)   %I.4 uit overzicht
% %====================================================================    
% %     clear SelectedDataset inn_rs_Qsx inn_a_Qsx inn_b_Qsx
% %     pos=get(gca,'position');
% %     set(gca,'position', [pos(1) pos(2)  0.85*pos(3)  pos(4) ] ) ;
% %     % Select dataset  Tflow = 'w' or 'wc', no other options in dataset
% %     inn_rs_Qsx =[ inn_rs,Qsx]; % Add Qsx
% %     inn_a_Qsx=inn_rs_Qsx(find(inn_rs_Qsx(:,6) ~=0),:);% ripple
% %     inn_b_Qsx=inn_rs_Qsx(find(inn_rs_Qsx(:,6) == 0),:);% sheetflow   
% %     hold on
% %     %     set(gca,'XScale','log','YScale','log');    
% %     plot(inn_a_Qsx(:,13),inn_a_Qsx(:,28), 'ob','markerfacecolor','g')  % 13 = Qs  28=Qsx 
% %     plot(inn_b_Qsx(:,13),inn_b_Qsx(:,28), 'ob','markerfacecolor','y')  % 13 = Qs  28=Qsx 
% %  
% %     %     plot(Qs,Qsx, 'bo') 
% %     %     axis([-1e-4 1e-4  -1e-4  1e-4]);
% %     %      axis([-.005 0.04 -.005 0.04]); % maximum curr alone included
% %    set(gca,'FontSize',10);
% %    set(gca,'Fontname','Arial');
% %    set(gca,'fontweight','b'); % normal = 'n'
% %    set(gca,'box', 'on');
% %    set(gca,'linewidth',1);
% %    set(gca,'GridLineStyle', '-');
% %    %     set(gca,'xtick',[-25:25:125])
% %    %     set(gca,'ytick',[-25:25:125])   
% %    %     figure
% %    %     h=plot(randn(100,1));
% %    % get(gcf)
% %    % get(gca)
% %    %     get(h)
% %    axis([-.00025  0.00025   -0.00025   0.00025]);
% %    % title('21 oct 2009 v2.05')   
% %     legend('ripples', 'sheetflow','FontSize', 20,'Location', 'southeast')
% %     ylabel('Calculated: Qsx [m^2/s]','fontsize',11,'fontweight','b')
% %     xlabel('Measured:  Qs [m^2/s]','fontsize',11,'fontweight','b')
% %     plot([-0.005, 0.04], [-0.005, 0.04], 'k-')
% %     plot([-0.005, 0.04], [-0.01, 0.08], 'k--')    
% %     plot([-0.005, 0.04], [-0.0025, 0.02], 'k--')   
% %     plot([-0.005, 0.04], [0, 0.], 'k-','Linewidth',2)
% %     plot([0, 0.], [-0.005, 0.04], 'k-','Linewidth',2)      
% %     text(-.0003,-0.00031 , ['N: ',num2str(N)], 'Fontsize',8,'Fontname', 'Arial' )
% %     dim=size(inn_a_Qsx);
% %     text(-0.00025,-0.00031 , ['n sub1 ',num2str(dim(1,1))], 'Fontsize',8,'Fontname', 'Arial' )
% %     dim=size(inn_b_Qsx);
% %     text(-0.0002,-0.00031 , ['n sub2 ',num2str(dim(1,1))], 'Fontsize',8,'Fontname', 'Arial' )  
% %     text(-0.00015,-0.00031 , ['alphar ',num2str(alphar)], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(-0.00010,-0.00031 , ['alphas : ',num2str(alphas)], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(-0.00005,-0.00031 , ['Rs ',num2str(CAL(2))], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(-0.00000,-0.00031 , ['fac2 ',num2str(CAL(3))], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(0.00005,-0.00031, ['fac5 ',num2str(CAL(4))], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(0.00010,-0.00031, ['fac10 ',num2str(CAL(5))], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(0.00015,-0.00031, ['betahat ',num2str(CAL(1))], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(0.00022,-0.00031, ['n ',num2str(n)], 'Fontsize',8,'Fontname', 'Arial' )
% %     text(0.00025,-0.00031, ['m ',num2str(m)], 'Fontsize',8,'Fontname', 'Arial' )
% %     grid on
%     GraphType='tiff' ;
%     saveas(gcf,strcat('fig1p4'),GraphType)  
%     GraphType='fig' ;
%     saveas(gcf,strcat('fig1p4'),GraphType)     




end