lon=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/VWND/dat/vwnd.mon.mean.nc','lon');
lat=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/VWND/dat/vwnd.mon.mean.nc','lat');
year=1949:2016;

temp=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/VWND/dat/vwnd.mon.mean.nc','vwnd');

VWND_DJF=zeros(144,73,length(year));
VWND_DJF(:,:,:)=(temp(:,:,2,12:12:824)+temp(:,:,2,13:12:824)+temp(:,:,2,14:12:824))/3;

save('VWND_NCEP_1949_2016.mat','VWND_DJF')

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