%

clear;
close all;
status=load('eof_olr_noaa_annuel_jas_1020.mat','C','olr');
C=status.C;
olr=status.olr;
clear status;

olr=olr';
PC1=olr*C;

%%%%%%% cronique de la VP1
time_serie_olr1=PC1(:,325);
time_serie_olr2=PC1(:,324);
time_serie_olr3=PC1(:,323);

dt_olr1=std(time_serie_olr1);
dt_olr2=std(time_serie_olr2);
dt_olr3=std(time_serie_olr3);

moy_olr1=mean(time_serie_olr1);
moy_olr2=mean(time_serie_olr2);
moy_olr3=mean(time_serie_olr3);

orient('landscape')
subplot(2,2,1);
for a=1:28;
   time_serie_olr1(a)=(time_serie_olr1(a)-moy_olr1)/dt_olr1;
   time_serie_olr2(a)=(time_serie_olr2(a)-moy_olr2)/dt_olr2;
   time_serie_olr3(a)=(time_serie_olr3(a)-moy_olr3)/dt_olr3;
end

status=save('eof1_noaa_annuel_20.txt','time_serie_olr1','-ASCII');
status=save('eof2_noaa_annuel_20.txt','time_serie_olr2','-ASCII');
status=save('eof3_noaa_annuel_20.txt','time_serie_olr3','-ASCII');

x=[1:28]';
koro1=time_serie_olr1;
koro2=time_serie_olr2;
koro3=time_serie_olr3;

clear x;
x=[1979:2006]';
aa=plot(x,-koro1,'r');
hold on
bb=plot(x,-koro2,'k');
cc=plot(x,-koro3,'g');
dd=legend('eof1','eof2','eof3');
legend boxoff
set (dd,'Fontsize',8);
y=zeros(28,1);
plot(x,y,'k:');
title('serie temporelle eof NOAA annuel domaine 10S-20N');
axis([1979 2006 -3 3]);
set (gca,'YTick',[-3:1:3],'YTickLabel',[-3:1:3],'fontname','Arial','fontsize',6);
set (gca,'XTick',[1980:5:2005],'XTickLabel',[1980:5:2005],'fontname','Arial','fontsize',6);
set (gca,'tickDir','out');
print('-depsc2','time_serie_eof_noaa_annuel_20.eps');
