landlab

Boundary handling for grid edges

set_status_at_node_on_edges(grid, right=None, top=None, left=None, bottom=None)[source]

Set node status on grid edges.

Parameters:

grid : RasterModelGrid

A grid.

right : int, optional

Node status along right edge.

top : int, optional

Node status along top edge.

left : int, optional

Node status along left edge.

bottom : int, optional

Node status along bottom edge.

Examples

>>> from landlab import RasterModelGrid, CLOSED_BOUNDARY
>>> grid = RasterModelGrid((3, 4))
>>> grid.status_at_node 
array([1, 1, 1, 1,
       1, 0, 0, 1,
       1, 1, 1, 1], dtype=int8)
>>> grid.set_status_at_node_on_edges(right=CLOSED_BOUNDARY)
>>> grid.status_at_node 
array([1, 1, 1, 4,
       1, 0, 0, 4,
       1, 1, 1, 4], dtype=int8)
>>> from landlab import FIXED_GRADIENT_BOUNDARY
>>> grid = RasterModelGrid((3, 4))

The status of a corner is set along with its clockwise edge. That is, if setting the status for the top and right edges, the upper-right corner has the status of the right edge.

>>> grid.set_status_at_node_on_edges(top=CLOSED_BOUNDARY,
...     right=FIXED_GRADIENT_BOUNDARY)
>>> grid.status_at_node 
array([1, 1, 1, 2,
       1, 0, 0, 2,
       4, 4, 4, 2], dtype=int8)

In the above example, if you wanted the corner to have the status of the top edge, you need to make two calls to set_status_at_node_on_edges,

>>> grid = RasterModelGrid((3, 4))
>>> grid.set_status_at_node_on_edges(right=FIXED_GRADIENT_BOUNDARY)
>>> grid.set_status_at_node_on_edges(top=CLOSED_BOUNDARY)
>>> grid.status_at_node 
array([1, 1, 1, 2,
       1, 0, 0, 2,
       4, 4, 4, 4], dtype=int8)

An example that sets all of the edges shows how corners are set.

>>> grid.set_status_at_node_on_edges(right=1, top=2, left=3, bottom=4)
>>> grid.status_at_node 
array([3, 4, 4, 4,
       3, 0, 0, 1,
       2, 2, 2, 1], dtype=int8)

LLCATS: BC