########## Apenas um plot ########## lev = [0., 50., 100., 200., 300., 500., 700., 900., 1000.] my_colors = ('#ffffff', '#E5E5E5', '#CBCBCB', '#B2B2B2', '#989898', '#7F7F7F', '#666666', '#4E4E4E') #8 figtitle = u'ECHAM4.6 - Precip Acum (mm)' figname = "{5}/bra_precip_persistida_{0}_{1}-{2}_{3}_{4}_echam46_1dg_null_precip_median.png" \ .format(hind_period_name, target_year, target_months, fcst_year, n_fcst_month, outdir) pm.plotmap(fcst[0, :, :], newlats-1./2., newlons-1./2., latsouthpoint=-88., latnorthpoint=88., lonwestpoint=-178., loneastpoint=178., fig_name=figname, fig_title=figtitle, barcolor=my_colors, ocean_mask=0, barlevs=lev, barinf='max', barloc='bottom', meridians=np.arange(-160., 161., 30.), parallels=np.arange(-90., 91., 20.)) ########## Anomalia corrigida metódo do Caio (regressão linear) ########## below, normal, above, f_signal, f_std, o_pad, fcst_sig_anom = cs.compute_probability(fcst, hind, obs, n_years) hind_corrigido = cs.compute_setrighthind(hind, obs, n_years) anomaly_corrigida, anomaly_pad = cs.compute_anomaly(fcst_sig_anom, hind_corrigido) #~ figtitle = u'ECHAM4.6 x CMAP - OCT/{4} - {1}/{4}\nAnomaly (mm) - Precip Accum ({2})'\ figtitle = u'ECHAM4.6 x CMAP - {0}/{3} - {1}/{4}\nAnomalia (mm) - Precip Acum ({2})'\ .format(fcst_month_name, target_months, hind_period_name, fcst_year, target_year) figname_anom = "{5}/bra_precip_persistida_{0}_{1}-{2}_{3}_{4}_echam46_1dg_null_anom_median.png" \ .format(hind_period_name, target_year, target_months, fcst_year, n_fcst_month, outdir) levs = (-700., -500., -300., -100., -50., -30., 30., 50., 100., 300., 500., 700.) #12 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)
# Plot map correlacao globo sem oceano # figname = "correl_echam46_issue_{0}_{1}.{2}_noocean.png".format(fcst_month, target_months, hind_period) # pm.correl_map_shaded(correl, lons_correl_aux-2.8125/2., lats-2.8125/2., fig_name=figname, fig_title=figtitle, ocean_mask=1) # Plot map correlacao Brasil # figname = "correl_echam46_issue_{0}_{1}.{2}_br.png".format(fcst_month, target_months, hind_period) # pm.correl_map_shaded(correl, lons_correl_aux-2.8125/2., lats-2.8125/2., fig_name=figname, fig_title=figtitle, br_country=1) # Plot map correlacao Brasil sem oceano # figname = "correl_echam46_issue_{0}_{1}.{2}_noocean_br.png".format(fcst_month, target_months, hind_period) figname = outdir + '/' + "bra_precip_persistida_hind%s_%s_null_%s_echam46_1dg_cmap_correlacao.png" % (hind_period, target_months, n_fcst_month) pm.correl_map_shaded(correl, lons_correl_aux-2.8125/2., lats-2.8125/2., fig_name=figname, fig_title=figtitle, ocean_mask=1, br_country=1) # Anomalia anomaly, anomaly_pad = cs.compute_anomaly(fsct, hind) # Shift na longitude e nos dados do modelo # Isso é necessário pois a longitude do NetCDF é no formato 0 - 360 # a função aceita valores de longitude no formato -180:+180 # Chefinho quer ver todos os oceanos # anomaly, fsct_lon = shiftgrid(30., anomaly, fsct_lon, start=False) anomaly, lons_anom_aux = shiftgrid(180., anomaly, lons, start=False) # Plot map anomalia globo # a variavel a ser plotada deve ser 2d figtitle = "ECHAM4.6 - Anomalia de Prec Acum (mm)\n{0} {1} - {2} {3}".format(fcst_month, fcst_year, target_months, target_year, hind_period) # figname = "anomalia_echam46_issue_{0}{1}_target_{2}{3}.{4}.png".format(fcst_month, fcst_year, target_months, target_year, hind_period) # pm.anom_map_shaded(anomaly[0, :, :], lons_anom_aux-2.8125/2., lats-2.8125/2., fig_name=figname, fig_title=figtitle) # Plot map anomalia globo sem oceano
# pm.plotmap(anom_diff_p, nla, nlo, # 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) # diff das anomalias: controle menos experimento for i, y in enumerate(xrange(2011, 2017)): directory = 'figs_expsolar/diff_anom' if not os.path.exists(directory): os.makedirs(directory) anom, anom_pad = cs.compute_anomaly(pcp[30 + i, :, :], pcpe[0:30, :, :]) anom_exp, anom_pad_exp = cs.compute_anomaly(pcpe[30 + i, :, :], pcpe[0:30, :, :]) # diff das anomalias anom_diff = anom_exp - anom figtitle = u'Anom Diff (mm) (EXP - CONTROl)' figname_anom = '{0}/diff_anom_{1}.png'.format(directory, y) levs = (-300., -100., -50., -30., -15., -5., 5., 15., 30., 50., 100., 300.) # 12
# ocean_mask=0, barlevs=lev, barinf='max', barloc='bottom', # meridians=np.arange(-160., 161., 30.), # parallels=np.arange(-90., 91., 20.)) if obs_base == 'cmap': ### Anomalia corrigida metódo do Caio (regressão linear) ### # below, normal, above, f_signal, f_std, o_pad, fcst_sig_anom = \ # cs.compute_probability(fcst, hind, obs, n_years) below, normal, above, f_signal, f_std, o_pad, fcst_sig_anom = \ cs.compute_probability(fcst, hind, obs) hind_corrigido = cs.compute_setrighthind(hind, obs) anomaly_corrigida, anomaly_pad = \ cs.compute_anomaly(fcst_sig_anom, hind_corrigido) figtitle = u'ECHAM4.6 x CMAP - {0}/{3} - {1}/{4}\nAnomalia (mm)' \ ' - Precip Acum ({2})'.format(fcst_month_name, target_months, hind_period_name, fcst_year, target_year) figname_anom = '{5}/bra_precip_persistida_{0}_{1}-{2}_{3}_{4}_' \ 'echam46_1dg_null_anom.png'.format(hind_period_name, target_year, target_months, fcst_year, n_fcst_month, outdir) levs = (-700., -500., -300., -100., -50., -30., 30., 50., 100., 300., 500., 700.) #12 my_colors = ('#340003', '#ae000c', '#ff2e1b', '#ff5f26', '#ff9d37', '#fbe78a', '#ffffff', '#b0f0f7', '#93d3f6', '#76bbf3',
# Carrega arquivo da climatologia clim_file = Dataset('/Users/Hulk/TestPyFuncemeClimateTools/lib/python2.7/site-packages/PyFuncemeClimateTools/examples/pcp-daily-total-ec4amip_8908JFM.nc') clim_pcp = clim_file.variables['pcp'][:] # Carrega arquivo da previsão fsct_file = Dataset('/Users/Hulk/TestPyFuncemeClimateTools/lib/python2.7/site-packages/PyFuncemeClimateTools/examples/pcp-daily-total-ec4amip_2015JFM.nc') fsct_pcp = fsct_file.variables['pcp'][:] # Longitude e latitudes fsct_lon = fsct_file.variables['longitude'][:] fsct_lat = fsct_file.variables['latitude'][:] # Calcula anomalias # A função abaixo retornar dois parametros myanom, myanom_pad = cs.compute_anomaly(fsct_pcp, clim_pcp) # Shift na longitude e nos dados do modelo # Isso é necessário pois a longitude do NetCDF é no formato 0 - 360 # a função aceita valores de longitude no formato -180 - +180 myanom, fsct_lon = shiftgrid(180., myanom, fsct_lon, start=False) # Plot map # a variavel a ser plotada deve ser 2d pm.anom_map_shaded(myanom[0, :, :], fsct_lon-2.8125/2., fsct_lat-2.8125/2.)