def evalDryPeatVol(individual): # this should be returning dry peat volume in a tuple wt_canals = utilities.place_dams(oWTcanlist, srfcanlist, BLOCK_HEIGHT, individual, CNM) wt_canal_arr = np.zeros((ny,nx)) # (nx,ny) array with wt canal height in corresponding nodes for canaln, coords in enumerate(c_to_r_list): if canaln == 0: continue # because c_to_r_list begins at 1 wt_canal_arr[coords] = wt_canals[canaln] # phi_ini[coords] = wt_canals[canaln] dry_peat_volume =hydro.hydrology('transient', nx, ny, dx, dy, DAYS, ele, phi_ini, catchment_mask, wt_canal_arr, boundary_arr, peat_type_mask=peat_type_masked, httd=h_to_tra_and_C_dict, tra_to_cut=tra_to_cut, sto_to_cut=sto_to_cut, diri_bc=DIRI_BC, neumann_bc = None, plotOpt=False, remove_ponding_water=True, P=P, ET=ET, dt=TIMESTEP) return dry_peat_volume,
def log_likelihood(theta): t0 = theta[0] t1 = theta[1] t2 = theta[2] s0 = theta[3] s1 = theta[4] s2 = theta[5] wtd_sensors = hydro.hydrology('transient', SENSOR_POSITIONS, nx, ny, dx, dy, DAYS, ele, phi_ini, catchment_mask, wt_canal_arr, boundary_arr, peat_type_mask=peat_type_masked, peat_bottom_arr=peat_bottom, transmissivity=transmissivity, t0=t0, t1=t1, t2=t2, t_sapric_coef=1.0, storage=storage, s0=s0, s1=s1, s2=s2, s_sapric_coef=1.0, diri_bc=DIRI_BC, plotOpt=False, remove_ponding_water=True, P=P, ET=ET, dt=TIMESTEP) sigma2 = wtd_data_err**2 return -0.5 * np.sum((wtd_data - wtd_sensors)**2 / sigma2 + np.log(sigma2))
def energy(self): self.wt_canals = utilities.place_dams(oWTcanlist, srfcanlist, BLOCK_HEIGHT, self.state, CNM) wt_canal_arr = np.zeros( (ny, nx)) # (nx,ny) array with wt canal height in corresponding nodes for canaln, coords in enumerate(c_to_r_list): if canaln == 0: continue # because c_to_r_list begins at 1 wt_canal_arr[coords] = self.wt_canals[canaln] # Hinitial[coords] = self.wt_canals[canaln] # It should be like this, but not of much use if hydrology is doing the right thing. e = hydro.hydrology('transient', nx, ny, dx, dy, DAYS, ele, phi_ini, catchment_mask, wt_canal_arr, boundary_arr, peat_type_mask=peat_type_masked, httd=h_to_tra_and_C_dict, tra_to_cut=tra_to_cut, sto_to_cut=sto_to_cut, diri_bc=DIRI_BC, neumann_bc=None, plotOpt=False, remove_ponding_water=True, P=P, ET=ET, dt=TIMESTEP) return e
if canaln == 0: continue # because c_to_r_list begins at 1 wt_canal_arr[coords] = wt_canals[canaln] dry_peat_volume, wt_track_drained, wt_track_notdrained, avg_wt_over_time = hydro.hydrology( 'transient', nx, ny, dx, dy, DAYS, ele, phi_ini, catchment_mask, wt_canal_arr, boundary_arr, peat_type_mask=peat_type_masked, httd=h_to_tra_and_C_dict, tra_to_cut=tra_to_cut, sto_to_cut=sto_to_cut, diri_bc=DIRI_BC, neumann_bc=None, plotOpt=False, remove_ponding_water=True, P=P, ET=ET, dt=TIMESTEP) water_blocked_canals = sum(np.subtract(wt_canals[1:], oWTcanlist[1:])) cum_Vdp_nodams = 21088.453521509597
for canaln, coords in enumerate(c_to_r_list): if canaln == 0: continue # because c_to_r_list begins at 1 wt_canal_arr[coords] = wt_canals[canaln] wtd = hydro.hydrology('transient', nx, ny, dx, dy, DAYS, ele, phi_ini, catchment_mask, wt_canal_arr, boundary_arr, peat_type_mask=peat_type_masked, httd=h_to_tra_and_C_dict, tra_to_cut=tra_to_cut, sto_to_cut=sto_to_cut, diri_bc=DIRI_BC, neumann_bc=None, plotOpt=False, remove_ponding_water=True, P=np.array([P]), ET=ET, dt=TIMESTEP) print('COMPLETED') """ WRITE NEXT WTD and output info to file """