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

WIND_year=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/WIND/ncfile/WIND_10th.nc','WIND_year');
VWND=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/VWND/ncfile/VWND_12.nc','VWND_DJF');

VWND_ECHINA=zeros(length(year),1);
VWND_ECHINA(:)=mean(mean(VWND(45:50,60:72,:),2),1);


VWND_weak_temp=zeros(144,96,sum(WIND_year));
VWND_ECHINA_weak=0;
n=0;
for yearID=1:length(year)
    if WIND_year(yearID)==1
        n=n+1;
        VWND_weak_temp(:,:,n)=VWND(:,:,yearID);
        VWND_ECHINA_weak=VWND_ECHINA_weak+VWND_ECHINA(yearID)/sum(WIND_year);
    end
end
VWND_weak=mean(VWND_weak_temp,3);


VWND_aveg=mean(VWND,3);
VWND_diff=VWND_weak-VWND_aveg;

VWND_ECHINA_aveg=mean(VWND_ECHINA);
VWND_ECHINA_diff=VWND_ECHINA_weak-VWND_ECHINA_aveg;

save('VWND_10th_12.mat','VWND_weak','VWND_aveg','VWND_diff')

nccreate('VWND_10th_12.nc','lat','Dimensions',{'lat',96},'Format','classic')
ncwrite('VWND_10th_12.nc','lat', lat)
ncwriteatt('VWND_10th_12.nc','lat','units','degrees_north')
ncwriteatt('VWND_10th_12.nc','lat','long_name','Latitude')
nccreate('VWND_10th_12.nc','lon','Dimensions',{'lon',144},'Format','classic')
ncwrite('VWND_10th_12.nc','lon', lon)
ncwriteatt('VWND_10th_12.nc','lon','units','degrees_east')
ncwriteatt('VWND_10th_12.nc','lon','long_name','Longitude')
nccreate('VWND_10th_12.nc','VWND_weak','Dimensions',{'lon',144,'lat',96},'Format','classic')
ncwrite('VWND_10th_12.nc','VWND_weak', VWND_weak)
nccreate('VWND_10th_12.nc','VWND_aveg','Dimensions',{'lon',144,'lat',96},'Format','classic')
ncwrite('VWND_10th_12.nc','VWND_aveg', VWND_aveg)
nccreate('VWND_10th_12.nc','VWND_diff','Dimensions',{'lon',144,'lat',96},'Format','classic')
ncwrite('VWND_10th_12.nc','VWND_diff', VWND_diff)
ncdisp('VWND_10th_12.nc')