year=1948:2014;
lon=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/RH/dat/RHum.mon.mean.nc','lon');
lat=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/RH/dat/RHum.mon.mean.nc','lat');

RH_ANN=zeros(144,73,length(year));
RH_temp=ncread('/Users/yangyang/Aerosol_Variaiton/IRUN/RH/dat/rhum.mon.mean.nc','rhum');

for yearID=(1+1948-1948):(length(year)+1948-1948)
    RH_ANN(:,:,yearID-(1948-1948))=mean(RH_temp(:,:,2,(yearID-1)*12+1:(yearID-1)*12+12),4);
end


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

nccreate('RH_NCEP.nc','Year','Dimensions',{'year',length(year)},'Format','classic')
ncwrite('RH_NCEP.nc','Year', year)
ncwriteatt('RH_NCEP.nc','Year','long_name','Year 1948-2006')
nccreate('RH_NCEP.nc','lat','Dimensions',{'lat',73},'Format','classic')
ncwrite('RH_NCEP.nc','lat', lat)
ncwriteatt('RH_NCEP.nc','lat','units','degrees_north')
ncwriteatt('RH_NCEP.nc','lat','long_name','Latitude')
nccreate('RH_NCEP.nc','lon','Dimensions',{'lon',144},'Format','classic')
ncwrite('RH_NCEP.nc','lon', lon)
ncwriteatt('RH_NCEP.nc','lon','units','degrees_east')
ncwriteatt('RH_NCEP.nc','lon','long_name','Longitude')
nccreate('RH_NCEP.nc','RH_ANN','Dimensions',{'lon',144,'lat',73,'year',length(year)},'Format','classic')
ncwrite('RH_NCEP.nc','RH_ANN', RH_ANN)
ncdisp('RH_NCEP.nc')
