from landlab import RasterModelGrid
import numpy as np
from landlab.plot.imshow import imshow_grid
%matplotlib inline
mg1 = RasterModelGrid((5, 5), 1.)
z1 = mg1.add_ones('topographic__elevation', at='node')
mg1.at_node['topographic__elevation'][2] = 0.
mg1.at_node['topographic__elevation']
mg1.set_watershed_boundary_condition(z1)
imshow_grid(mg1, mg1.status_at_node, color_for_closed='blue')
mg2 = RasterModelGrid((5, 5), 10.)
z2 = mg2.add_ones('topographic__elevation', at='node')
mg2.at_node['topographic__elevation'][1] = 0.
mg2.at_node['topographic__elevation']
mg2.set_watershed_boundary_condition_outlet_coords((0, 1), z2)
imshow_grid(mg2, mg2.status_at_node, color_for_closed='blue')
mg3 = RasterModelGrid((5, 5), 5.)
z3 = mg3.add_ones('topographic__elevation', at='node')
mg3.at_node['topographic__elevation'][5] = 0.
mg3.at_node['topographic__elevation']
mg3.set_watershed_boundary_condition_outlet_id(5, z3)
imshow_grid(mg3, mg3.status_at_node, color_for_closed='blue')
from landlab.io import read_esri_ascii
(grid_bijou, z_bijou) = read_esri_ascii('west_bijou_gully.asc', halo=1)
imshow_grid(grid_bijou, z_bijou)
grid_bijou.set_watershed_boundary_condition(z_bijou, 0)
imshow_grid(grid_bijou, grid_bijou.status_at_node, color_for_closed='blue')
imshow_grid(grid_bijou, z_bijou)