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

SSLTSF2_temp=ncread('~/Aerosol_Variaiton/IRUN/read_nc/ncfile/read_nc_SSLTSF.nc','SSLTSF2');
SSLTSF2_ANN=zeros(144,96,150);
SSLTSF2_ANN(:,:,:)=mean(SSLTSF2_temp,3);


save('SSLTSF2.mat','SSLTSF2_ANN')

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