landlab.graph.voronoi package#
Subpackages#
Submodules#
landlab.graph.voronoi.dual_voronoi module#
- class DualVoronoiGraph(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Bases:
DualGraph
,DelaunayGraph
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DualVoronoiGraph >>> node_x = [0, 1, 2, 3, ... 0.2, 1.2, 2.2, 3.2, ... 0.4, 1.4, 2.4, 3.4] >>> node_y = [0, 0, 0, 0, ... 1, 1, 1, 1, ... 2, 2, 2, 2] >>> graph = DualVoronoiGraph((node_y, node_x), sort=True) >>> graph.x_of_corner array([ 0.5, 1.5, 2.5, 0.7, 1.7, 2.7, 0.7, 1.7, 2.7, 0.9, 1.9, 2.9]) >>> graph.y_of_corner array([ 0.42, 0.42, 0.42, 0.58, 0.58, 0.58, 1.42, 1.42, 1.42, 1.58, 1.58, 1.58]) >>> graph.corners_at_face array([[ 0, 3], [ 3, 1], [ 1, 4], [ 4, 2], [ 2, 5], [ 3, 6], [ 4, 7], [ 5, 8], [ 6, 9], [ 9, 7], [ 7, 10], [10, 8], [ 8, 11]]) >>> graph.faces_at_corner array([[ 0, -1, -1], [ 2, 1, -1], [ 4, 3, -1], [ 5, 0, 1], [ 6, 2, 3], [ 7, 4, -1], [ 8, 5, -1], [10, 9, 6], [12, 11, 7], [ 8, 9, -1], [10, 11, -1], [12, -1, -1]]) >>> graph.node_at_cell array([5, 6])
- __init__(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DualVoronoiGraph >>> node_x = [0, 1, 2, 3, ... 0.2, 1.2, 2.2, 3.2, ... 0.4, 1.4, 2.4, 3.4] >>> node_y = [0, 0, 0, 0, ... 1, 1, 1, 1, ... 2, 2, 2, 2] >>> graph = DualVoronoiGraph((node_y, node_x), sort=True) >>> graph.x_of_corner array([ 0.5, 1.5, 2.5, 0.7, 1.7, 2.7, 0.7, 1.7, 2.7, 0.9, 1.9, 2.9]) >>> graph.y_of_corner array([ 0.42, 0.42, 0.42, 0.58, 0.58, 0.58, 1.42, 1.42, 1.42, 1.58, 1.58, 1.58]) >>> graph.corners_at_face array([[ 0, 3], [ 3, 1], [ 1, 4], [ 4, 2], [ 2, 5], [ 3, 6], [ 4, 7], [ 5, 8], [ 6, 9], [ 9, 7], [ 7, 10], [10, 8], [ 8, 11]]) >>> graph.faces_at_corner array([[ 0, -1, -1], [ 2, 1, -1], [ 4, 3, -1], [ 5, 0, 1], [ 6, 2, 3], [ 7, 4, -1], [ 8, 5, -1], [10, 9, 6], [12, 11, 7], [ 8, 9, -1], [10, 11, -1], [12, -1, -1]]) >>> graph.node_at_cell array([5, 6])
- property adjacent_corners_at_corner#
Get adjacent corners.
See also
adjacent_nodes_at_node
- property adjacent_faces_at_face#
- property angle_of_face#
Get the angle of each face.
See also
angle_of_link
- property area_of_cell#
Get the area of each cell.
See also
area_of_patch
- property cells_at_corner#
Get the cells that touch each corner.
See also
patches_at_node
- property cells_at_face#
Get the cells on either side of each face.
See also
patches_at_link
- property corner_at_face_head#
Get corners at face head.
See also
node_at_link_head
- property corner_at_face_tail#
Get corners at face tail.
See also
node_at_link_tail
- property corner_x#
- property corner_y#
- property corners#
Get identifier for each corner.
See also
nodes
- property corners_at_cell#
Get the corners that define a cell.
See also
nodes_at_patch
- property corners_at_face#
Get corners at either end of faces.
See also
nodes_at_link
- property face_dirs_at_corner#
Return face directions into each corner.
See also
link_dirs_at_node
- property faces_at_cell#
Get the faces that define a cell.
See also
links_at_patch
- property faces_at_corner#
Get faces touching a corner.
See also
links_at_node
- property length_of_face#
Get the length of faces.
See also
length_of_link
- property midpoint_of_face#
Get the middle of faces.
See also
midpoint_of_link
- property number_of_cells#
Get the number of cells.
See also
number_of_patches
- property number_of_corners#
Get total number of corners.
See also
number_of_nodes
- property number_of_faces#
Get corners at face head.
See also
number_of_links
- property perimeter_corners#
Get corners on the convex hull of a Graph.
See also
perimeter_nodes
- property unit_vector_at_corner#
Get a unit vector for each corner.
See also
unit_vector_at_node
- property unit_vector_at_face#
Make arrays to store the unit vectors associated with each face.
See also
unit_vector_at_link
- property x_of_corner#
Get x-coordinate of corner.
See also
x_of_node
- property xy_of_cell#
Get the centroid of each cell.
See also
xy_of_patch
- property xy_of_corner#
Get x and y-coordinates of corner.
See also
xy_of_node
- property xy_of_face#
- property y_of_corner#
Get y-coordinate of corner.
See also
y_of_node
landlab.graph.voronoi.voronoi module#
- class DelaunayGraph(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Bases:
Graph
Graph of a voronoi grid.
Examples
>>> from landlab.graph import DelaunayGraph
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DelaunayGraph >>> node_x = [0.0, 1.0, 2.0, ... 0.9, 1.9, 2.9] >>> node_y = [0, 0, 0, ... 2, 2, 2] >>> graph = DelaunayGraph((node_y, node_x), sort=True) >>> graph.x_of_node array([ 0. , 1. , 2. , 0.9, 1.9, 2.9]) >>> graph.y_of_node array([ 0., 0., 0., 2., 2., 2.]) >>> graph.nodes_at_link array([[0, 1], [1, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 5], [3, 4], [4, 5]]) >>> graph.links_at_node array([[ 0, 2, -1, -1], [ 1, 4, 3, 0], [ 6, 5, 1, -1], [ 7, 2, 3, -1], [ 8, 7, 4, 5], [ 8, 6, -1, -1]]) >>> graph.links_at_patch array([[3, 2, 0], [5, 4, 1], [7, 3, 4], [8, 5, 6]])
>>> graph.nodes_at_patch array([[3, 0, 1], [4, 1, 2], [4, 3, 1], [5, 4, 2]])
- __init__(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DelaunayGraph >>> node_x = [0.0, 1.0, 2.0, ... 0.9, 1.9, 2.9] >>> node_y = [0, 0, 0, ... 2, 2, 2] >>> graph = DelaunayGraph((node_y, node_x), sort=True) >>> graph.x_of_node array([ 0. , 1. , 2. , 0.9, 1.9, 2.9]) >>> graph.y_of_node array([ 0., 0., 0., 2., 2., 2.]) >>> graph.nodes_at_link array([[0, 1], [1, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 5], [3, 4], [4, 5]]) >>> graph.links_at_node array([[ 0, 2, -1, -1], [ 1, 4, 3, 0], [ 6, 5, 1, -1], [ 7, 2, 3, -1], [ 8, 7, 4, 5], [ 8, 6, -1, -1]]) >>> graph.links_at_patch array([[3, 2, 0], [5, 4, 1], [7, 3, 4], [8, 5, 6]])
>>> graph.nodes_at_patch array([[3, 0, 1], [4, 1, 2], [4, 3, 1], [5, 4, 2]])
Module contents#
- class DelaunayGraph(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Bases:
Graph
Graph of a voronoi grid.
Examples
>>> from landlab.graph import DelaunayGraph
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DelaunayGraph >>> node_x = [0.0, 1.0, 2.0, ... 0.9, 1.9, 2.9] >>> node_y = [0, 0, 0, ... 2, 2, 2] >>> graph = DelaunayGraph((node_y, node_x), sort=True) >>> graph.x_of_node array([ 0. , 1. , 2. , 0.9, 1.9, 2.9]) >>> graph.y_of_node array([ 0., 0., 0., 2., 2., 2.]) >>> graph.nodes_at_link array([[0, 1], [1, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 5], [3, 4], [4, 5]]) >>> graph.links_at_node array([[ 0, 2, -1, -1], [ 1, 4, 3, 0], [ 6, 5, 1, -1], [ 7, 2, 3, -1], [ 8, 7, 4, 5], [ 8, 6, -1, -1]]) >>> graph.links_at_patch array([[3, 2, 0], [5, 4, 1], [7, 3, 4], [8, 5, 6]])
>>> graph.nodes_at_patch array([[3, 0, 1], [4, 1, 2], [4, 3, 1], [5, 4, 2]])
- __init__(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DelaunayGraph >>> node_x = [0.0, 1.0, 2.0, ... 0.9, 1.9, 2.9] >>> node_y = [0, 0, 0, ... 2, 2, 2] >>> graph = DelaunayGraph((node_y, node_x), sort=True) >>> graph.x_of_node array([ 0. , 1. , 2. , 0.9, 1.9, 2.9]) >>> graph.y_of_node array([ 0., 0., 0., 2., 2., 2.]) >>> graph.nodes_at_link array([[0, 1], [1, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 5], [3, 4], [4, 5]]) >>> graph.links_at_node array([[ 0, 2, -1, -1], [ 1, 4, 3, 0], [ 6, 5, 1, -1], [ 7, 2, 3, -1], [ 8, 7, 4, 5], [ 8, 6, -1, -1]]) >>> graph.links_at_patch array([[3, 2, 0], [5, 4, 1], [7, 3, 4], [8, 5, 6]])
>>> graph.nodes_at_patch array([[3, 0, 1], [4, 1, 2], [4, 3, 1], [5, 4, 2]])
- class DualVoronoiGraph(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Bases:
DualGraph
,DelaunayGraph
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DualVoronoiGraph >>> node_x = [0, 1, 2, 3, ... 0.2, 1.2, 2.2, 3.2, ... 0.4, 1.4, 2.4, 3.4] >>> node_y = [0, 0, 0, 0, ... 1, 1, 1, 1, ... 2, 2, 2, 2] >>> graph = DualVoronoiGraph((node_y, node_x), sort=True) >>> graph.x_of_corner array([ 0.5, 1.5, 2.5, 0.7, 1.7, 2.7, 0.7, 1.7, 2.7, 0.9, 1.9, 2.9]) >>> graph.y_of_corner array([ 0.42, 0.42, 0.42, 0.58, 0.58, 0.58, 1.42, 1.42, 1.42, 1.58, 1.58, 1.58]) >>> graph.corners_at_face array([[ 0, 3], [ 3, 1], [ 1, 4], [ 4, 2], [ 2, 5], [ 3, 6], [ 4, 7], [ 5, 8], [ 6, 9], [ 9, 7], [ 7, 10], [10, 8], [ 8, 11]]) >>> graph.faces_at_corner array([[ 0, -1, -1], [ 2, 1, -1], [ 4, 3, -1], [ 5, 0, 1], [ 6, 2, 3], [ 7, 4, -1], [ 8, 5, -1], [10, 9, 6], [12, 11, 7], [ 8, 9, -1], [10, 11, -1], [12, -1, -1]]) >>> graph.node_at_cell array([5, 6])
- __init__(node_y_and_x, max_node_spacing=None, sort=False, perimeter_links=None)[source]#
Create a voronoi grid.
- Parameters:
nodes (tuple of array_like) – Coordinates of every node. First y, then x.
Examples
>>> from landlab.graph import DualVoronoiGraph >>> node_x = [0, 1, 2, 3, ... 0.2, 1.2, 2.2, 3.2, ... 0.4, 1.4, 2.4, 3.4] >>> node_y = [0, 0, 0, 0, ... 1, 1, 1, 1, ... 2, 2, 2, 2] >>> graph = DualVoronoiGraph((node_y, node_x), sort=True) >>> graph.x_of_corner array([ 0.5, 1.5, 2.5, 0.7, 1.7, 2.7, 0.7, 1.7, 2.7, 0.9, 1.9, 2.9]) >>> graph.y_of_corner array([ 0.42, 0.42, 0.42, 0.58, 0.58, 0.58, 1.42, 1.42, 1.42, 1.58, 1.58, 1.58]) >>> graph.corners_at_face array([[ 0, 3], [ 3, 1], [ 1, 4], [ 4, 2], [ 2, 5], [ 3, 6], [ 4, 7], [ 5, 8], [ 6, 9], [ 9, 7], [ 7, 10], [10, 8], [ 8, 11]]) >>> graph.faces_at_corner array([[ 0, -1, -1], [ 2, 1, -1], [ 4, 3, -1], [ 5, 0, 1], [ 6, 2, 3], [ 7, 4, -1], [ 8, 5, -1], [10, 9, 6], [12, 11, 7], [ 8, 9, -1], [10, 11, -1], [12, -1, -1]]) >>> graph.node_at_cell array([5, 6])
- property adjacent_corners_at_corner#
Get adjacent corners.
See also
adjacent_nodes_at_node
- property adjacent_faces_at_face#
- property angle_of_face#
Get the angle of each face.
See also
angle_of_link
- property area_of_cell#
Get the area of each cell.
See also
area_of_patch
- property cells_at_corner#
Get the cells that touch each corner.
See also
patches_at_node
- property cells_at_face#
Get the cells on either side of each face.
See also
patches_at_link
- property corner_at_face_head#
Get corners at face head.
See also
node_at_link_head
- property corner_at_face_tail#
Get corners at face tail.
See also
node_at_link_tail
- property corner_x#
- property corner_y#
- property corners#
Get identifier for each corner.
See also
nodes
- property corners_at_cell#
Get the corners that define a cell.
See also
nodes_at_patch
- property corners_at_face#
Get corners at either end of faces.
See also
nodes_at_link
- property face_dirs_at_corner#
Return face directions into each corner.
See also
link_dirs_at_node
- property faces_at_cell#
Get the faces that define a cell.
See also
links_at_patch
- property faces_at_corner#
Get faces touching a corner.
See also
links_at_node
- property length_of_face#
Get the length of faces.
See also
length_of_link
- property midpoint_of_face#
Get the middle of faces.
See also
midpoint_of_link
- property number_of_cells#
Get the number of cells.
See also
number_of_patches
- property number_of_corners#
Get total number of corners.
See also
number_of_nodes
- property number_of_faces#
Get corners at face head.
See also
number_of_links
- property perimeter_corners#
Get corners on the convex hull of a Graph.
See also
perimeter_nodes
- property unit_vector_at_corner#
Get a unit vector for each corner.
See also
unit_vector_at_node
- property unit_vector_at_face#
Make arrays to store the unit vectors associated with each face.
See also
unit_vector_at_link
- property x_of_corner#
Get x-coordinate of corner.
See also
x_of_node
- property xy_of_cell#
Get the centroid of each cell.
See also
xy_of_patch
- property xy_of_corner#
Get x and y-coordinates of corner.
See also
xy_of_node
- property xy_of_face#
- property y_of_corner#
Get y-coordinate of corner.
See also
y_of_node