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

temp=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/UWND/dat/uwnd.mon.mean.nc','uwnd');
UWND_DJF=zeros(144,73,length(year));
UWND_DJF(:,:,:)=(temp(:,:,2,12:12:824)+temp(:,:,2,13:12:824)+temp(:,:,2,14:12:824))/3;

save('UWND_NCEP_1949_2016.mat','UWND_DJF')

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