<jupyter_start><jupyter_text>Load data<jupyter_code>#Calculate df_irr
_,_,f_irr_CRU = calc_irr_diff('CRU_CESM',response,yr_start1,yr_end1,yr_start2,yr_end2)
_,_,f_irr_CESM = calc_irr_diff('CESM',response,yr_start1,yr_end1,yr_start2,yr_end2)


#from ispinb_mask.ipynb
#Load mask from .mat file
mat_contents = sio.loadmat('mw_ispinb.mat') #Add path before filename if mw_ispinb.mat is not in current dir.
ispinb = mat_contents['ispinb'][::-1,:] #'::-1' flips the 1st axis

#Generate tuple of arrays with x- and y-indices to be used to select relevant indices from 2D-array, to be used in your script instead of the SAS indices
pinb_mask = np.where(ispinb==1)<jupyter_output><empty_output><jupyter_text>Execute algorithm  bb = 5Go to code in calc_irr_impact_regr.py and change bl to 2 on line 40.<jupyter_code># Re-load regression-based algorithm after this change
execfile('calc_irr_impact_regr.py')
###################################
#
#Calculate dT_irr
#Execute the algorithm to calculate
#dT_irr globally and regionally.
#
#N.B. this procedure fills the 
#bottom two panels of the plot.
#
###################################

#Define stacked array in which the results are stored
CRU_t = np.zeros((9, 192, 288))
CESM_t = np.zeros((9, 192, 288))

#Execute the algorithm for different threshold values for CRU and CESM
CRU_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)

CESM_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)


# WT:  save arrays as .mat files for making maps in matlab
#sio.savemat('formatlab_CRU_t.mat' , {'CRU_t':CRU_t})
#sio.savemat('formatlab_CESM_t.mat', {'CESM_t':CESM_t})
# WT


#Change to 1D, remove NaNs
CRU0 = CRU_t[0,:,:].ravel()[~np.isnan(CRU_t[0,:,:].ravel())]
CRU1 = CRU_t[1,:,:].ravel()[~np.isnan(CRU_t[1,:,:].ravel())]
CRU2 = CRU_t[2,:,:].ravel()[~np.isnan(CRU_t[2,:,:].ravel())]
CRU3 = CRU_t[3,:,:].ravel()[~np.isnan(CRU_t[3,:,:].ravel())]
CRU4 = CRU_t[4,:,:].ravel()[~np.isnan(CRU_t[4,:,:].ravel())]
CRU5 = CRU_t[5,:,:].ravel()[~np.isnan(CRU_t[5,:,:].ravel())]

CESM0 = CESM_t[0,:,:].ravel()[~np.isnan(CESM_t[0,:,:].ravel())]
CESM1 = CESM_t[1,:,:].ravel()[~np.isnan(CESM_t[1,:,:].ravel())]
CESM2 = CESM_t[2,:,:].ravel()[~np.isnan(CESM_t[2,:,:].ravel())]
CESM3 = CESM_t[3,:,:].ravel()[~np.isnan(CESM_t[3,:,:].ravel())]
CESM4 = CESM_t[4,:,:].ravel()[~np.isnan(CESM_t[4,:,:].ravel())]
CESM5 = CESM_t[5,:,:].ravel()[~np.isnan(CESM_t[5,:,:].ravel())]
# WT replaced sel by pinb_mask in next lines
#Extract the PINB signal for each threshold for CRU and CESM, removing NaN values 
CRU0_reg_pinb_bb5 = CRU_t[0,:,:][pinb_mask][~np.isnan(CRU_t[0,:,:][pinb_mask])]
CRU1_reg_pinb_bb5 = CRU_t[1,:,:][pinb_mask][~np.isnan(CRU_t[1,:,:][pinb_mask])]
CRU2_reg_pinb_bb5 = CRU_t[2,:,:][pinb_mask][~np.isnan(CRU_t[2,:,:][pinb_mask])]
CRU3_reg_pinb_bb5 = CRU_t[3,:,:][pinb_mask][~np.isnan(CRU_t[3,:,:][pinb_mask])]
CRU4_reg_pinb_bb5 = CRU_t[4,:,:][pinb_mask][~np.isnan(CRU_t[4,:,:][pinb_mask])]
CRU5_reg_pinb_bb5 = CRU_t[5,:,:][pinb_mask][~np.isnan(CRU_t[5,:,:][pinb_mask])]

