load ~/NC/grid
load ~/NC/area_1.9_2.5.mat
year=1:150;

UWND_temp=ncread('~/Aerosol_Variaiton/ERUN/read_nc/ncfile/read_nc_CIR.nc','UWND');
UWND_ANN=zeros(144,30,150);
UWND_ANN(:,:,:)=mean(UWND_temp,3);

OMEGA_temp=ncread('~/Aerosol_Variaiton/ERUN/read_nc/ncfile/read_nc_CIR.nc','OMEGA');
OMEGA_ANN=zeros(144,30,150);
OMEGA_ANN(:,:,:)=mean(OMEGA_temp,3);

save('CIR.mat','UWND_ANN','OMEGA_ANN')

nccreate('CIR.nc','Year','Dimensions',{'time',Inf},'Format','classic')
ncwrite('CIR.nc','Year', year)
nccreate('CIR.nc','lev','Dimensions',{'lev',30},'Format','classic')
ncwrite('CIR.nc','lev', lev)
ncwriteatt('CIR.nc','Year','long_name','Year')
nccreate('CIR.nc','lat','Dimensions',{'lat',96},'Format','classic')
ncwrite('CIR.nc','lat', lat)
ncwriteatt('CIR.nc','lat','units','degrees_north')
ncwriteatt('CIR.nc','lat','long_name','Latitude')
nccreate('CIR.nc','lon','Dimensions',{'lon',144},'Format','classic')
ncwrite('CIR.nc','lon', lon)
ncwriteatt('CIR.nc','lon','units','degrees_east')
ncwriteatt('CIR.nc','lon','long_name','Longitude')
nccreate('CIR.nc','UWND_ANN','Dimensions',{'lon',144,'lev',30,'year',length(year)},'Format','classic')
ncwrite('CIR.nc','UWND_ANN', UWND_ANN)
nccreate('CIR.nc','OMEGA_ANN','Dimensions',{'lon',144,'lev',30,'year',length(year)},'Format','classic')
ncwrite('CIR.nc','OMEGA_ANN', OMEGA_ANN)
ncdisp('CIR.nc')