load_path
%addpath /automount1/mgoes/matlab/Hilbert_Huang
%addpath /automount1/mgoes/matlab/pcatool
%addpath /data/mgoes/matlab/mapcolor/colors/
%addpath /automount1/mgoes/matlab/m_map/
addpath /data/mgoes/SA_gyre/wavelet/Felipe
addpath /phodnet/share/mgoes/SUDIP/NINO

display('LOAD data...')
ninoi = {'tni','emi','nino34','nino4'}
for nn=1:length(ninoi)
nino = ninoi{nn} %'nino34'
switch nino
    case 'tni'
load_tni;slp_reg    = weim(7,'rect',tni);
    case 'emi'
load_emi;slp_reg    = weim(7,'rect',emi);
    case 'nino34'
load_nino34;slp_reg = weim(7,'rect',nino34);
    case 'nino4'
load_nino4;slp_reg  = weim(7,'rect',nino4);
end
yfrac = yfrac(1:299);
slp_reg =slp_reg(1:299);
%% CORRELATE TO PCs%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%ygfrac=month2yfraction(julian2month(oi.time));

for nmod = 1:3
[PC2,~,mo] = make_monthly_mean(real(PC(nmod,:)),month);
PC2=PC2(1:277);
slp_reg = slp_reg(1:277);
R = corr(slp_reg(:),PC2(:));
fprintf('%s%s%s%d%s%3.4f\n','CORR(',nino,' x PC',nmod,') = ',R)
figure(nn+10);
subplot(3,1,nmod)
plot(yfrac(1:277),(PC2(:)-mean(PC2))/std(PC2))
hold on
plot(yfrac(1:277),(slp_reg(:)-mean(slp_reg))/std(slp_reg))
% um = subplot('Position',[0.1900 0.3100 0.6412 0.2 ])%7550 ]);
% plot(yfrac,(PC2(:)-mean(PC2))/std(PC2))
% axis tight;ylim([-3.5 3.5])
% set(gca,'linewidth',1.5)
% text(1990,2.5,'c.','backgroundcolor',[1 1 1],'fontweight','bold')
% leg=legend(upper(nino),'SLP','location','northwest');set(leg,'box','off','orientation','horizontal')%outside')
%stop
%figname = sprintf('%s%d%s','CORR_SLP_MODE',nmod,'_b.jpg')
%print('-dpng','-r400',figname)
end %for nmod
end