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=1:67;
year2=1978:1992;

u_temp=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/UWND/dat/uwnd.mon.mean.nc','uwnd');

UWND_temp=zeros(length(lon),length(lat),12,length(year));

for yearID=1:length(year)
    UWND_temp(:,:,:,yearID)=u_temp(:,:,3,(yearID-1)*12+1:(yearID-1)*12+12);
end

UWND_DJF_temp=zeros(length(lon),length(lat),length(year));
for yearID=1:length(year)-1
    UWND_DJF_temp(:,:,yearID)=(UWND_temp(:,:,12,yearID)+UWND_temp(:,:,1,yearID+1)+UWND_temp(:,:,2,yearID+1))/3;
end

UWND_DJF=UWND_DJF_temp(:,:,1978-1948+1:1992-1948+1);

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

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