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

UWND=ncread('~/Aerosol_Variaiton/DRUN/read_nc/ncfile/read_nc_UWND.nc','UWND');
VWND=ncread('~/Aerosol_Variaiton/DRUN/read_nc/ncfile/read_nc_VWND.nc','VWND');
WIND_temp=sqrt(UWND.*UWND+VWND.*VWND);

WIND_DJF=zeros(144,96,150);

WIND_DJF(:,:,1)=mean(WIND_temp(:,:,[1,2],1),3);
for yearID=2:150
    WIND_DJF(:,:,yearID)=WIND_temp(:,:,1,yearID);
end


save('WIND_01.mat','WIND_DJF')

nccreate('WIND_01.nc','Year','Dimensions',{'time',Inf},'Format','classic')
ncwrite('WIND_01.nc','Year', year)
ncwriteatt('WIND_01.nc','Year','long_name','Year')
nccreate('WIND_01.nc','lat','Dimensions',{'lat',96},'Format','classic')
ncwrite('WIND_01.nc','lat', lat)
ncwriteatt('WIND_01.nc','lat','units','degrees_north')
ncwriteatt('WIND_01.nc','lat','long_name','Latitude')
nccreate('WIND_01.nc','lon','Dimensions',{'lon',144},'Format','classic')
ncwrite('WIND_01.nc','lon', lon)
ncwriteatt('WIND_01.nc','lon','units','degrees_east')
ncwriteatt('WIND_01.nc','lon','long_name','Longitude')
nccreate('WIND_01.nc','WIND_DJF','Dimensions',{'lon',144,'lat',96,'year',length(year)},'Format','classic')
ncwrite('WIND_01.nc','WIND_DJF', WIND_DJF)
ncdisp('WIND_01.nc')