# WT replaced mistake (CRU_t to CESM_t)
CESM0_reg_pinb_bb5 = CESM_t[0,:,:][pinb_mask][~np.isnan(CESM_t[0,:,:][pinb_mask])]
CESM1_reg_pinb_bb5 = CESM_t[1,:,:][pinb_mask][~np.isnan(CESM_t[1,:,:][pinb_mask])]
CESM2_reg_pinb_bb5 = CESM_t[2,:,:][pinb_mask][~np.isnan(CESM_t[2,:,:][pinb_mask])]
CESM3_reg_pinb_bb5 = CESM_t[3,:,:][pinb_mask][~np.isnan(CESM_t[3,:,:][pinb_mask])]
CESM4_reg_pinb_bb5 = CESM_t[4,:,:][pinb_mask][~np.isnan(CESM_t[4,:,:][pinb_mask])]
CESM5_reg_pinb_bb5 = CESM_t[5,:,:][pinb_mask][~np.isnan(CESM_t[5,:,:][pinb_mask])]
CRU_bb5 = np.zeros((6))
CESM_bb5 = np.zeros((6))
    
CRU_bb5[0] = np.nanmedian(CRU0_reg_pinb_bb5)
CRU_bb5[1] = np.nanmedian(CRU1_reg_pinb_bb5)
CRU_bb5[2] = np.nanmedian(CRU2_reg_pinb_bb5)
CRU_bb5[3] = np.nanmedian(CRU3_reg_pinb_bb5)
CRU_bb5[4] = np.nanmedian(CRU4_reg_pinb_bb5)
CRU_bb5[5] = np.nanmedian(CRU5_reg_pinb_bb5)

CESM_bb5[0] = np.nanmedian(CESM0_reg_pinb_bb5)
CESM_bb5[1] = np.nanmedian(CESM1_reg_pinb_bb5)
CESM_bb5[2] = np.nanmedian(CESM2_reg_pinb_bb5)
CESM_bb5[3] = np.nanmedian(CESM3_reg_pinb_bb5)
CESM_bb5[4] = np.nanmedian(CESM4_reg_pinb_bb5)
CESM_bb5[5] = np.nanmedian(CESM5_reg_pinb_bb5)<jupyter_output><empty_output><jupyter_text>bb = 7Go to code in calc_irr_impact_regr.py and change bl to 3 on line 40.<jupyter_code># Re-load regression-based algorithm after this change
execfile('calc_irr_impact_regr.py')
###################################
#
#Calculate dT_irr
#Execute the algorithm to calculate
#dT_irr globally and regionally.
#
#N.B. this procedure fills the 
#bottom two panels of the plot.
#
###################################

#Define stacked array in which the results are stored
CRU_t = np.zeros((9, 192, 288))
CESM_t = np.zeros((9, 192, 288))

#Execute the algorithm for different threshold values for CRU and CESM
CRU_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)

CESM_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)


# WT:  save arrays as .mat files for making maps in matlab
#sio.savemat('formatlab_CRU_t.mat' , {'CRU_t':CRU_t})
#sio.savemat('formatlab_CESM_t.mat', {'CESM_t':CESM_t})
# WT


#Change to 1D, remove NaNs
CRU0 = CRU_t[0,:,:].ravel()[~np.isnan(CRU_t[0,:,:].ravel())]
CRU1 = CRU_t[1,:,:].ravel()[~np.isnan(CRU_t[1,:,:].ravel())]
CRU2 = CRU_t[2,:,:].ravel()[~np.isnan(CRU_t[2,:,:].ravel())]
CRU3 = CRU_t[3,:,:].ravel()[~np.isnan(CRU_t[3,:,:].ravel())]
CRU4 = CRU_t[4,:,:].ravel()[~np.isnan(CRU_t[4,:,:].ravel())]
CRU5 = CRU_t[5,:,:].ravel()[~np.isnan(CRU_t[5,:,:].ravel())]

CESM0 = CESM_t[0,:,:].ravel()[~np.isnan(CESM_t[0,:,:].ravel())]
CESM1 = CESM_t[1,:,:].ravel()[~np.isnan(CESM_t[1,:,:].ravel())]
CESM2 = CESM_t[2,:,:].ravel()[~np.isnan(CESM_t[2,:,:].ravel())]
CESM3 = CESM_t[3,:,:].ravel()[~np.isnan(CESM_t[3,:,:].ravel())]
CESM4 = CESM_t[4,:,:].ravel()[~np.isnan(CESM_t[4,:,:].ravel())]
CESM5 = CESM_t[5,:,:].ravel()[~np.isnan(CESM_t[5,:,:].ravel())]
# WT replaced sel by pinb_mask in next lines
#Extract the PINB signal for each threshold for CRU and CESM, removing NaN values 
CRU0_reg_pinb_bb7 = CRU_t[0,:,:][pinb_mask][~np.isnan(CRU_t[0,:,:][pinb_mask])]
CRU1_reg_pinb_bb7 = CRU_t[1,:,:][pinb_mask][~np.isnan(CRU_t[1,:,:][pinb_mask])]
CRU2_reg_pinb_bb7 = CRU_t[2,:,:][pinb_mask][~np.isnan(CRU_t[2,:,:][pinb_mask])]
CRU3_reg_pinb_bb7 = CRU_t[3,:,:][pinb_mask][~np.isnan(CRU_t[3,:,:][pinb_mask])]
CRU4_reg_pinb_bb7 = CRU_t[4,:,:][pinb_mask][~np.isnan(CRU_t[4,:,:][pinb_mask])]
CRU5_reg_pinb_bb7 = CRU_t[5,:,:][pinb_mask][~np.isnan(CRU_t[5,:,:][pinb_mask])]

