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

TVERT_temp=ncread('~/Aerosol_Variaiton/IRUN/read_nc/ncfile/read_nc_TVERT.nc','TVERT');

TVERT_DJF=zeros(96,30,150);

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


save('TVERT.mat','TVERT_DJF')

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