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

WIND_year=ncread('/Users/yangyang/Aerosol_Variaiton/DRUN/WIND/ncfile/WIND_10th.nc','WIND_year');
TVERT=ncread('/Users/yangyang/Aerosol_Variaiton/DRUN/TVERT/ncfile/TVERT.nc','TVERT_DJF');


TVERT_weak_temp=zeros(96,30,sum(WIND_year));
n=0;
for yearID=1:length(year)
    if WIND_year(yearID)==1
        n=n+1;
        TVERT_weak_temp(:,:,n)=TVERT(:,:,yearID);
    end
end
TVERT_weak=mean(TVERT_weak_temp,3);


TVERT_aveg=mean(TVERT,3);
TVERT_diff=TVERT_weak-TVERT_aveg;

save('TVERT_10th.mat','TVERT_weak','TVERT_aveg','TVERT_diff')

nccreate('TVERT_10th.nc','lev','Dimensions',{'lev',30},'Format','classic')
ncwrite('TVERT_10th.nc','lev', lev)
nccreate('TVERT_10th.nc','lat','Dimensions',{'lat',96},'Format','classic')
ncwrite('TVERT_10th.nc','lat', lat)
ncwriteatt('TVERT_10th.nc','lat','units','degrees_north')
ncwriteatt('TVERT_10th.nc','lat','long_name','Latitude')
nccreate('TVERT_10th.nc','TVERT_weak','Dimensions',{'lat',96,'lev',30},'Format','classic')
ncwrite('TVERT_10th.nc','TVERT_weak', TVERT_weak)
nccreate('TVERT_10th.nc','TVERT_aveg','Dimensions',{'lat',96,'lev',30},'Format','classic')
ncwrite('TVERT_10th.nc','TVERT_aveg', TVERT_aveg)
nccreate('TVERT_10th.nc','TVERT_diff','Dimensions',{'lat',96,'lev',30},'Format','classic')
ncwrite('TVERT_10th.nc','TVERT_diff', TVERT_diff)
ncdisp('TVERT_10th.nc')