# WT replaced mistake (CRU_t to CESM_t)
CESM0_reg_pinb_bb7 = CESM_t[0,:,:][pinb_mask][~np.isnan(CESM_t[0,:,:][pinb_mask])]
CESM1_reg_pinb_bb7 = CESM_t[1,:,:][pinb_mask][~np.isnan(CESM_t[1,:,:][pinb_mask])]
CESM2_reg_pinb_bb7 = CESM_t[2,:,:][pinb_mask][~np.isnan(CESM_t[2,:,:][pinb_mask])]
CESM3_reg_pinb_bb7 = CESM_t[3,:,:][pinb_mask][~np.isnan(CESM_t[3,:,:][pinb_mask])]
CESM4_reg_pinb_bb7 = CESM_t[4,:,:][pinb_mask][~np.isnan(CESM_t[4,:,:][pinb_mask])]
CESM5_reg_pinb_bb7 = CESM_t[5,:,:][pinb_mask][~np.isnan(CESM_t[5,:,:][pinb_mask])]
CRU_bb7 = np.zeros((6))
CESM_bb7 = np.zeros((6))
    
CRU_bb7[0] = np.nanmedian(CRU0_reg_pinb_bb7)
CRU_bb7[1] = np.nanmedian(CRU1_reg_pinb_bb7)
CRU_bb7[2] = np.nanmedian(CRU2_reg_pinb_bb7)
CRU_bb7[3] = np.nanmedian(CRU3_reg_pinb_bb7)
CRU_bb7[4] = np.nanmedian(CRU4_reg_pinb_bb7)
CRU_bb7[5] = np.nanmedian(CRU5_reg_pinb_bb7)

CESM_bb7[0] = np.nanmedian(CESM0_reg_pinb_bb7)
CESM_bb7[1] = np.nanmedian(CESM1_reg_pinb_bb7)
CESM_bb7[2] = np.nanmedian(CESM2_reg_pinb_bb7)
CESM_bb7[3] = np.nanmedian(CESM3_reg_pinb_bb7)
CESM_bb7[4] = np.nanmedian(CESM4_reg_pinb_bb7)
CESM_bb7[5] = np.nanmedian(CESM5_reg_pinb_bb7)<jupyter_output><empty_output><jupyter_text>bb = 9Go to code in calc_irr_impact_regr.py and change bl to 4 on line 40.<jupyter_code># Re-load regression-based algorithm after this change
execfile('calc_irr_impact_regr.py')
###################################
#
#Calculate dT_irr
#Execute the algorithm to calculate
#dT_irr globally and regionally.
#
#N.B. this procedure fills the 
#bottom two panels of the plot.
#
###################################

#Define stacked array in which the results are stored
CRU_t = np.zeros((9, 192, 288))
CESM_t = np.zeros((9, 192, 288))

#Execute the algorithm for different threshold values for CRU and CESM
CRU_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)

CESM_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)


# WT:  save arrays as .mat files for making maps in matlab
#sio.savemat('formatlab_CRU_t.mat' , {'CRU_t':CRU_t})
#sio.savemat('formatlab_CESM_t.mat', {'CESM_t':CESM_t})
# WT


#Change to 1D, remove NaNs
CRU0 = CRU_t[0,:,:].ravel()[~np.isnan(CRU_t[0,:,:].ravel())]
CRU1 = CRU_t[1,:,:].ravel()[~np.isnan(CRU_t[1,:,:].ravel())]
CRU2 = CRU_t[2,:,:].ravel()[~np.isnan(CRU_t[2,:,:].ravel())]
CRU3 = CRU_t[3,:,:].ravel()[~np.isnan(CRU_t[3,:,:].ravel())]
CRU4 = CRU_t[4,:,:].ravel()[~np.isnan(CRU_t[4,:,:].ravel())]
CRU5 = CRU_t[5,:,:].ravel()[~np.isnan(CRU_t[5,:,:].ravel())]

