#--------------- a2dens_tmp = ma.masked_where( a2regionmask ==0.0, a2dens) a2dens_tmp = ma.masked_invalid(a2dens_tmp) #--------------- # mean dens #--------------- dlv[reg, era, iclass].append( a2dens_tmp.mean() ) #----------------- # calc regional mean #----------------- dmv[reg, era, iclass] = mean(dlv[reg, era, iclass]) #----------------- #----------------- # calc t-value #----------------- dtv[reg, iclass] = func.ret_tv_difmean(dlv[reg, "his",iclass], dlv[reg, "fut",iclass]) print iclass, dtv[reg, iclass] #----------------- # calc difference of regional mean #----------------- dfcm[reg, iclass] = (mean(dlv[reg, "fut", iclass]) - mean(dlv[reg, "his", iclass]))/mean(dlv[reg,"his",iclass]) * 100.0 #**************************************** # write csv #---------------------------------------- csvdir = csvdir_root + "/%04d.%04d-%04d.%04d"%(diyear["his"], deyear["his"], diyear["fut"], deyear["fut"]) func.mk_dir(csvdir) #------------ for reg in lreg:
# #--------------- # mean value #--------------- dlp[reg, era, iclass].append( a2p_tmp.mean() ) dlsp[reg, era, iclass].append( a2sp_tmp.mean() ) #----------------- # calc regional mean #----------------- dp_reg[reg, era, iclass] = mean(dlp[reg, era, iclass]) dsp_reg[reg, era, iclass] = mean(dlsp[reg, era, iclass]) #----------------- #----------------- # calc t-value #----------------- dtv_p[reg, iclass] = func.ret_tv_difmean(dlp[reg, "fut",iclass], dlp[reg, "his",iclass]) dtv_sp[reg, iclass] = func.ret_tv_difmean(dlsp[reg, "fut",iclass], dlsp[reg, "his",iclass]) print iclass, dtv_p[reg, iclass] #----------------- # calc difference of regional mean #----------------- dfc_p[reg, iclass] = (mean(dlp[reg, "fut", iclass]) - mean(dlp[reg, "his", iclass]))/mean(dlp[reg,"his",iclass]) * 100.0 dfc_sp[reg, iclass] = (mean(dlsp[reg, "fut", iclass]) - mean(dlsp[reg, "his", iclass]))/mean(dlsp[reg,"his",iclass]) * 100.0 #**************************************** # write csv #---------------------------------------- csvdir = csvdir_root func.mk_dir(csvdir)