clear all;
close all;


amocS1=importdata('Ny6_amoc.mat');


nave=6; %half of running smooth.

%running smooth every 12 months: first time
len=length(amocS1);
mean_amocS1=zeros(1,len-2*nave);
for i=1+nave:len-nave
    mean_amocS1(i-nave)=mean(amocS1(i-6:i+6));
end

%running smooth every 12 months: second time
amocS1=mean_amocS1;

len=length(amocS1);
mean_amocS1=zeros(1,len-2*nave);

for i=1+nave:len-nave
    mean_amocS1(i-nave)=mean(amocS1(i-6:i+6));
end

%running smooth every 12 months: third time
amocS1=mean_amocS1;


len=length(amocS1);

for i=1+nave:len-nave
    mean_amocS1(i)=mean(amocS1(i-6:i+6));
end

%%running smooth again for every 12 months:forth time
amocS1=mean_amocS1;

len=length(amocS1);

for i=1+nave:len-nave
    mean_amocS1(i)=mean(amocS1(i-6:i+6));
end

figure;
hold on;
plot(mean_amocS1,'-k','linewidth',2);
% plot(mean_amoc(4:end-3),'-','color',[0.5 .5 .5],'linewidth',4);
% legend('H04S1','H04S2','H04S3','H04S4','H04S5','Mean');
% legend('exp1','exp2','exp3','exp4','exp5');
legend('AMOC');
set(gca,'xlim',[1 len-6],'fontsize',18,'fontweight','normal');
set(gca,'xtick',[12:120:len-6,len],'xticklabel',[1950:10:2010,2010],'tickdir','out','xlim',[1 733]);
set(gca,'xgrid','on','ygrid','on','gridlinestyle',':','linewidth',2)
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');
set(gca,'dataaspectratio',[50,1,1]);
print -painters -r300 -dpng Ny6_amoc_runsmoth.png
print -painters -r300 -depsc Ny6_amoc_runsmoth.eps