CESM0 = CESM_t[0,:,:].ravel()[~np.isnan(CESM_t[0,:,:].ravel())]
CESM1 = CESM_t[1,:,:].ravel()[~np.isnan(CESM_t[1,:,:].ravel())]
CESM2 = CESM_t[2,:,:].ravel()[~np.isnan(CESM_t[2,:,:].ravel())]
CESM3 = CESM_t[3,:,:].ravel()[~np.isnan(CESM_t[3,:,:].ravel())]
CESM4 = CESM_t[4,:,:].ravel()[~np.isnan(CESM_t[4,:,:].ravel())]
CESM5 = CESM_t[5,:,:].ravel()[~np.isnan(CESM_t[5,:,:].ravel())]
# WT replaced sel by pinb_mask in next lines
#Extract the PINB signal for each threshold for CRU and CESM, removing NaN values 
CRU0_reg_pinb_bb9 = CRU_t[0,:,:][pinb_mask][~np.isnan(CRU_t[0,:,:][pinb_mask])]
CRU1_reg_pinb_bb9 = CRU_t[1,:,:][pinb_mask][~np.isnan(CRU_t[1,:,:][pinb_mask])]
CRU2_reg_pinb_bb9 = CRU_t[2,:,:][pinb_mask][~np.isnan(CRU_t[2,:,:][pinb_mask])]
CRU3_reg_pinb_bb9 = CRU_t[3,:,:][pinb_mask][~np.isnan(CRU_t[3,:,:][pinb_mask])]
CRU4_reg_pinb_bb9 = CRU_t[4,:,:][pinb_mask][~np.isnan(CRU_t[4,:,:][pinb_mask])]
CRU5_reg_pinb_bb9 = CRU_t[5,:,:][pinb_mask][~np.isnan(CRU_t[5,:,:][pinb_mask])]

# WT replaced mistake (CRU_t to CESM_t)
CESM0_reg_pinb_bb9 = CESM_t[0,:,:][pinb_mask][~np.isnan(CESM_t[0,:,:][pinb_mask])]
CESM1_reg_pinb_bb9 = CESM_t[1,:,:][pinb_mask][~np.isnan(CESM_t[1,:,:][pinb_mask])]
CESM2_reg_pinb_bb9 = CESM_t[2,:,:][pinb_mask][~np.isnan(CESM_t[2,:,:][pinb_mask])]
CESM3_reg_pinb_bb9 = CESM_t[3,:,:][pinb_mask][~np.isnan(CESM_t[3,:,:][pinb_mask])]
CESM4_reg_pinb_bb9 = CESM_t[4,:,:][pinb_mask][~np.isnan(CESM_t[4,:,:][pinb_mask])]
CESM5_reg_pinb_bb9 = CESM_t[5,:,:][pinb_mask][~np.isnan(CESM_t[5,:,:][pinb_mask])]
CRU_bb9 = np.zeros((6))
CESM_bb9 = np.zeros((6))
    
CRU_bb9[0] = np.nanmedian(CRU0_reg_pinb_bb9)
CRU_bb9[1] = np.nanmedian(CRU1_reg_pinb_bb9)
CRU_bb9[2] = np.nanmedian(CRU2_reg_pinb_bb9)
CRU_bb9[3] = np.nanmedian(CRU3_reg_pinb_bb9)
CRU_bb9[4] = np.nanmedian(CRU4_reg_pinb_bb9)
CRU_bb9[5] = np.nanmedian(CRU5_reg_pinb_bb9)

CESM_bb9[0] = np.nanmedian(CESM0_reg_pinb_bb9)
CESM_bb9[1] = np.nanmedian(CESM1_reg_pinb_bb9)
CESM_bb9[2] = np.nanmedian(CESM2_reg_pinb_bb9)
CESM_bb9[3] = np.nanmedian(CESM3_reg_pinb_bb9)
CESM_bb9[4] = np.nanmedian(CESM4_reg_pinb_bb9)
CESM_bb9[5] = np.nanmedian(CESM5_reg_pinb_bb9)<jupyter_output><empty_output><jupyter_text>bb = 11Go to code in calc_irr_impact_regr.py and change bl to 5 on line 40.<jupyter_code># Re-load regression-based algorithm after this change
execfile('calc_irr_impact_regr.py')
###################################
#
#Calculate dT_irr
#Execute the algorithm to calculate
#dT_irr globally and regionally.
#
#N.B. this procedure fills the 
#bottom two panels of the plot.
#
###################################

#Define stacked array in which the results are stored
CRU_t = np.zeros((9, 192, 288))
CESM_t = np.zeros((9, 192, 288))

#Execute the algorithm for different threshold values for CRU and CESM
CRU_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)

CESM_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)


# WT:  save arrays as .mat files for making maps in matlab
#sio.savemat('formatlab_CRU_t.mat' , {'CRU_t':CRU_t})
#sio.savemat('formatlab_CESM_t.mat', {'CESM_t':CESM_t})
# WT


#Change to 1D, remove NaNs
CRU0 = CRU_t[0,:,:].ravel()[~np.isnan(CRU_t[0,:,:].ravel())]
CRU1 = CRU_t[1,:,:].ravel()[~np.isnan(CRU_t[1,:,:].ravel())]
CRU2 = CRU_t[2,:,:].ravel()[~np.isnan(CRU_t[2,:,:].ravel())]
CRU3 = CRU_t[3,:,:].ravel()[~np.isnan(CRU_t[3,:,:].ravel())]
CRU4 = CRU_t[4,:,:].ravel()[~np.isnan(CRU_t[4,:,:].ravel())]
CRU5 = CRU_t[5,:,:].ravel()[~np.isnan(CRU_t[5,:,:].ravel())]

