total_contribs[scen] = np.array( [median[2100], lower_perc[2100], upper_perc[2100]]) oloc -= 1. xloc -= 1. low = lower_perc[2081:2100].mean() * 1.e3 med = median[2081:2100].mean() * 1.e3 upp = upper_perc[2081:2100].mean() * 1.e3 axy.plot([oloc - 1, oloc + 1], [med, med], lw=3, color=rcpcoldict[scen]) axy.fill_between([oloc - 1, oloc + 1], [low, low], [upp, upp], color=rcpcoldict[scen], alpha=.4, lw=0.) low, med, upp = ipcc.get_ipcc_range(scen, "mean_slr_2081_2100") axy.fill_between([xloc - 1, xloc + 1], [low, low], [upp, upp], color=rcpcoldict[scen], alpha=.4, lw=0.) axy.plot([xloc - 1, xloc + 1], [med, med], color=rcpcoldict[scen], lw=3, alpha=1.) axy.set_xlim(-1, 11) axy.text(1.5, 1200, "M15", rotation="vertical",
def fig4(projection_data): plot_period = np.arange(2000, 2101, 1) plt.subplots_adjust(left=0.1, bottom=0.1, right=1.0, top=0.97, wspace=0.1, hspace=None) ax6 = plt.subplot(111) # ipcc ranges divider = make_axes_locatable(ax6) axy = divider.append_axes("right", size=0.8, pad=0.0, sharey=ax6) axy.axis("off") axy.axvspan(0, 10, facecolor='0.5', alpha=0.2, lw=0) total_contribs = {} xloc = 10 oloc = 4 for k, scen in enumerate(["RCP85", "RCP45", "RCP3PD"]): total_slr = da.zeros_like(projection_data[scen]["thermexp"]) for i, name in enumerate(contrib_ids): # sum up all contributions single_contrib = projection_data[scen][name] total_slr += single_contrib contrib = total_slr - \ total_slr[1986:2005, :].mean(axis=0) upper_perc = da.DimArray(np.percentile(contrib, 95, axis=1), axes=contrib.time, dims="time") lower_perc = da.DimArray(np.percentile(contrib, 5, axis=1), axes=contrib.time, dims="time") median = da.DimArray(np.percentile(contrib, 50, axis=1), axes=contrib.time, dims="time") h = ax6.fill_between( plot_period, lower_perc[plot_period] * 1e3, upper_perc[plot_period] * 1e3, color=rcpcoldict[scen], alpha=.4, lw=0.5) ax6.plot(plot_period, median[plot_period] * 1e3, lw=3, color=rcpcoldict[scen], alpha=1., label=rcpnamedict[scen]) total_contribs[scen] = np.array( [median[2100], lower_perc[2100], upper_perc[2100]]) oloc -= 1. xloc -= 1. low = lower_perc[2081:2100].mean() * 1.e3 med = median[2081:2100].mean() * 1.e3 upp = upper_perc[2081:2100].mean() * 1.e3 axy.plot([oloc - 1, oloc + 1], [med, med], lw=3, color=rcpcoldict[scen]) axy.fill_between([oloc - 1, oloc + 1], [low, low], [upp, upp], color=rcpcoldict[scen], alpha=.4, lw=0.) low, med, upp = ipcc.get_ipcc_range(scen, "mean_slr_2081_2100") axy.fill_between([xloc - 1, xloc + 1], [low, low], [upp, upp], color=rcpcoldict[scen], alpha=.4, lw=0.) axy.plot([xloc - 1, xloc + 1], [med, med], color=rcpcoldict[scen], lw=3, alpha=1.) axy.set_xlim(-1, 11) axy.text(1.5, 1200, "M16", rotation="vertical", horizontalalignment='center', verticalalignment='center') axy.text(7.5, 1200, "IPCC", rotation="vertical", horizontalalignment='center', verticalalignment='center') ax6.set_xlim(plot_period[0], plot_period[-1]) ax6.set_xlabel("Time in years") ax6.set_ylabel("Sea level in mm") l1 = ax6.legend(ncol=1, loc="center left") l1.draw_frame(0) for l in l1.get_lines(): l.set_alpha(1)
alpha=1., label=rcpnamedict[scen]) total_contribs[scen] = np.array( [median[2100], lower_perc[2100], upper_perc[2100]]) oloc -= 1. xloc -= 1. low = lower_perc[2081:2100].mean() * 1.e3 med = median[2081:2100].mean() * 1.e3 upp = upper_perc[2081:2100].mean() * 1.e3 axy.plot([oloc - 1, oloc + 1], [med, med], lw=3, color=rcpcoldict[scen]) axy.fill_between([oloc - 1, oloc + 1], [low, low], [upp, upp], color=rcpcoldict[scen], alpha=.4, lw=0.) low, med, upp = ipcc.get_ipcc_range(scen, "mean_slr_2081_2100") axy.fill_between([xloc - 1, xloc + 1], [low, low], [upp, upp], color=rcpcoldict[scen], alpha=.4, lw=0.) axy.plot([xloc - 1, xloc + 1], [med, med], color=rcpcoldict[scen], lw=3, alpha=1.) axy.set_xlim(-1, 11) axy.text(1.5, 1200, "M15", rotation="vertical", horizontalalignment='center', verticalalignment='center') axy.text(7.5, 1200, "IPCC", rotation="vertical", horizontalalignment='center', verticalalignment='center') ax6.set_xlim(plot_period[0], plot_period[-1]) ax6.set_xlabel("Time in years") ax6.set_ylabel("Sea level in mm")