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');
load ~/Aerosol_Variaiton/IRUN/RH/ncfile/RH_NCEP2.mat

RH_EN_temp=RH_ANN(:,:,[6 10 16 18 22 25 30 35 40 44 45 46 47 50 55 57 59]);
RH_LL_temp=RH_ANN(:,:,[3 8 9 17 23 24 26 27 28 41 49 51 53 61]);

RH_EN=mean(RH_EN_temp,3);
RH_LL=mean(RH_LL_temp,3);
h=zeros(144,73);
for i=1:144
    for j=1:73
        h(i,j)=ttest2(RH_EN_temp(i,j,:),RH_LL_temp(i,j,:));
    end
end

Diff_RH=RH_EN-RH_LL;

save('Diff_RH_NCEP_ENSO_1948_2014.mat','RH_EN','RH_LL','Diff_RH','h')

nccreate('Diff_RH_NCEP_ENSO_1948_2014.nc','lat','Dimensions',{'lat',73},'Format','classic')
ncwrite('Diff_RH_NCEP_ENSO_1948_2014.nc','lat', lat)
ncwriteatt('Diff_RH_NCEP_ENSO_1948_2014.nc','lat','units','degrees_north')
ncwriteatt('Diff_RH_NCEP_ENSO_1948_2014.nc','lat','long_name','Latitude')
nccreate('Diff_RH_NCEP_ENSO_1948_2014.nc','lon','Dimensions',{'lon',144},'Format','classic')
ncwrite('Diff_RH_NCEP_ENSO_1948_2014.nc','lon', lon)
ncwriteatt('Diff_RH_NCEP_ENSO_1948_2014.nc','lon','units','degrees_east')
ncwriteatt('Diff_RH_NCEP_ENSO_1948_2014.nc','lon','long_name','Longitude')
nccreate('Diff_RH_NCEP_ENSO_1948_2014.nc','RH_EN','Dimensions',{'lon',144,'lat',73},'Format','classic')
ncwrite('Diff_RH_NCEP_ENSO_1948_2014.nc','RH_EN', RH_EN)
nccreate('Diff_RH_NCEP_ENSO_1948_2014.nc','RH_LL','Dimensions',{'lon',144,'lat',73},'Format','classic')
ncwrite('Diff_RH_NCEP_ENSO_1948_2014.nc','RH_LL', RH_LL)
nccreate('Diff_RH_NCEP_ENSO_1948_2014.nc','Diff_RH','Dimensions',{'lon',144,'lat',73},'Format','classic')
ncwrite('Diff_RH_NCEP_ENSO_1948_2014.nc','Diff_RH', Diff_RH)
nccreate('Diff_RH_NCEP_ENSO_1948_2014.nc','h','Dimensions',{'lon',144,'lat',73},'Format','classic')
ncwrite('Diff_RH_NCEP_ENSO_1948_2014.nc','h', h)
ncdisp('Diff_RH_NCEP_ENSO_1948_2014.nc')