landlab.graph.graph_convention¶
- class ConventionConverter[source]¶
Bases:
object
Convert between graph element naming conventions.
- Parameters:
convention ({"nlp", "nef", "cfc"}) – Naming convention to which to conform.
- CONVENTION = {'cfc': <landlab.graph.graph_convention.GraphConvention object>, 'nef': <landlab.graph.graph_convention.GraphConvention object>, 'nlp': <landlab.graph.graph_convention.GraphConvention object>}¶
- __init__(convention='nlp')[source]¶
- Parameters:
convention ({"nlp", "nef", "cfc"}) – Naming convention to which to conform.
- __new__(**kwargs)¶
- conform(name, from_convention)[source]¶
Convert a name to a new convention.
- Parameters:
name (str) – A name in the given convention.
from_convention ({"nlp", "nef", "cfc"}) – Naming convention of the provided string.
- Returns:
The name converted to the convention.
- Return type:
Examples
>>> from landlab.graph import ConventionConverter
>>> converter = ConventionConverter("nlp")
>> converter.conform(“nodes_at_edge”, “nef”) ‘nodes_at_link’
>>> converter.conform("node_at_cell", "cfc") 'corner_at_patch'
>>> converter = ConventionConverter("nef") >>> converter.conform("faces_at_cell", "cfc") 'edges_at_face'
- property convention¶
Name of the convention to conform to.
- class GraphConvention[source]¶
Bases:
object
Define a naming convention for graph elements.
Define a graph element naming convention.
- Parameters:
Examples
>>> from landlab.graph import GraphConvention >>> convention = GraphConvention("node", "edge", "face") >>> convention.node 'node' >>> convention.edge 'edge' >>> convention.edges 'edges'
>>> convention = GraphConvention("node", "link", "patch", faces="patches") >>> convention.face 'patch' >>> convention.faces 'patches'
- __init__(node, edge, face, nodes=None, edges=None, faces=None)[source]¶
Define a graph element naming convention.
- Parameters:
Examples
>>> from landlab.graph import GraphConvention >>> convention = GraphConvention("node", "edge", "face") >>> convention.node 'node' >>> convention.edge 'edge' >>> convention.edges 'edges'
>>> convention = GraphConvention("node", "link", "patch", faces="patches") >>> convention.face 'patch' >>> convention.faces 'patches'
- __new__(**kwargs)¶
- property edge¶
The name of lines that connect two nodes.
- property edges¶
The plural name of edge.
- property face¶
The name of objects made up of a closed set of edges.
- property faces¶
The plural name for face.
- property node¶
The name of things that are points.
- property nodes¶
The plural name for node.