clear all
close all


load H04S5_voltr_ave_times.mat voltr_net voltr_in voltr_out sec_name
% Fram Strait                   
% Barents Opening               
% Denmark Strait                
% Iceland - Scotland            
% Davies Strait                 
% British Channel
EXPID='H04S5';
lenfile=length(voltr_net);
figure(1);
set(gcf,'Position',[0 400 1024 768]);
subplot(2,1,1)
plot(voltr_net','linewidth',1);
% set(gca,'ylim',[-300 300],'ytick',-300:100:300,'xtick',3:5:lenfile,'xticklabel',...
% 	1950:5:1948+lenfile,'xgrid','on','ygrid','on');%ticklabel from 1950
set(gca,'xtick',3:5:lenfile,'xticklabel',...
	1950:5:1948+lenfile,'xgrid','on','ygrid','on');%ticklabel from 1950
set(gca,'xtick',[]);
% set(gca,'dataaspectratio',[1 0.4 1]);
H_len=legend(sec_name,'Location','East');
%set(H_len,'Units','normalized','Position',[0.775 0.717 0.119 0.0888888881],'fontsize',7)
set(H_len,'Units','normalized','fontsize',7)
% xlabel('Year','fontsize',12,'fontweight','bold');
ylabel('Volume Transport:Sv','fontsize',12,'fontweight','bold');
% title('Net Transports','fontsize',12,'fontweight','bold');

subplot(2,1,2)
%barents opening and fram strait
residual(1,:)=-voltr_net(1,:)+voltr_net(2,:)+voltr_net(3,:)-voltr_net(4,:)-voltr_net(6,:);
residual(2,:)=-voltr_net(3,:)+voltr_net(4,:)-voltr_net(5,:)+voltr_net(6,:);
plot(residual','linewidth',1);
set(gca,'xtick',3:5:lenfile,'xticklabel',...
	1950:5:1948+lenfile,'xgrid','on','ygrid','on');%ticklabel from 1950
% set(gca,'dataaspectratio',[1 0.4 1]);
H_len=legend('nordic sea residual','north atlanti residual','Location','East');
%set(H_len,'Units','normalized','Position',[0.775 0.717 0.119 0.0888888881],'fontsize',7)
set(H_len,'Units','normalized','fontsize',7)
xlabel('Year','fontsize',12,'fontweight','bold');
ylabel('Volume Transport Residual:Sv','fontsize',12,'fontweight','bold');
% title('Net Transports Residual','fontsize',12,'fontweight','bold');

msgbox('Adjust the Figure and then press ENTER','notice');
pause;
print -painter -dpng -r200 out.png;
oldname='out.png';
newname=strcat(EXPID,'_voltr_timeseries_net_residual.png');
movefile(oldname,newname);
print -painter -depsc -r200 out.eps;
oldname='out.eps';
newname=strcat(EXPID,'_voltr_timeseries_net_residual.eps');
movefile(oldname,newname);
% close(1)