%

clear;
close all;

fid=fopen('olrf8-28_annuel.dat','r');
siz=25*17*28;
v=fread(fid,siz,'float');
fclose(fid);
olr=reshape(v,425,28);
clear v;

% calcul de la matrice de covariance
vaudou=zeros(425,425);
for a=1:425;
    for b=1:425;
      clear e d covaria;
      e=olr(b,:);
      d=olr(a,:);
      covaria=cov(e,d);
      vaudou(a,b)=covaria(2,1);
    end;
end;

% on diagonalise la matrice de covariance
[C,L]=eig(vaudou);

delete('eof_noaa_annuel_8_28.mat');
save('eof_noaa_annuel_8_28.mat','C','L','olr')
