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

SSLTSF_temp=ncread('~/Aerosol_Variaiton/IRUN/read_nc/ncfile/read_nc_SSLTSF.nc','SSLTSF');
SSLTSF_ANN=zeros(144,96,150);
SSLTSF_ANN(:,:,:)=mean(SSLTSF_temp,3);


save('SSLTSF.mat','SSLTSF_ANN','SSLTSF_GLOBAL_ANN')

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