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

RH_temp=ncread('~/Aerosol_Variaiton/IRUN/read_nc/ncfile/read_nc_RH.nc','RH');

RH_temp(isnan(RH_temp))=1e-10;

RH_ANN=zeros(144,96,150);

RH_ANN(:,:,:)=mean(RH_temp,3);


save('RH.mat','RH_ANN')

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