landlab.grid.linkstatus¶
- class LinkStatus[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
- classmethod __contains__(value)¶
Return True if value is in cls.
value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members.
- __dir__()¶
Returns public methods and other interesting attributes.
- classmethod __getitem__(name)¶
Return the member matching name.
- classmethod __iter__()¶
Return members in definition order.
- classmethod __len__()¶
Return the number of members (no aliases)
- __new__(value)¶
- 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])
>>> is_active_link([NodeStatus.CORE, NodeStatus.FIXED_VALUE]) array([ True])
>>> is_active_link( ... [ ... [NodeStatus.FIXED_GRADIENT, NodeStatus.CORE], ... [NodeStatus.CORE, NodeStatus.CORE], ... ] ... ) array([False, True])
- 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])
>>> is_fixed_link([NodeStatus.CORE, NodeStatus.FIXED_VALUE]) array([False])
>>> is_fixed_link( ... [ ... [NodeStatus.FIXED_GRADIENT, NodeStatus.CORE], ... [NodeStatus.CORE, NodeStatus.CORE], ... ] ... ) array([ True, False])
- 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])
>>> is_inactive_link([NodeStatus.FIXED_GRADIENT, NodeStatus.FIXED_VALUE]) array([ True])
>>> is_inactive_link( ... [ ... [NodeStatus.FIXED_GRADIENT, NodeStatus.CLOSED], ... [NodeStatus.CORE, NodeStatus.CORE], ... ] ... ) array([ True, False])