landlab.grid.linkstatus module#
- class LinkStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnum
Define the link types
- ACTIVE = 0#
Indicate a link is active, and can carry flux
- FIXED = 2#
Indicate a link has a fixed (gradient) value, & behaves as a boundary
- INACTIVE = 4#
Indicate a link is inactive, and cannot carry flux
- is_active_link(node_status_at_link)[source]#
Find links that are active.
A link is active if it connects a core node with another core node or a fixed value boundary.
- Parameters:
node_status_at_link (ndarray of int, shape (n_links, 2)) – Node status a link tail and head.
- Returns:
True if link is isactive.
- Return type:
ndarray of bool, shape (n_links, )
Examples
>>> from landlab.grid.linkstatus import is_active_link >>> from landlab import NodeStatus >>> is_active_link([NodeStatus.CORE, NodeStatus.FIXED_GRADIENT]) array([False], dtype=bool)
>>> is_active_link([NodeStatus.CORE, NodeStatus.FIXED_VALUE]) array([ True], dtype=bool)
>>> is_active_link( ... [ ... [NodeStatus.FIXED_GRADIENT, NodeStatus.CORE], ... [NodeStatus.CORE, NodeStatus.CORE] ... ] ... ) array([False, True], dtype=bool)
- is_fixed_link(node_status_at_link)[source]#
Find links that are fixed.
A link is fixed if it connects a core node with a fixed value boundary node.
- Parameters:
node_status_at_link (ndarray of int, shape (n_links, 2)) – Node status a link tail and head.
- Returns:
True if link is fixed.
- Return type:
ndarray of bool, shape (n_links, )
Examples
>>> from landlab.grid.linkstatus import is_fixed_link >>> from landlab import NodeStatus >>> is_fixed_link([NodeStatus.CORE, NodeStatus.FIXED_GRADIENT]) array([ True], dtype=bool)
>>> is_fixed_link([NodeStatus.CORE, NodeStatus.FIXED_VALUE]) array([False], dtype=bool)
>>> is_fixed_link( ... [ ... [NodeStatus.FIXED_GRADIENT, NodeStatus.CORE], ... [NodeStatus.CORE, NodeStatus.CORE] ... ] ... ) array([ True, False], dtype=bool)
- is_inactive_link(node_status_at_link)[source]#
Find links that are inactive.
A link is inactive if it connects two boundary nodes or one of its nodes is closed.
- Parameters:
node_status_at_link (ndarray of int, shape (n_links, 2)) – Node status a link tail and head.
- Returns:
True if link is isactive.
- Return type:
ndarray of bool, shape (n_links, )
Examples
>>> from landlab.grid.linkstatus import is_inactive_link >>> from landlab import NodeStatus >>> is_inactive_link([NodeStatus.CORE, NodeStatus.CLOSED]) array([ True], dtype=bool)
>>> is_inactive_link([NodeStatus.FIXED_GRADIENT, NodeStatus.FIXED_VALUE]) array([ True], dtype=bool)
>>> is_inactive_link([[NodeStatus.FIXED_GRADIENT, NodeStatus.CLOSED], ... [NodeStatus.CORE, NodeStatus.CORE]]) array([ True, False], dtype=bool)