CESM0 = CESM_t[0,:,:].ravel()[~np.isnan(CESM_t[0,:,:].ravel())]
CESM1 = CESM_t[1,:,:].ravel()[~np.isnan(CESM_t[1,:,:].ravel())]
CESM2 = CESM_t[2,:,:].ravel()[~np.isnan(CESM_t[2,:,:].ravel())]
CESM3 = CESM_t[3,:,:].ravel()[~np.isnan(CESM_t[3,:,:].ravel())]
CESM4 = CESM_t[4,:,:].ravel()[~np.isnan(CESM_t[4,:,:].ravel())]
CESM5 = CESM_t[5,:,:].ravel()[~np.isnan(CESM_t[5,:,:].ravel())]
# WT replaced sel by pinb_mask in next lines
#Extract the PINB signal for each threshold for CRU and CESM, removing NaN values 
CRU0_reg_pinb_bb11 = CRU_t[0,:,:][pinb_mask][~np.isnan(CRU_t[0,:,:][pinb_mask])]
CRU1_reg_pinb_bb11 = CRU_t[1,:,:][pinb_mask][~np.isnan(CRU_t[1,:,:][pinb_mask])]
CRU2_reg_pinb_bb11 = CRU_t[2,:,:][pinb_mask][~np.isnan(CRU_t[2,:,:][pinb_mask])]
CRU3_reg_pinb_bb11 = CRU_t[3,:,:][pinb_mask][~np.isnan(CRU_t[3,:,:][pinb_mask])]
CRU4_reg_pinb_bb11 = CRU_t[4,:,:][pinb_mask][~np.isnan(CRU_t[4,:,:][pinb_mask])]
CRU5_reg_pinb_bb11 = CRU_t[5,:,:][pinb_mask][~np.isnan(CRU_t[5,:,:][pinb_mask])]

# WT replaced mistake (CRU_t to CESM_t)
CESM0_reg_pinb_bb11 = CESM_t[0,:,:][pinb_mask][~np.isnan(CESM_t[0,:,:][pinb_mask])]
CESM1_reg_pinb_bb11 = CESM_t[1,:,:][pinb_mask][~np.isnan(CESM_t[1,:,:][pinb_mask])]
CESM2_reg_pinb_bb11 = CESM_t[2,:,:][pinb_mask][~np.isnan(CESM_t[2,:,:][pinb_mask])]
CESM3_reg_pinb_bb11 = CESM_t[3,:,:][pinb_mask][~np.isnan(CESM_t[3,:,:][pinb_mask])]
CESM4_reg_pinb_bb11 = CESM_t[4,:,:][pinb_mask][~np.isnan(CESM_t[4,:,:][pinb_mask])]
CESM5_reg_pinb_bb11 = CESM_t[5,:,:][pinb_mask][~np.isnan(CESM_t[5,:,:][pinb_mask])]
CRU_bb11 = np.zeros((6))
CESM_bb11 = np.zeros((6))
    
CRU_bb11[0] = np.nanmedian(CRU0_reg_pinb_bb11)
CRU_bb11[1] = np.nanmedian(CRU1_reg_pinb_bb11)
CRU_bb11[2] = np.nanmedian(CRU2_reg_pinb_bb11)
CRU_bb11[3] = np.nanmedian(CRU3_reg_pinb_bb11)
CRU_bb11[4] = np.nanmedian(CRU4_reg_pinb_bb11)
CRU_bb11[5] = np.nanmedian(CRU5_reg_pinb_bb11)

CESM_bb11[0] = np.nanmedian(CESM0_reg_pinb_bb11)
CESM_bb11[1] = np.nanmedian(CESM1_reg_pinb_bb11)
CESM_bb11[2] = np.nanmedian(CESM2_reg_pinb_bb11)
CESM_bb11[3] = np.nanmedian(CESM3_reg_pinb_bb11)
CESM_bb11[4] = np.nanmedian(CESM4_reg_pinb_bb11)
CESM_bb11[5] = np.nanmedian(CESM5_reg_pinb_bb11)<jupyter_output><empty_output><jupyter_text>bb = 13Go to code in calc_irr_impact_regr.py and change bl to 6 on line 40.<jupyter_code># Re-load regression-based algorithm after this change
execfile('calc_irr_impact_regr.py')
###################################
#
#Calculate dT_irr
#Execute the algorithm to calculate
#dT_irr globally and regionally.
#
#N.B. this procedure fills the 
#bottom two panels of the plot.
#
###################################

