landlab.graph.voronoi package#

landlab.graph.voronoi.dual_voronoi module#

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])
```

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])
```

`adjacent_nodes_at_node`

property angle_of_face#

Get the angle of each face.

`angle_of_link`

property area_of_cell#

Get the area of each cell.

`area_of_patch`

property cells_at_corner#

Get the cells that touch each corner.

`patches_at_node`

property cells_at_face#

Get the cells on either side of each face.

`patches_at_link`

`node_at_link_head`

property corner_at_face_tail#

Get corners at face tail.

`node_at_link_tail`

property corner_x#
property corner_y#
property corners#

Get identifier for each corner.

`nodes`

property corners_at_cell#

Get the corners that define a cell.

`nodes_at_patch`

property corners_at_face#

Get corners at either end of faces.

`nodes_at_link`

property face_dirs_at_corner#

Return face directions into each corner.

`link_dirs_at_node`

property faces_at_cell#

Get the faces that define a cell.

`links_at_patch`

property faces_at_corner#

Get faces touching a corner.

`links_at_node`

property length_of_face#

Get the length of faces.

`length_of_link`

property midpoint_of_face#

Get the middle of faces.

`midpoint_of_link`

property number_of_cells#

Get the number of cells.

`number_of_patches`

property number_of_corners#

Get total number of corners.

`number_of_nodes`

property number_of_faces#

`number_of_links`

property perimeter_corners#

Get corners on the convex hull of a Graph.

`perimeter_nodes`

property unit_vector_at_corner#

Get a unit vector for each corner.

`unit_vector_at_node`

property unit_vector_at_face#

Make arrays to store the unit vectors associated with each face.

`unit_vector_at_link`

property x_of_corner#

Get x-coordinate of corner.

`x_of_node`

property xy_of_cell#

Get the centroid of each cell.

`xy_of_patch`

property xy_of_corner#

Get x and y-coordinates of corner.

`xy_of_node`

property xy_of_face#
property y_of_corner#

Get y-coordinate of corner.

`y_of_node`

landlab.graph.voronoi.voronoi module#

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.])
array([[0, 1], [1, 2],
[0, 3], [1, 3], [1, 4], [2, 4], [2, 5],
[3, 4], [4, 5]])
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]])
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]])
```

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.])
array([[0, 1], [1, 2],
[0, 3], [1, 3], [1, 4], [2, 4], [2, 5],
[3, 4], [4, 5]])
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]])
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#

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.])
array([[0, 1], [1, 2],
[0, 3], [1, 3], [1, 4], [2, 4], [2, 5],
[3, 4], [4, 5]])
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]])
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]])
```

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.])
array([[0, 1], [1, 2],
[0, 3], [1, 3], [1, 4], [2, 4], [2, 5],
[3, 4], [4, 5]])
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]])
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]])
```

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])
```

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])
```

`adjacent_nodes_at_node`

property angle_of_face#

Get the angle of each face.

`angle_of_link`

property area_of_cell#

Get the area of each cell.

`area_of_patch`

property cells_at_corner#

Get the cells that touch each corner.

`patches_at_node`

property cells_at_face#

Get the cells on either side of each face.

`patches_at_link`

`node_at_link_head`

property corner_at_face_tail#

Get corners at face tail.

`node_at_link_tail`

property corner_x#
property corner_y#
property corners#

Get identifier for each corner.

`nodes`

property corners_at_cell#

Get the corners that define a cell.

`nodes_at_patch`

property corners_at_face#

Get corners at either end of faces.

`nodes_at_link`

property face_dirs_at_corner#

Return face directions into each corner.

`link_dirs_at_node`

property faces_at_cell#

Get the faces that define a cell.

`links_at_patch`

property faces_at_corner#

Get faces touching a corner.

`links_at_node`

property length_of_face#

Get the length of faces.

`length_of_link`

property midpoint_of_face#

Get the middle of faces.

`midpoint_of_link`

property number_of_cells#

Get the number of cells.

`number_of_patches`

property number_of_corners#

Get total number of corners.

`number_of_nodes`

property number_of_faces#

`number_of_links`

property perimeter_corners#

Get corners on the convex hull of a Graph.

`perimeter_nodes`

property unit_vector_at_corner#

Get a unit vector for each corner.

`unit_vector_at_node`

property unit_vector_at_face#

Make arrays to store the unit vectors associated with each face.

`unit_vector_at_link`

property x_of_corner#

Get x-coordinate of corner.

`x_of_node`

property xy_of_cell#

Get the centroid of each cell.

`xy_of_patch`

property xy_of_corner#

Get x and y-coordinates of corner.

`xy_of_node`

property xy_of_face#
property y_of_corner#

Get y-coordinate of corner.

`y_of_node`