
addpath ~/matlab/mats
addpath ~/matlab/ingo

%
CNAM='NBF1850OC_f19_tn11_02';
YEAR1=1001;
YEARN=2000;

CFACT=0.5;
CFACS=0.05;

%
load(['../Data/ocnstats_' CNAM '_' sprintf('%4.4i-%4.4i',YEAR1,YEARN) '.mat']);
ny=size(ocnstats.global.templvl,2);
%load ../Data/depth.mat 
load ../Data/depth70.mat 
depth=depth70

fff=17;
%
figure
clf
orient tall
subplot(2,1,1,'position',[0.13 0.66 0.8 0.3])
hold on 
plot([1:ny]+YEAR1-1,ocnstats.global.templvl,'k','linewidth',1)

hold off 
text(1950,3.55,'a','fontsize',26)
set(gca,'xlim',[0 ny]+YEAR1-1,'fontsize',fff);
set(gca,'ylim',[3.4 3.6],'fontsize',fff,'ytick',3.4:0.05:3.6);
ylabel('Global ocean temperature ({}^\circC)','fontsize',fff)
%title('Global mean ocean temperature','fontsize',12,'fontweight','bold')
grid on 

subplot(2,1,2,'position',[0.13 0.1 0.8 0.52])
hold on
imagesc([1:ny]+YEAR1-1,depth/1000,ocnstats.profile_anomaly.templvl');
hold off

% note! gcc-yaxislable is probably not correct here!!
text(1950,4,'c','fontsize',26)
set(gca,'xlim',[0 ny]+YEAR1-1,'ylim',[0 7],'ydir','reverse','ytick',0:2:6,'fontsize',fff)
xlabel('Year','fontsize',fff)
ylabel('Depth (km)','fontsize',fff)
caxis([-1 1]*CFACT)
cc=colorbar('southoutside');set(cc,'fontsize',fff);
colormap(cbsafemap(511,'rdbu'))
%
print(gcf,'-depsc2',['ocean_temp_' CNAM '_' sprintf('%4.4i-%4.4i',YEAR1,YEARN) '.eps'])
print(gcf,'-dpng','-r300',['ocean_temp_' CNAM '_' sprintf('%4.4i-%4.4i',YEAR1,YEARN) '.png'])

figure
clf
orient tall
subplot(2,1,1,'position',[0.13 0.66 0.8 0.3])
hold on
plot([1:ny]+YEAR1-1,ocnstats.global.salnlvl,'k','linewidth',1)
hold off
text(1950,34.7235,'b','fontsize',26)
%set(gca,'xlim',[0 ny]+YEAR1-1,'ylim',[34.720 34.730]+0.6,'fontweight','bold')
%set(gca,'xlim',[0 ny]+YEAR1-1,'ylim',[34.69 34.73]+0.6,'fontweight','bold')  % mis3 fwf
set(gca,'xlim',[0 ny]+YEAR1-1,'ylim',[34.722 34.724],'fontsize',fff,'ytick',34.722:0.001:34.724)
ylabel('Global ocean salinity (psu)','fontsize',fff)
%title('Global mean ocean salinity','fontsize',12,'fontsize',12)
grid on 
%
subplot(2,1,2,'position',[0.13 0.1 0.8 0.52])
hold on
imagesc([1:ny]+YEAR1-1,depth/1000,ocnstats.profile_anomaly.salnlvl');
hold off
text(1950,4,'d','fontsize',26)
set(gca,'xlim',[0 ny]+YEAR1-1,'ylim',[0 7],'ydir','reverse','ytick',0:2:6,'fontsize',fff)
xlabel('Year','fontsize',fff)
ylabel('Depth (km)','fontsize',fff)
caxis([-1 1]*CFACS)
cc=colorbar('southoutside');set(cc,'fontsize',fff);
colormap(cbsafemap(511,'rdbu'))
print(gcf,'-depsc2',['ocean_salt_' CNAM '_' sprintf('%4.4i-%4.4i',YEAR1,YEARN) '.eps'])
print(gcf,'-dpng','-r300',['ocean_salt_' CNAM '_' sprintf('%4.4i-%4.4i',YEAR1,YEARN) '.png'])
