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;

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

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

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

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

VWND_DJF=VWND_DJF_temp(:,:,1978-1948+1:1992-1948+1);

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

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