my_colors = ('#340003', '#ae000c', '#ff2e1b', '#ff5f26', '#ff9d37', '#fbe78a', '#ffffff', '#b0f0f7', '#93d3f6', '#76bbf3', '#4ba7ef', '#3498ed', '#2372c9') #13 pm.plotmap(anomaly_corrigida[0, :, :], newlats-1./2., newlons-1./2., latsouthpoint=y1, latnorthpoint=y2, lonwestpoint=x1, loneastpoint=x2, fig_name=figname_anom, barloc='right', barcolor=my_colors, barlevs=levs, fig_title=figtitle, barinf='both', ocean_mask=1) background = Image.open(figname_anom) foreground = Image.open("/home/marcelo/FSCT-ECHAM46/FUNCEME_LOGO.png") foreground = foreground.resize((90, 70), Image.ANTIALIAS) background.paste(foreground, (334, 461), foreground) background.save(figname_anom, optimize=True, quality=95) ########## Tercil mais provável para toda a região do globo ########## file_out = "{5}/prob_echam46_issue_{0}{1}_target_{2}{3}_{4}_median.nc".format(fcst_month, fcst_year, target_months, target_year, hind_period, outdir) below, normal, above, f_signal, f_std, o_pad, fcst_sig_anom = cs.compute_probability(fcst, hind, obs, n_years) cn.create_netcdf_probs(below, normal, above, newlats, newlons, fileout=file_out) ########## Curva para o CE ########## # Retorna matriz com os pontos sobre o Ceará shapef = '/home/marcelo/FSCT-ECHAM46/pontos_ce.txt' pointsgrid, lonlatgrid, mymatriz = dg.pointinside(newlats, newlons, shapefile=shapef) # Aplica máscara para os pontos sobre o Ceará points_over_ce_fcst = np.ma.array(fcst[0, :, :], mask=mymatriz) points_over_ce_hind = np.ma.array(hind, mask=np.tile(mymatriz, (hind.shape[0], 1))) points_over_ce_obs = np.ma.array(obs, mask=np.tile(mymatriz, (obs.shape[0], 1))) mean_ce_fcst = np.zeros(1) mean_ce_hind = np.zeros(int(n_years)) mean_ce_obs = np.zeros(int(n_years))
# tercil mais provável 2011-2016 for i, y in enumerate(xrange(2011, 2017)): below, normal, above, f_signal, f_std, o_pad, fcst_sig_anom = \ cs.compute_probability(pcp[30 + i, :, :], pcp[0:30, :, :], obs[0:30, :, :]) if not os.path.exists('figs_expsolar/map_tercis'): os.makedirs('figs_expsolar/map_tercis') file_out = 'figs_expsolar/map_tercis' \ '/prob_echam46_issue_{0}{1}_target_{2}{3}_{4}.nc' \ .format("JAN", y, "FMA", y, "8110") cn.create_netcdf_probs(below, normal, above, nla, nlo, fileout=file_out) figout = 'figs_expsolar/map_tercis' \ '/bra_precip_persistida_{1}_{2}-{3}_{4}_{0}' \ '_echam46_1dg_cmap_tercilmaisprovavel.png' \ .format("JAN", "8110", y, "FMA", y) figtitle = "ECHAM4.6 - {0}/{1} - {2}/{3}\nPROB PREC (%) ({4})" \ .format("JAN", y, "FMA", y, "8110") pm.maptercis(file_out, figtitle, figout) os.remove(file_out) # tercil mais provável 2011-2016 experimento for i, y in enumerate(xrange(2011, 2017)):