# load results with open('out/abb_with_comp.pkl', 'r') as f: plots = pickle.load(f) ############################################################################### # main for plotname in plots: plot = plots[plotname] # init sw = ABBSW() aw = ABBAW() L, U, N, T, x, plotfile = plot['attrs'] nsw, naw = plot['nsw'], plot['naw'] dx = float(U - L) / N plotname = plotfile.split('/')[-1].split('.')[0] # setup kernels and connect them to each other for k in [ sw, aw ]: k.L, k.U = L, U k.setup(MidPoint(), N) k.measurements(plotfile, plotname)
# add stderr info logger logger = logging.getLogger() info = logging.StreamHandler() info.setLevel(logging.INFO) logger.addHandler(info) logging.info("START: %s", time.asctime()) ############################################################################### # initial conditions initial_populations = [] # instantiate an SW kernel to grab an 'x' array... sw = ABBSW() sw.L, sw.U = L, U sw.setup(MidPoint(), N) # dens: # / 10 m^2 scenarios = { 'C': { 'sw': { 'dens': 8.846, 'mu': 25.7, 'sd': 17.1, 'min': 3.8, 'max': 53.5 }, 'aw': { 'dens': 3.308, 'mu': 30.5, 'sd': 22.9, 'min': 9.4, 'max': 76.1 }, }, 'CD': { 'sw': { 'dens': 3.778, 'mu': 25.7, 'sd': 17.1, 'min': 3.8, 'max': 53.5 }, 'aw': { 'dens': 7.278, 'mu': 63.8, 'sd': 28.5, 'min': 23.7, 'max': 109.2 }, }, 'D': {
npsp = 0 nmeas = 0 nyears = [] dbh = { 'sw': [], 'aw': [] } sph = { 'sw': [], 'aw': [], 'tot': [] } ba = { 'sw': [], 'aw': [], 'tot': [] } for plotname in plots: if plotname in ignore: continue ba_sw_year = [] ba_aw_year = [] k = ABBSW() k.measurements('kernels/abb/%s.csv' % plotname, plotname) for year in k.years: dbh['sw'].extend(k.meas['SW'][year]) dbh['aw'].extend(k.meas['AW'][year]) ba_sw = sum([ pi*(x/2000)**2 for x in k.meas['SW'][year] ]) / k.plot_size * 1e4 ba_aw = sum([ pi*(x/2000)**2 for x in k.meas['AW'][year] ]) / k.plot_size * 1e4 ba['sw'].append(ba_sw) ba['aw'].append(ba_aw) ba['tot'].append(ba_sw + ba_aw) ba_sw_year.append(ba_sw) ba_aw_year.append(ba_aw)
"D": {"color": "r", "marker": "o"}, "CD": {"color": "c", "marker": "^"}, "DC": {"color": "m", "marker": "v"}, } figsph, sph = plt.subplots(1, 3, sharey=True) figba, ba = plt.subplots(1, 3, sharey=True) for plotname in plots: plot = plots[plotname] # init sw = ABBSW() aw = ABBAW() L, U, N, T, x, name = plot["attrs"] nsw, naw = plot["nsw"], plot["naw"] dx = float(U - L) / N # setup kernels and connect them to each other for k in [sw, aw]: k.L, k.U = L, U k.setup(MidPoint(), N) mrates = [] for j in range(1, nsw.shape[0] - 1): mr = sw.population(nsw[j + 1]) / sw.population(nsw[j])