# for surr_num in range(NUM_SURR): # print surr_num # surr = nao.copy() # surr.data = get_single_FT_surrogate(nao.data) # surr.wavelet(8, 'y', cut = 1) # args = [ (i, j, net.phase[:, i, j], surr.phase) for i in range(net.lats.shape[0]) for j in range(net.lons.shape[0])] # results = pool.map(_get_MI, args) # for i, j, res in results: # nao_surrs[surr_num, i, j] = res # pool.close() # pool.join() with open("NCEP-SAT-NAO-8yr-phase-%dFTsurrs-MIEQQ-k=32.bin" % NUM_SURR, "rb") as f: # cPickle.dump({'data' : nao_synch, 'surrs' : nao_surrs}, f, protocol = cPickle.HIGHEST_PROTOCOL) raw = cPickle.load(f) nao_synch = raw['data'] nao_surrs = raw['surrs'] result = nao_synch.copy() p_vals = get_p_vals(nao_synch, nao_surrs, one_tailed=True) msk = np.less_equal(p_vals, P_VAL) result[~msk] = np.nan fname = "NCEP-SAT-NAO-8yr-phase-%dFTsurrs-MIEQQ-k=32.png" % NUM_SURR net.quick_render(field_to_plot=result, tit="8yr phase synch TEMP x NAO \n p-value %.2f" % P_VAL, symm=False, fname=fname)
P_VAL = 0.05 # nao_surrs = np.zeros([NUM_SURR] + net.get_spatial_dims()) # for surr_num in range(NUM_SURR): # print surr_num # surr = nao.copy() # surr.data = get_single_FT_surrogate(nao.data) # surr.wavelet(8, 'y', cut = 1) # args = [ (i, j, net.phase[:, i, j], surr.phase) for i in range(net.lats.shape[0]) for j in range(net.lons.shape[0])] # results = pool.map(_get_MI, args) # for i, j, res in results: # nao_surrs[surr_num, i, j] = res # pool.close() # pool.join() with open("NCEP-SAT-NAO-8yr-phase-%dFTsurrs-MIEQQ-k=32.bin" % NUM_SURR, "rb") as f: # cPickle.dump({'data' : nao_synch, 'surrs' : nao_surrs}, f, protocol = cPickle.HIGHEST_PROTOCOL) raw = cPickle.load(f) nao_synch = raw['data'] nao_surrs = raw['surrs'] result = nao_synch.copy() p_vals = get_p_vals(nao_synch, nao_surrs, one_tailed = True) msk = np.less_equal(p_vals, P_VAL) result[~msk] = np.nan fname = "NCEP-SAT-NAO-8yr-phase-%dFTsurrs-MIEQQ-k=32.png" % NUM_SURR net.quick_render(field_to_plot = result, tit = "8yr phase synch TEMP x NAO \n p-value %.2f" % P_VAL, symm = False, fname = fname)
surr_res = cPickle.load(f) # INDICES = ['TNA', 'SOI', 'SCAND', 'PNA', 'PDO', 'EA', 'AMO', 'NAO', 'NINO3.4', 'TPI', 'SAM'] P_VAL = 0.05 data_corrs = surr_res['data'] surr_corrs = surr_res['surrs'] no_sigs = np.zeros_like(data_corrs) msk = np.isnan(data_corrs) no_sigs[msk] = np.nan result = data_corrs.copy() surrs_tmp = np.array([surr_corrs[i] for i in range(len(surr_corrs))]) p_vals = get_p_vals(data_corrs, surrs_tmp, one_tailed = False) msk = np.less_equal(p_vals, P_VAL) result[~msk] = np.nan no_sigs[msk] += 1 tit = ("WeMO vs. phase fluc: JFM annual means - 1949 -- 2014 \n p-value %.2f" % (P_VAL)) fname = ("../scale-nets/WeMO-NCEP-phase-fluc-JFMmeans-1949-2014-SURR.png") # print result # net.data[0, ...] = result.copy() net.quick_render(field_to_plot = result, tit = tit, fname = fname, symm = True, whole_world = True) # tit = ("ECA&D number of significant with p-value %.2f" % (P_VAL)) # fname = ("../scale-nets/ECAD-SAT-annual-phase-fluc-SSA-RC-number-of-sig-from-indices.png")