% Plots all attenuation of flood waves

clear

%% Load all *.mat files

fdir = '/Users/Colin/Documents/MATLAB/DFlow/mass_Mo_chap3/bndry_Ma_vs_t';
s = what(fdir); %change dir for your directory name 
matfiles = s.mat;
for a=1:numel(matfiles)
    load(char(matfiles(a)))
end

%% Plot attenuation

fsize = 22;
h = figure(1);
h.Units = 'inches';
h.Position = [1 1 11 15];
h.PaperSize = [16 12];
set(gcf,'Color','white')

subplot(3,2,1)
plot(xs_max_Q_27km_s180pback(:,1)*250/1000,...
    xs_max_Q_27km_s180pback(:,3)/180,'k-')
hold on
plot(xs_max_Q_27km_pres180pback(:,1)*250/1000,...
    xs_max_Q_27km_pres180pback(:,3)/180,'k--')
set(gca,'Fontsize',fsize)
%xlabel('Distance downstream (km)')
ylabel({'Attenuation Ratio'; '(Peak Discharge)'})
axis([0 27 0.75 1])
grid on

subplot(3,2,3)
plot(xs_max_Q_27km_m180pback(:,1)*250/1000,...
    xs_max_Q_27km_m180pback(:,3)/180,'k-')
hold on
plot(xs_max_Q_27km_prem180pback(:,1)*250/1000,...
    xs_max_Q_27km_prem180pback(:,3)/180,'k--')
set(gca,'Fontsize',fsize)
%xlabel('Distance downstream (km)')
ylabel({'Attenuation Ratio'; '(Peak Discharge)'})
axis([0 27 0.75 1])
grid on

subplot(3,2,5)
plot(xs_max_Q_27km_l180pback(:,1)*250/1000,...
    xs_max_Q_27km_l180pback(:,3)/180,'k-')
hold on
plot(xs_max_Q_27km_prel180pback(:,1)*250/1000,...
    xs_max_Q_27km_prel180pback(:,3)/180,'k--')
set(gca,'Fontsize',fsize)
xlabel('Distance downstream (km)')
ylabel({'Attenuation Ratio'; '(Peak Discharge)'})
axis([0 27 0.75 1])
grid on

subplot(3,2,2)
plot(xs_max_Q_27km_s300pback(:,1)*250/1000,...
    xs_max_Q_27km_s300pback(:,3)/300,'k-')
hold on
plot(xs_max_Q_27km_pres300pback(:,1)*250/1000,...
    xs_max_Q_27km_pres300pback(:,3)/180,'k--')
set(gca,'Fontsize',fsize)
% legend('Right CH-FP','Left CH-FP','Flood peak leaves reach',...
%     'Location','Northeast')
%xlabel('Distance downstream (km)')
%ylabel({'Attenuation Ratio'; '(Peak Discharge)'})
axis([0 27 0.75 1])
grid on

subplot(3,2,4)
plot(xs_max_Q_27km_m300pback(:,1)*250/1000,...
    xs_max_Q_27km_m300pback(:,3)/300,'k-')
hold on
plot(xs_max_Q_27km_prem300pback(:,1)*250/1000,...
    xs_max_Q_27km_prem300pback(:,3)/180,'k--')
set(gca,'Fontsize',fsize)
% legend('Right CH-FP','Left CH-FP','Flood peak leaves reach',...
%     'Location','Northeast')
%xlabel('Distance downstream (km)')
%ylabel({'Attenuation Ratio'; '(Peak Discharge)'})
axis([0 27 0.75 1])
grid on

subplot(3,2,6)
plot(xs_max_Q_27km_l300pback(:,1)*250/1000,...
    xs_max_Q_27km_l300pback(:,3)/300,'k-')
hold on
plot(xs_max_Q_27km_prel300pback(:,1)*250/1000,...
    xs_max_Q_27km_prel300pback(:,3)/180,'k--')
set(gca,'Fontsize',fsize)
% legend('Right CH-FP','Left CH-FP','Flood peak leaves reach',...
%     'Location','Northeast')
xlabel('Distance downstream (km)')
%ylabel({'Attenuation Ratio'; '(Peak Discharge)'})
axis([0 27 0.75 1])
grid on
hold off

print('-fillpage',['/Users/Colin/Documents/MATLAB/DFlow/mass_Mo_chap3/'...
    'Qattenuation/figures/abq10a12_QpAttenuation'],'-dpdf');