def test_no_reroute(): mg = RasterModelGrid((5, 5), xy_spacing=2.0) z = mg.add_zeros("topographic__elevation", at="node", dtype=float) z[1] = -1.0 z[6] = -2.0 z[19] = -2.0 z[18] = -1.0 z[17] = -3.0 fd = FlowDirectorSteepest(mg) fa = FlowAccumulator(mg) lmb = LakeMapperBarnes( mg, method="Steepest", fill_flat=True, redirect_flow_steepest_descent=True, track_lakes=True, ) openq = StablePriorityQueue() lake_dict = {1: deque([6]), 18: deque([17])} fd.run_one_step() # fill the director fields fa.run_one_step() # get a drainage_area orig_surf = lmb._track_original_surface() lmb._redirect_flowdirs(orig_surf, lake_dict, openq) assert mg.at_node["flow__receiver_node"][6] == 1 assert mg.at_node["flow__receiver_node"][17] == 18 assert mg.at_node["flow__receiver_node"][18] == 19
def test_no_reroute(): mg = RasterModelGrid((5, 5), xy_spacing=2.) z = mg.add_zeros("node", "topographic__elevation", dtype=float) z[1] = -1. z[6] = -2. z[19] = -2. z[18] = -1. z[17] = -3. fd = FlowDirectorSteepest(mg) fa = FlowAccumulator(mg) lmb = LakeMapperBarnes( mg, method="Steepest", fill_flat=True, redirect_flow_steepest_descent=True, track_lakes=True, ) lake_dict = {1: deque([6]), 18: deque([17])} fd.run_one_step() # fill the director fields fa.run_one_step() # get a drainage_area orig_surf = lmb._track_original_surface() lmb._redirect_flowdirs(orig_surf, lake_dict) assert mg.at_node["flow__receiver_node"][6] == 1 assert mg.at_node["flow__receiver_node"][17] == 18 assert mg.at_node["flow__receiver_node"][18] == 19
def test_no_reroute(): mg = RasterModelGrid((5, 5), 2.) z = mg.add_zeros('node', 'topographic__elevation', dtype=float) z[1] = -1. z[6] = -2. z[19] = -2. z[18] = -1. z[17] = -3. fd = FlowDirectorSteepest(mg) fa = FlowAccumulator(mg) lmb = LakeMapperBarnes(mg, method='Steepest', fill_flat=True, redirect_flow_steepest_descent=True, track_lakes=True) lake_dict = { 1: deque([ 6, ]), 18: deque([ 17, ]) } fd.run_one_step() # fill the director fields fa.run_one_step() # get a drainage_area orig_surf = lmb._track_original_surface() lmb._redirect_flowdirs(orig_surf, lake_dict) assert mg.at_node['flow__receiver_node'][6] == 1 assert mg.at_node['flow__receiver_node'][17] == 18 assert mg.at_node['flow__receiver_node'][18] == 19