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

VWNDVERT_temp=ncread('~/Aerosol_Variaiton/IRUN/read_nc/ncfile/read_nc_VWNDVERT.nc','VWNDVERT');

VWNDVERT_DJF=zeros(96,30,150);

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


save('VWNDVERT.mat','VWNDVERT_DJF')

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