% Fig 11
clear
close all

%% load
load('CL_TCCIP_c0_end_TRHprec_2xCO2_transform_raw.mat');
Cevap_e = [nan(7,1);Cevap(1:end-7)];
Ctrans_e = [nan(7,1);Ctrans(1:end-7)];
Gevap_e = [nan(7,1);Gevap(1:end-7)];
LE_e = Cevap_e+Ctrans_e+Gevap_e;
clear Swnet Lwnet Swdw Swup U10 WIND QDRIP QINTR RSSUN RSSHA
clear Cevap Ctrans Gevap CH2O LE QBOT Q2M RH2M Prec SH TBOT T2M PBOT photo TV TG

load('CL_TCCIP_ctl_transform_raw.mat');
Cevap_c = [nan(7,1);Cevap(1:end-7)];
Ctrans_c = [nan(7,1);Ctrans(1:end-7)];
Gevap_c = [nan(7,1);Gevap(1:end-7)];
LE_c = Cevap_c+Ctrans_c+Gevap_c;
clear Swnet Lwnet Swdw Swup U10 WIND QDRIP QINTR RSSUN RSSHA
clear Cevap Ctrans Gevap CH2O LE QBOT Q2M RH2M Prec SH TBOT T2M PBOT photo TV TG

day_data = 24;
%% ttest
LE_hour_c = nan(1095,24);
LE_hour_e = nan(1095,24);
h = nan(24,1); p = nan(24,1);
for i = 1:24
    LE_hour_c(:,i) = LE_c(i:24:end);
    LE_hour_e(:,i) = LE_e(i:24:end);
    [h_pair,p_pair]=ttest(LE_hour_e(:,i),LE_hour_c(:,i),0.01,'left');
    h(i,1) = h_pair; p(i,1) = p_pair;
end 
save('Fig_11_LE_p_value.mat','p')
