load /mobster/m1/data/nao/hurrell_monthly.dat
%
%#years x 13: years from 1865 to 2003 (last update)
% hurrell_monthly(:,1)=year
%
% columns are:
% 1 = year
% 2:13 = month J, F, M etc etc.
%
year=hurrell_monthly(:,1);
year=(year*ones(1,12))';
nao=hurrell_monthly(:,2:13)';


[m,n]=size(nao);
nao=reshape(nao,m*n,1);
nao_year=reshape(year,m*n,1);

nao_mos=(ones(n,1)*[1:12])';
nao_mos=reshape(nao_mos,m*n,1);
nao_day=ones(m*n,1)*15.;
nao_time=fracyr(nao_year,nao_mos,nao_day);
nao_date = datenum(nao_year,nao_mos,nao_day);

%
% Pad missing values with NaNs
%
nao=fillmiss(nao,-99,1,NaN);

%
% shorten the series to get rid of trailing NaN's
%
I = find(isnan(nao));
nao(I)=[];
nao_year(I)=[];
nao_mos(I)=[];
nao_day(I)=[];
nao_time(I)=[];
nao_date(I)=[];

clear m n hurrell_monthly 
clear year I

whos

save hurrell_monthly
