def C_value(phi, ele, sto_to_cut, cmask, drmask_not): # Some inputs are in fipy CellVariable type gwt = phi.value * cmask.value - ele c = hydro_utils.peat_map_h_to_sto( soil_type_mask=peat_type_mask, gwt=gwt, h_to_tra_and_C_dict=httd) - sto_to_cut c[c < 0] = 1e-3 # Same reasons as for D ccell = fp.CellVariable( mesh=mesh, value=c ) # diffusion coefficient, transmissivity. As a cell variable. return ccell.value
peat_type_masked = peat_type_arr * catchment_mask peat_bottom_elevation = -peat_depth_arr * catchment_mask # meters with respect to dem surface. Should be negative! h_to_tra_and_C_dict, K = hydro_utils.peat_map_interp_functions( KADJUST) # Load peatmap soil types' physical properties dictionary #soiltypes[soiltypes==255] = 0 # 255 is nodata value. 1 is water (useful for hydrology! Maybe, same treatment as canals). #BOTTOM_ELE = -6.0 #peat_bottom_elevation = np.ones(shape=dem.shape) * BOTTOM_ELE #peat_bottom_elevation = peat_bottom_elevation*catchment_mask tra_to_cut = hydro_utils.peat_map_h_to_tra( soil_type_mask=peat_type_masked, gwt=peat_bottom_elevation, h_to_tra_and_C_dict=h_to_tra_and_C_dict) sto_to_cut = hydro_utils.peat_map_h_to_sto( soil_type_mask=peat_type_masked, gwt=peat_bottom_elevation, h_to_tra_and_C_dict=h_to_tra_and_C_dict) sto_to_cut = sto_to_cut * catchment_mask.ravel() srfcanlist = [dem[coords] for coords in c_to_r_list] n_canals = len(c_to_r_list) # HANDCRAFTED WATER LEVEL IN CANALS. CHANGE WITH MEASURED, IDEALLY. oWTcanlist = [x - CANAL_WATER_LEVEL for x in srfcanlist] """ ########################################### Initial configuration of blocks in canals ########################################### """