% amoc.m
% compute the amoc using ovrtrn_year_month.nc files

clear all;
close all;

EXPID='H03';
YEAR=1948;	! start of the year
YEAREND=2006; 	! end of the year
MONTH=01;
num=1;
while YEAR<=YEAREND
	
	while MONTH<=9
		
		var=getnc(strcat('ovrtrn.',int2str(YEAR),'.',...
		'0',int2str(MONTH),'.nc'),'amoc');
		AMOC(num)=var;
		num=num+1;
		MONTH=MONTH+1;
		
	end
	while MONTH<=12
		var=getnc(strcat('ovrtrn.',int2str(YEAR),'.',...
		int2str(MONTH),'.nc'),'amoc');
		AMOC(num)=var;
		num=num+1;
		MONTH=MONTH+1;

	end

	MONTH=1;
	display('The Year Is :');
	YEAR=YEAR+1
end
save  (strcat(EXPID,'_amoc','.mat'),'AMOC');
plot(AMOC,'-k','linewidth',2);
title ('Atlantic Meridonal Overturning Circulation','fontsize',12,'fontweight','bold')
xlabel('Year')
ylabel('Units:Sv');
%set(gca,'xtick',[1,241,481,696],'xticklabel',{'1948','1968','1988','2006'},'fontsize',12,'fontweight','bold');
set(gca,'xtick',[1,241],'xticklabel',{'1948','1968'},'fontsize',12,'fontweight','bold');
axis tight
saveas(gcf, strcat(EXPID,'_amoc'), 'png');