#Define stacked array in which the results are stored
CRU_t = np.zeros((9, 192, 288))
CESM_t = np.zeros((9, 192, 288))

#Execute the algorithm for different threshold values for CRU and CESM
CRU_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)

CESM_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)


# WT:  save arrays as .mat files for making maps in matlab
#sio.savemat('formatlab_CRU_t.mat' , {'CRU_t':CRU_t})
#sio.savemat('formatlab_CESM_t.mat', {'CESM_t':CESM_t})
# WT


#Change to 1D, remove NaNs
CRU0 = CRU_t[0,:,:].ravel()[~np.isnan(CRU_t[0,:,:].ravel())]
CRU1 = CRU_t[1,:,:].ravel()[~np.isnan(CRU_t[1,:,:].ravel())]
CRU2 = CRU_t[2,:,:].ravel()[~np.isnan(CRU_t[2,:,:].ravel())]
CRU3 = CRU_t[3,:,:].ravel()[~np.isnan(CRU_t[3,:,:].ravel())]
CRU4 = CRU_t[4,:,:].ravel()[~np.isnan(CRU_t[4,:,:].ravel())]
CRU5 = CRU_t[5,:,:].ravel()[~np.isnan(CRU_t[5,:,:].ravel())]

CESM0 = CESM_t[0,:,:].ravel()[~np.isnan(CESM_t[0,:,:].ravel())]
CESM1 = CESM_t[1,:,:].ravel()[~np.isnan(CESM_t[1,:,:].ravel())]
CESM2 = CESM_t[2,:,:].ravel()[~np.isnan(CESM_t[2,:,:].ravel())]
CESM3 = CESM_t[3,:,:].ravel()[~np.isnan(CESM_t[3,:,:].ravel())]
CESM4 = CESM_t[4,:,:].ravel()[~np.isnan(CESM_t[4,:,:].ravel())]
CESM5 = CESM_t[5,:,:].ravel()[~np.isnan(CESM_t[5,:,:].ravel())]
# WT replaced sel by pinb_mask in next lines
#Extract the PINB signal for each threshold for CRU and CESM, removing NaN values 
CRU0_reg_pinb_bb13 = CRU_t[0,:,:][pinb_mask][~np.isnan(CRU_t[0,:,:][pinb_mask])]
CRU1_reg_pinb_bb13 = CRU_t[1,:,:][pinb_mask][~np.isnan(CRU_t[1,:,:][pinb_mask])]
CRU2_reg_pinb_bb13 = CRU_t[2,:,:][pinb_mask][~np.isnan(CRU_t[2,:,:][pinb_mask])]
CRU3_reg_pinb_bb13 = CRU_t[3,:,:][pinb_mask][~np.isnan(CRU_t[3,:,:][pinb_mask])]
CRU4_reg_pinb_bb13 = CRU_t[4,:,:][pinb_mask][~np.isnan(CRU_t[4,:,:][pinb_mask])]
CRU5_reg_pinb_bb13 = CRU_t[5,:,:][pinb_mask][~np.isnan(CRU_t[5,:,:][pinb_mask])]

# WT replaced mistake (CRU_t to CESM_t)
CESM0_reg_pinb_bb13 = CESM_t[0,:,:][pinb_mask][~np.isnan(CESM_t[0,:,:][pinb_mask])]
CESM1_reg_pinb_bb13 = CESM_t[1,:,:][pinb_mask][~np.isnan(CESM_t[1,:,:][pinb_mask])]
CESM2_reg_pinb_bb13 = CESM_t[2,:,:][pinb_mask][~np.isnan(CESM_t[2,:,:][pinb_mask])]
CESM3_reg_pinb_bb13 = CESM_t[3,:,:][pinb_mask][~np.isnan(CESM_t[3,:,:][pinb_mask])]
CESM4_reg_pinb_bb13 = CESM_t[4,:,:][pinb_mask][~np.isnan(CESM_t[4,:,:][pinb_mask])]
CESM5_reg_pinb_bb13 = CESM_t[5,:,:][pinb_mask][~np.isnan(CESM_t[5,:,:][pinb_mask])]
CRU_bb13 = np.zeros((6))
CESM_bb13 = np.zeros((6))
    
CRU_bb13[0] = np.nanmedian(CRU0_reg_pinb_bb13)
CRU_bb13[1] = np.nanmedian(CRU1_reg_pinb_bb13)
CRU_bb13[2] = np.nanmedian(CRU2_reg_pinb_bb13)
CRU_bb13[3] = np.nanmedian(CRU3_reg_pinb_bb13)
CRU_bb13[4] = np.nanmedian(CRU4_reg_pinb_bb13)
CRU_bb13[5] = np.nanmedian(CRU5_reg_pinb_bb13)

