% Plots historical and current discharge attenuation assuming the running
% of his_extract_chap1.m

f1=figure(1);
set(f1,'Color','white');

hist_2010_km18ratio = zeros(6,1);

for i=1:folder_num
    Qattenuation_2010 = xs_2010_cell{i,7};
    Qattenuation_hist = xs_hist_cell{i,7};
    Qattenuation_2010lidar = xs_2010lidar_cell{i,7};
    Qattenuation_prelidar = xs_prelidar_cell{i,7};
    Qdist_2010 = xs_2010_cell{i,6};
    Qdist_hist = xs_hist_cell{i,6};
    Qdist_2010lidar = xs_2010lidar_cell{i,6};
    Qdist_prelidar = xs_prelidar_cell{i,6};
    
    subplot(3,2,i)
    if i == 2
        sp2fi=fill([5 7 7 5],[0 0 1.5 1.5],[.9 .9 .9],'EdgeColor','none');
        hold on
        ax = gca;
        ax.ColorOrderIndex = 1;
    end
%     plot(Qdist_hist/1000,Qattenuation_hist);
%     hold on
%     plot(Qdist_2010/1000,Qattenuation_2010);
%     plot(Qdist_prelidar/1000,Qattenuation_prelidar,'--');
%     plot(Qdist_2010lidar/1000,Qattenuation_2010lidar,'--');
    plot(Qdist_hist(:,1)/1000,Qattenuation_hist(:,1));
    hold on
    plot(Qdist_2010(:,1)/1000,Qattenuation_2010(:,1),'--');
    plot(Qdist_prelidar(:,1)/1000,Qattenuation_prelidar(:,1),'-.');
    plot(Qdist_2010lidar(:,1)/1000,Qattenuation_2010lidar(:,1),':');
    if mod(i,2) == 0
        ylim([0.7 1])
    else
        ylim([0.7 1])
    end
    
    if i == 5
        xlabel('Distance downstream (km)');
    elseif i == 3
        ylabel('Discharge Attenuation Ratio');
    elseif i == 6
        xlabel('Distance downstream (km)');
        columnlegend(2,{'HC','CC','PL','CL'},'Location','SouthEast');
    end
    xlim([0 27])
    set(gca,'FontSize',14);
    set(gca,'Layer','top')
    
    hist_2010_km18ratio(i,1) =...
        (1- Qattenuation_hist(72,1)) / (1 - Qattenuation_2010(72,1));
    
end