clc;clear all;close all
addpath('/data3/yiwen/cesm_final_exp/matlab_toolbox/m_map')
load('/data3/yiwen/cesm2/SST_TCCIP/1013/TS_clm.mat')

D15=nanmean(t1,3);D45=nanmean(t2,3);
D95=nanmean(t3,3);D197=nanmean(t4,3);

%12*(30yr)=360%
ST=1;END=360;

% JJA %
month6=ST+5:12:END;
month68=[(ST+5:12:END)' (ST+6:12:END)' (ST+7:12:END)']
month68=[month68(1,:) month68(2,:) month68(3,:) month68(4,:) month68(5,:) ]

% DJF %
month12=ST+11:12:END;
month12=[(ST+0:12:END)' (ST+1:12:END)' (ST+11:12:END)']
month12=[month12(1,:) month12(2,:) month12(3,:) month12(4,:) month12(5,:)]

D15_1=nanmean(t1(:,:,month68),3);D15_2=nanmean(t1(:,:,month12),3);
D45_1=nanmean(t2(:,:,month68),3);D45_2=nanmean(t2(:,:,month12),3);
D95_1=nanmean(t3(:,:,month68),3);D95_2=nanmean(t3(:,:,month12),3);
D197_1=nanmean(t4(:,:,month68),3);D197_2=nanmean(t4(:,:,month12),3);

set(0,'defaultfigurecolor','w')
figure;
subplot(1,3,1)
m_proj('miller','lat',[17,28],'lon',[114,126]);
m_pcolor(clm.lonr,clm.latr,D15);shading interp;hold on
m_coast('patch','w','edgecolor','k');
m_grid('linestyle','none','Fontsize',20,'Linewidth',3,...
       'xaxis','bottom','xtick',3,'ytick',3);
title({'depth=15m'})
cbar = colorbar('location','eastoutside');cbar.Title.String = "C";
set(cbar,'FontSize',20);m_map=m_colmap('jet');colormap(m_map);
set(gca,'Linewidth',3);set(gca,'Fontsize',20)
caxis([15 31])
% caxis([23 32])
% caxis([13 28])


subplot(1,3,2)
m_proj('miller','lat',[17,28],'lon',[114,126]);
m_pcolor(clm.lonr,clm.latr,D45);shading interp;hold on
m_coast('patch','w','edgecolor','k');
m_grid('linestyle','none','Fontsize',20,'Linewidth',3,...
       'xaxis','bottom','xtick',3,'ytick',3);
title({'depth=45m'})
cbar = colorbar('location','eastoutside');cbar.Title.String = "C";       
set(cbar,'FontSize',20);
m_map=m_colmap('jet');colormap(m_map);
set(gca,'Linewidth',3);set(gca,'Fontsize',20)
caxis([17 31])
%  caxis([19 31])
%  caxis([14 28])


subplot(1,3,3)
m_proj('miller','lat',[17,28],'lon',[114,126]);
m_pcolor(clm.lonr,clm.latr,D95);shading interp;hold on
m_coast('patch','w','edgecolor','k');
m_grid('linestyle','none','Fontsize',20,'Linewidth',3,...
       'xaxis','bottom','xtick',3,'ytick',3);
title({'depth=95m'})
cbar = colorbar('location','eastoutside');cbar.Title.String = "C"; 
set(cbar,'FontSize',20);
m_map=m_colmap('jet');colormap(m_map);
set(gca,'Linewidth',3);set(gca,'Fontsize',20)
caxis([16 28])



figure;
m_proj('miller','lat',[17,28],'lon',[114,126]);
m_pcolor(clm.lonr,clm.latr,D197);shading interp;hold on
m_coast('patch','w','edgecolor','k');
m_grid('box','fancy','linestyle','none','Fontsize',10);
title({'annual mean'; 'depth=197m'},'Fontsize',12)
cbar = colorbar('location','eastoutside');
cbar.Title.String = "C";            
m_map=m_colmap('jet');colormap(m_map);
set(gca,'Linewidth',2);set(gca,'Fontsize',12)
caxis([12 22])
% caxis([14 23])
% caxis([12 23])
