load ~/NC/grid
year=1:150;

OMEGAVERT_temp=ncread('~/Aerosol_Variaiton/DRUN/read_nc/ncfile/read_nc_OMEGAVERT.nc','OMEGAVERT');

OMEGAVERT_DJF=zeros(96,30,150);

OMEGAVERT_DJF(:,:,1)=mean(OMEGAVERT_temp(:,:,[1,2],1),3);
for yearID=2:150
    OMEGAVERT_DJF(:,:,yearID)=(OMEGAVERT_temp(:,:,12,yearID-1)+OMEGAVERT_temp(:,:,1,yearID)+OMEGAVERT_temp(:,:,2,yearID))/3;
end


save('OMEGAVERT.mat','OMEGAVERT_DJF')

nccreate('OMEGAVERT.nc','Year','Dimensions',{'time',Inf},'Format','classic')
ncwrite('OMEGAVERT.nc','Year', year)
ncwriteatt('OMEGAVERT.nc','Year','long_name','Year')
nccreate('OMEGAVERT.nc','lev','Dimensions',{'lev',30},'Format','classic')
ncwrite('OMEGAVERT.nc','lev', lev)
nccreate('OMEGAVERT.nc','lat','Dimensions',{'lat',96},'Format','classic')
ncwrite('OMEGAVERT.nc','lat', lat)
ncwriteatt('OMEGAVERT.nc','lat','units','degrees_north')
ncwriteatt('OMEGAVERT.nc','lat','long_name','Latitude')
nccreate('OMEGAVERT.nc','OMEGAVERT_DJF','Dimensions',{'lat',96,'lev',30,'year',length(year)},'Format','classic')
ncwrite('OMEGAVERT.nc','OMEGAVERT_DJF', OMEGAVERT_DJF)
ncdisp('OMEGAVERT.nc')