def describe(self): """ Gives a brief printed summary of the scenario """ ha = self.area km = self.area * 0.01 site_ha = f"{ha:,.0f}ha" site_km = f"{km:,.0f}km{chr(0x00B2)}" a = f"{site_ha} ({site_km})" b = self.fell_age if b is False: b = "no-fell strategy," c = "" else: b = f"{b}-year rotation" c = f" ({int(np.round(self.felling_intensity*100,0))}% fell)" s = form.forest_labels(self.spp, short=True, eng=True) if self.thinning_ages is not False: d = f"{str([n*100 for n in self.thinning_intensities]).strip('[]')}%" e = f"{str(self.thinning_ages).strip('[]')}" d = f"with thinnings in years: {e} of intensities: {d}." else: d = "with no thinning." e = "" output = f" is {a} of {s} forest managed on a {b}{c} {d}" return output
# index, summary["mean"], zorder=100, color="k", label="Mean values", marker="x", s=12 # ) scat = chart.scatter( index, summary["sterman"], zorder=100, color="k", label="Sterman et al. values", marker="x", s=30, ) labs = [form.forest_labels(i, eng=True) for i in SPP] labs.insert(0, "") chart.set_ylabel("Time to carbon \nsequestration parity (years)", fontsize=12) chart.tick_params(axis="both", which="major", labelsize=10) chart.set_xticklabels((labs), rotation=45, fontsize=10, horizontalalignment="right") for label in chart.get_yticklabels(): label.set_fontsize(10) # Size here overrides font_prop chart.grid(color="k", alpha=0.5, linestyle=":", zorder=1) chart.legend(fontsize=10) # ), ncol=2) plt.ylim(ymin=0, ymax=121) plt.xlim(xmin=-0.5, xmax=7.5) plt.subplots_adjust( top=0.952, bottom=0.374, left=0.211, right=0.968, hspace=0.2, wspace=0.2
fig, axs = plt.subplots(4, 2, sharex="all", sharey="all", figsize=inches) axs = axs.flatten() fig.text(0.5, 0.1, "Time (years)", ha="center", fontsize=14) fig.text( 0.03, 0.6, r"Carbon (t.ha$^{-1}$)", va="center", rotation="vertical", fontsize=14 ) palette = plt.get_cmap("tab10") # pretty colours for sp in spp: i = spp.index(sp) ax = axs[i] # Set up graph, x and y lists ax.set_title(form.forest_labels(sp, short="star", eng=True), fontsize=10) y1 = biomass[sp] y2 = soil[sp] x = list(soil.index) # And plot to graph ax.plot(x, y1, linewidth=1.0, label="Forest carbon", color=palette(0)) ax.plot(x, y2, linewidth=1.0, label="Soil carbon", color=palette(1)) # Add original smith et al data x2 = var.original_biomass_data[sp]["x"] y1 = var.original_biomass_data[sp]["y"] y2 = var.original_soil_data[sp]["y"] ax.scatter( x2, y1, color="k", s=8, marker="x", zorder=10, label="USDA forest carbon data" ) ax.scatter(
color=palette(0), label="SBCM equilibrium values", marker="o", s=30, alpha=0.5, ) scat = chart.scatter( index, summary["sterman"], color=palette(0), marker="x", label="Sterman et al. equilibrium values", s=40, ) labs = [form.forest_labels(i, short="star", eng=True) for i in SPP] chart.set_ylabel("Forest carbon at\nequilibrium (tC.ha$^{-1}$)", fontsize=12) chart.tick_params(axis="both", which="major", labelsize=10) chart.set_xticklabels((labs), rotation=45, fontsize=10, horizontalalignment="right") chart.grid(color="k", alpha=0.2, linestyle=":", zorder=1) chart.legend(fontsize=10) chart.set_xticks(index) plt.ylim(ymin=0, ymax=350) plt.xlim(xmin=-0.5, xmax=7.5) plt.subplots_adjust(top=0.949,
y_all1 = y_all1 + [y_var] x_all2 = x_all2 + [np.mean(x)] y_all2 = y_all2 + [np.mean(y)] plot = chart.errorbar( np.mean(x), np.mean(y), yerr=y_var, xerr=x_var, color=palette(index), # label="col_1", ls="none", marker="o", capsize=3, linewidth=0.5, label=form.forest_labels(sp, short="star", eng=True), ) slope, intercept, r_value, p_value, std_err = linregress(x_all1, y_all1) # https://blog.minitab.com/blog/adventures-in-statistics-2/how-to-interpret-regression-analysis-results-p-values-and-coefficients print(f"r\N{SUPERSCRIPT TWO} value = {r_value}") print(f"p value = {p_value}") slope, intercept, r_value, p_value, std_err = linregress(x_all2, y_all2) r_value = np.round(r_value, 2) r_line_x = np.arange(-100, 3500, 100) r_line_y = intercept + r_line_x * slope plot = chart.plot(r_line_x, r_line_y, marker=None, color="k", ls=":") chart.set_ylabel("Site carbon at equilibrium (tC.ha$^{-1}$)", fontsize=12)