CESM_bb13[0] = np.nanmedian(CESM0_reg_pinb_bb13)
CESM_bb13[1] = np.nanmedian(CESM1_reg_pinb_bb13)
CESM_bb13[2] = np.nanmedian(CESM2_reg_pinb_bb13)
CESM_bb13[3] = np.nanmedian(CESM3_reg_pinb_bb13)
CESM_bb13[4] = np.nanmedian(CESM4_reg_pinb_bb13)
CESM_bb13[5] = np.nanmedian(CESM5_reg_pinb_bb13)<jupyter_output><empty_output><jupyter_text>bb = 15Go to code in calc_irr_impact_regr.py and change bl to 7 on line 40.<jupyter_code># Re-load regression-based algorithm after this change
execfile('calc_irr_impact_regr.py')
###################################
#
#Calculate dT_irr
#Execute the algorithm to calculate
#dT_irr globally and regionally.
#
#N.B. this procedure fills the 
#bottom two panels of the plot.
#
###################################

#Define stacked array in which the results are stored
CRU_t = np.zeros((9, 192, 288))
CESM_t = np.zeros((9, 192, 288))

#Execute the algorithm for different threshold values for CRU and CESM
CRU_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CRU_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CRU_CESM',temp_product_CRU,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)

CESM_t[0,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.0,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[1,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.1,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[2,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.2,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[3,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.3,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[4,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.4,False,yr_start1,yr_end1,yr_start2,yr_end2)
CESM_t[5,:,:], _,_,_,_ = calc_irr_impact_regr('CESM',temp_product_CESM,response,t_res,0.5,False,yr_start1,yr_end1,yr_start2,yr_end2)


# WT:  save arrays as .mat files for making maps in matlab
#sio.savemat('formatlab_CRU_t.mat' , {'CRU_t':CRU_t})
#sio.savemat('formatlab_CESM_t.mat', {'CESM_t':CESM_t})
# WT


#Change to 1D, remove NaNs
CRU0 = CRU_t[0,:,:].ravel()[~np.isnan(CRU_t[0,:,:].ravel())]
CRU1 = CRU_t[1,:,:].ravel()[~np.isnan(CRU_t[1,:,:].ravel())]
CRU2 = CRU_t[2,:,:].ravel()[~np.isnan(CRU_t[2,:,:].ravel())]
CRU3 = CRU_t[3,:,:].ravel()[~np.isnan(CRU_t[3,:,:].ravel())]
CRU4 = CRU_t[4,:,:].ravel()[~np.isnan(CRU_t[4,:,:].ravel())]
CRU5 = CRU_t[5,:,:].ravel()[~np.isnan(CRU_t[5,:,:].ravel())]

CESM0 = CESM_t[0,:,:].ravel()[~np.isnan(CESM_t[0,:,:].ravel())]
CESM1 = CESM_t[1,:,:].ravel()[~np.isnan(CESM_t[1,:,:].ravel())]
CESM2 = CESM_t[2,:,:].ravel()[~np.isnan(CESM_t[2,:,:].ravel())]
CESM3 = CESM_t[3,:,:].ravel()[~np.isnan(CESM_t[3,:,:].ravel())]
CESM4 = CESM_t[4,:,:].ravel()[~np.isnan(CESM_t[4,:,:].ravel())]
CESM5 = CESM_t[5,:,:].ravel()[~np.isnan(CESM_t[5,:,:].ravel())]
# WT replaced sel by pinb_mask in next lines
#Extract the PINB signal for each threshold for CRU and CESM, removing NaN values 
CRU0_reg_pinb_bb15 = CRU_t[0,:,:][pinb_mask][~np.isnan(CRU_t[0,:,:][pinb_mask])]
CRU1_reg_pinb_bb15 = CRU_t[1,:,:][pinb_mask][~np.isnan(CRU_t[1,:,:][pinb_mask])]
CRU2_reg_pinb_bb15 = CRU_t[2,:,:][pinb_mask][~np.isnan(CRU_t[2,:,:][pinb_mask])]
CRU3_reg_pinb_bb15 = CRU_t[3,:,:][pinb_mask][~np.isnan(CRU_t[3,:,:][pinb_mask])]
CRU4_reg_pinb_bb15 = CRU_t[4,:,:][pinb_mask][~np.isnan(CRU_t[4,:,:][pinb_mask])]
CRU5_reg_pinb_bb15 = CRU_t[5,:,:][pinb_mask][~np.isnan(CRU_t[5,:,:][pinb_mask])]

# WT replaced mistake (CRU_t to CESM_t)
CESM0_reg_pinb_bb15 = CESM_t[0,:,:][pinb_mask][~np.isnan(CESM_t[0,:,:][pinb_mask])]
CESM1_reg_pinb_bb15 = CESM_t[1,:,:][pinb_mask][~np.isnan(CESM_t[1,:,:][pinb_mask])]
CESM2_reg_pinb_bb15 = CESM_t[2,:,:][pinb_mask][~np.isnan(CESM_t[2,:,:][pinb_mask])]
CESM3_reg_pinb_bb15 = CESM_t[3,:,:][pinb_mask][~np.isnan(CESM_t[3,:,:][pinb_mask])]
CESM4_reg_pinb_bb15 = CESM_t[4,:,:][pinb_mask][~np.isnan(CESM_t[4,:,:][pinb_mask])]
CESM5_reg_pinb_bb15 = CESM_t[5,:,:][pinb_mask][~np.isnan(CESM_t[5,:,:][pinb_mask])]
CRU_bb15 = np.zeros((6))
CESM_bb15 = np.zeros((6))
    
CRU_bb15[0] = np.nanmedian(CRU0_reg_pinb_bb15)
CRU_bb15[1] = np.nanmedian(CRU1_reg_pinb_bb15)
CRU_bb15[2] = np.nanmedian(CRU2_reg_pinb_bb15)
CRU_bb15[3] = np.nanmedian(CRU3_reg_pinb_bb15)
CRU_bb15[4] = np.nanmedian(CRU4_reg_pinb_bb15)
CRU_bb15[5] = np.nanmedian(CRU5_reg_pinb_bb15)

CESM_bb15[0] = np.nanmedian(CESM0_reg_pinb_bb15)
CESM_bb15[1] = np.nanmedian(CESM1_reg_pinb_bb15)
CESM_bb15[2] = np.nanmedian(CESM2_reg_pinb_bb15)
CESM_bb15[3] = np.nanmedian(CESM3_reg_pinb_bb15)
CESM_bb15[4] = np.nanmedian(CESM4_reg_pinb_bb15)
CESM_bb15[5] = np.nanmedian(CESM5_reg_pinb_bb15)<jupyter_output><empty_output><jupyter_text>Plot results<jupyter_code>arr_CRU = np.array((CRU_bb5,CRU_bb7,CRU_bb9,CRU_bb11,CRU_bb13,CRU_bb15))
arr_CESM = np.array((CESM_bb5,CESM_bb7,CESM_bb9,CESM_bb11,CESM_bb13,CESM_bb15))

print np.nanmin(arr_CRU), np.nanmax(arr_CRU)
print np.nanmin(arr_CESM), np.nanmax(arr_CESM)
import numpy as np
import matplotlib.pyplot as plt

fig,ax = plt.subplots(1,2,figsize=(11,4))
#fig.set_size_inches(16 / 2.54, 16 / 2.54 / 2.2)

#CESM results
im_CESM = ax[0].imshow(arr_CESM,vmin=-1.5,vmax=0,cmap='Blues_r');
CS = ax[0].contour(arr_CESM, np.arange(-1.25,0,0.25), colors= 'k')
ax[0].clabel(CS, inline=1, fontsize=10, fmt='%1.2f')

ax[0].invert_yaxis()
ax[0].set_yticklabels(['',r'5$\times$5',r'7$\times$7',r'9$\times$9',r'11$\times$11',r'13$\times$13',r'15$\times$15'])
ax[0].set_xticklabels(['','0.0','0.1','0.2','0.3','0.4','0.5'])

ax[0].set_ylabel('Search window size [-]')
ax[0].set_xlabel(r'Change in irrigated fraction [-]')
#c.set_label('T change [K]')

ax[0].set_title('CESM',weight='bold')



#CRU results
im_CRU = ax[1].imshow(arr_CRU,vmin=-1.5,vmax=0,cmap='Blues_r');
CS = ax[1].contour(arr_CRU, np.arange(-1.25,0,0.25), colors= 'k')
ax[1].clabel(CS, inline=1, fontsize=10, fmt='%1.2f')

ax[1].set_yticklabels(['',r'5$\times$5',r'7$\times$7',r'9$\times$9',r'11$\times$11',r'13$\times$13',r'15$\times$15'])
ax[1].invert_yaxis()
ax[1].set_xticklabels(['','0.0','0.1','0.2','0.3','0.4','0.5'])

ax[1].set_xlabel(r'Change in irrigated fraction [-]')
#c.set_label('T change [K]')

ax[1].set_title('CRU',weight='bold')


c = fig.colorbar(im_CRU, ax=ax.ravel().tolist())
c.set_ticks(np.arange(-1.5,0.1,0.3))
c.set_label(u'Irrigation-induced temperature change [K]')

fig.savefig('CESM_CRUv3.22_heatmap_df-irr_swsize_AV.pdf',bbox_inches='tight')
fig.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22332015810276679, 'fraction_numerical': 0.052958250988142296, 'mean_word_length': 10.972273567467653, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '89035', 'license': 'MIT', 'n_tokens_mistral': 18094, 'n_tokens_neox': 16929, 'n_words': 1466, 'path': 'observational_analysis/CRU_CESM_heatmap_regional.ipynb', 'repo_name': 'VUB-HYDR/2020_Thiery_etal_NatComm', 'size': '32384'}