from PyFuncemeClimateTools import PlotMaps as pm from PyFuncemeClimateTools import CreateNetCDF as cn from read_data import read_data pcp, pcpe, obs = read_data() nla = np.linspace(-90., 90., 181) nlo = np.linspace(-180., 179., 360) x, y = np.meshgrid(nlo, nla) y1, y2, x1, x2 = -60., 15., -90., -30. correl = cs.compute_pearson(pcp[0:30, :, :], obs[0:30, :, :]) figtitle = u'ECHAM4.6 x CMAP - {0}/{1} ({2})\nCorrelação - Precip Acum' \ .format('JAN', 'FMA', '8110') if not os.path.exists('figs_expsolar/map_correl'): os.makedirs('figs_expsolar/map_correl') figname = 'figs_expsolar/map_correl' \ '/bra_precip_persistida_{0}_null-{1}_null_{2}_echam46_1dg_cmap_' \ 'correlacao.png' \ .format('8110', 'FMA', 'JAN') levs = (-1.0, -0.9, -0.7, -0.5, -0.3, 0.3, 0.5, 0.7, 0.9, 1.0) # 10 my_colors = ('#2372c9', '#3498ed', '#4ba7ef', '#76bbf3', '#93d3f6',
print 'lons:', obs_lons outdir = '{0}{1}-{2}-rsm97'.format(fcst_month, fcst_year, hind_period) if not os.path.exists(outdir): os.makedirs(outdir) print " === OUTPUT DIR: {0} ===\n".format(outdir) # Limites do mapa para fazer o plot # y1, y2, x1, x2 = -40., 40., -150., 70. # Globo #~ y1, y2, x1, x2 = -89., 89., -178., 178. # Globo #~ y1, y2, x1, x2 = -23., 9., -75., -34. # Região Reliability y1, y2, x1, x2 = -21.3, 7., -55.6, -34 # América do sul ########### CORRELAÇÃO ########### correl = cs.compute_pearson(hind, obs, n_years) figtitle = u'RSM97 x UTEXAS - {0}/{1} ({2})\nCorrelação - Precip Acum'.format(fcst_month_name, target_months, hind_period_name) figname = "{3}/bra_precip_persistida_{0}_null-{1}_null_{2}_rsm97_1dg_utexas_correlacao.png".format(hind_period_name, target_months, n_fcst_month, outdir) levs = (-1.0, -0.9, -0.7, -0.5, -0.3, 0.3, 0.5, 0.7, 0.9, 1.0) #10 my_colors = ('#2372c9', '#3498ed', '#4ba7ef', '#76bbf3', '#93d3f6', '#b0f0f7', '#ffffff', '#fbe78a', '#ff9d37', '#ff5f26', '#ff2e1b', '#ff0219', '#ae000c') #13 pm.plotmap(correl, obs_lats-0.54/2., obs_lons-0.54/2., latsouthpoint=y1, latnorthpoint=y2, lonwestpoint=x1, loneastpoint=x2, fig_name=figname, barloc='right', barcolor=my_colors, barlevs=levs, fig_title=figtitle, barinf='neither', ocean_mask=1) background = Image.open(figname) foreground = Image.open("/home/marcelo/FSCT-ECHAM46/FUNCEME_LOGO.png") foreground = foreground.resize((90, 70), Image.ANTIALIAS) background.paste(foreground, (313, 460), foreground) background.save(figname, optimize=True, quality=95)
above = np.loadtxt("echam46_above.txt") normal = np.loadtxt("echam46_normal.txt") below = np.loadtxt("echam46_below.txt") print "\n => Plot diagram...\n" mytitle = "Diagrama de atributos: {2}/{1} - ({0})".format(hind_period, target_months, fcst_month) figura, ax = plot_reliability(below[:,0], below[:,1], maintitle=mytitle, cor='blue') figura, ax = plot_reliability(normal[:,0], normal[:,1], maintitle=mytitle, first=False, fig=figura, cor='y') figura, ax = plot_reliability(above[:,0], above[:,1], maintitle=mytitle, first=False, fig=figura, cor='red') name_fig = "bra_precip_persistida_{0}_null-{1}_null_{2}_echam46_1dg_cmap_reliability.png".format(hind_period, target_months, n_fcst_month) plt.savefig(name_fig) plt.close() correl = cs.compute_pearson(pcp_model, pcp_obs, timelen=14.) # correl_aux, lons_aux = shiftgrid(180., correl, lons, start=False) figtitle = u'RSM97 x PRECL - FMA - 02-15\nPersistida - 0.54x0.54 - Correlação - Precip Acum' figname = "correl_rsm97per_x_precl_jfm_0215.png" levs = (-1.0, -0.9, -0.7, -0.5, -0.3, 0.3, 0.5, 0.7, 0.9, 1.0) #10 my_colors = ('#2372c9', '#3498ed', '#4ba7ef', '#76bbf3', '#93d3f6', '#b0f0f7', '#ffffff', '#fbe78a', '#ff9d37', '#ff5f26', '#ff2e1b', '#ff0219', '#ae000c') #13 print "\n... salvando figura ..."