def test_get_lowest_landscape_boundary_for_watersheds_small(): # Note: This is not a realistic example. The heights used in the test would not have resulted in these watersheds. nx = 4 ny = 4 watersheds = [np.array([0, 4, 8, 12, 13, 14, 15]), np.array([1, 2]), np.array([3, 7, 11]), np.array([5, 6]), np.array([9, 10])] heights = np.array([0, 2, 3, 4, 4, 3, 2, 1, 5, 6, 7, 8, 8, 7, 6, 5]) result_lowest_landscape_boundary = np.array([0, 2, 1, -1, -1]) lowest_landscape_boundary = trap_analysis.get_lowest_landscape_boundary_for_watersheds(watersheds, heights, nx, ny) are_equal = np.array_equal(lowest_landscape_boundary, result_lowest_landscape_boundary) assert are_equal
def test_get_lowest_landscape_boundary_for_watersheds(): # This is a modified version of the 7x7 where two of the boundary nodes have heights not equal to 10 nx = 7 ny = 7 watersheds = [np.array([0, 1, 2, 7, 8, 9, 14, 15, 16, 21, 22]), np.array([3, 4, 5, 6, 10, 11, 12, 13, 17, 18, 19, 20, 23, 24, 25, 26, 27, 32, 33, 34, 39, 40, 41, 46, 47, 48]), np.array([28, 29, 30, 31, 35, 36, 37, 38, 42, 43, 44, 45])] heights = np.array([1, 10, 10, 10, 10, 10, 10, 10, 1, 8, 7, 7, 7, 10, 10, 6, 8, 5, 5, 5, 10, 10, 8, 8, 4, 2, 4, 10, 10, 9, 9, 3, 3, 3, 10, 10, 0, 1, 5, 5, 5, 10, 9, 10, 10, 10, 10, 10, 10]) result_lowest_boundary = np.array([1, 10, 9]) lowest_boundary = trap_analysis.get_lowest_landscape_boundary_for_watersheds(watersheds, heights, nx, ny) are_equal = np.array_equal(lowest_boundary, result_lowest_boundary) assert are_equal