clear all;
close all;

yr=59;	%total year
cd ~/output/H04S1/amoc/
amocS1=importdata('H04S1_amoc.mat');
cd ~/output/H04S2/amoc/
amocS2=importdata('H04S2_amoc.mat');
cd ~/output/H04S3/amoc/
amocS3=importdata('H04S3_amoc.mat');
cd ~/output/H04S4/amoc/
amocS4=importdata('H04S4_amoc.mat');
cd ~/output/H04S5/amoc/
amocS5=importdata('H04S5_amoc.mat');
cd ~/output/S03/amoc/
mean_amocS1=zeros(1,yr);
mean_amocS2=zeros(1,yr);
mean_amocS3=zeros(1,yr);
mean_amocS4=zeros(1,yr);
mean_amocS5=zeros(1,yr);
mean_amoc=zeros(1,yr);
for i=1:yr
    mean_amocS1(i)=mean(amocS1((i-1)*12+1:i*12));
    mean_amocS2(i)=mean(amocS2((i-1)*12+1:i*12));
    mean_amocS3(i)=mean(amocS3((i-1)*12+1:i*12));
    mean_amocS4(i)=mean(amocS4((i-1)*12+1:i*12));
    mean_amocS5(i)=mean(amocS5((i-1)*12+1:i*12));
    mean_amoc(i)=(mean_amocS1(i)+mean_amocS2(i)+mean_amocS3(i)...
        +mean_amocS4(i)+mean_amocS5(i))/5;
end

figure;
hold on;
plot(1948:2006,mean_amocS1,'-r','linewidth',2);
plot(1948:2006,mean_amocS2,'--g','linewidth',2);
plot(1948:2006,mean_amocS3,'-.b','linewidth',2);
plot(1948:2006,mean_amocS4,'--','linewidth',2,'color',[1 0 1]);
plot(1948:2006,mean_amocS5,'-x','linewidth',2,'color',[0 1 1]);
plot(1948:2006,mean_amoc,'-','color',[0.5 .5 .5],'linewidth',4);
legend('H04S1','H04S2','H04S3','H04S4','H04S5','Mean');
set(gca,'xlim',[1948 2006],'fontsize',24,'fontweight','normal');
set(gca,'xgrid','on','ygrid','on','gridlinestyle','--','linewidth',2,'fontsize',15)
box on;
title('AMOC during 1948-2006','fontsize',20,'fontweight','normal'); xlabel('Model Year','fontsize',20,'fontweight','normal');
ylabel('Sv (10^6 m^3/s)','fontsize',20,'fontweight','normal');
set(gcf,'position',[0 400 1024 768],'renderer','painters','PaperPositionMode','auto');
% print -painter -r300 -dpng amoc.png
% print -painter -r300 -depsc amoc.eps
