year=1979:2014;
lon_ECMWF=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/SST/dat/SST_ECMWF.nc','longitude');
lat_ECMWF=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/SST/dat/SST_ECMWF.nc','latitude');
month=1:length(year)*12;

SST_MONTH=ncread('~/Aerosol_Variaiton/IRUN/SST/ncfile/SST_monthly_ECMWF_1979_2014.nc','SST_MONTH');

NINO34=zeros(length(month),1);
NINO34(:)=mean(mean(SST_MONTH(11:60,86:95,:),2),1);   %120W-170W, 5S-5N

save('NINO34_monthly_ECMWF_1979_2014.mat','NINO34')

nccreate('NINO34_monthly_ECMWF_1979_2014.nc','Month','Dimensions',{'time',Inf},'Format','classic')
ncwrite('NINO34_monthly_ECMWF_1979_2014.nc','Month', month)
ncwriteatt('NINO34_monthly_ECMWF_1979_2014.nc','Month','long_name','Month')
nccreate('NINO34_monthly_ECMWF_1979_2014.nc','NINO34','Dimensions',{'month',length(month)},'Format','classic')
ncwrite('NINO34_monthly_ECMWF_1979_2014.nc','NINO34', NINO34)
ncdisp('NINO34_monthly_ECMWF_1979_2014.nc')