landlab.graph.radial package#

Submodules#

landlab.graph.radial.dual_radial module#

class DualRadialGraph(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Bases: DualGraph, RadialGraph

Graph of a series of points on concentric circles.

Examples

>>> from landlab.graph import DualRadialGraph
>>> graph = DualRadialGraph((1, 4), sort=True)
>>> graph.number_of_corners
4
>>> graph.y_of_corner
array([-0.5, -0.5,  0.5,  0.5])
>>> graph.x_of_corner
array([-0.5,  0.5, -0.5,  0.5])

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the center of the grid.

__init__(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the center of the grid.

property adjacent_corners_at_corner#

Get adjacent corners.

See also

adjacent_nodes_at_node

property adjacent_faces_at_face#
property angle_at_corner#
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 corners_per_ring#
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_corners_in_ring#

Number of corners in each ring.

See also

number_of_nodes_in_ring

property number_of_faces#

Get corners at face head.

See also

number_of_links

property origin#
property perimeter_corners#

Get corners on the convex hull of a Graph.

See also

perimeter_nodes

property radius_at_corner#

Distance for center corner to each corner.

See also

radius_at_node

property ring_at_corner#
property shape#
property spacing#
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_center#
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.radial.radial module#

class RadialGraph(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Bases: RadialGraphExtras, DelaunayGraph

Graph of a series of points on concentric circles.

Examples

>>> import numpy as np
>>> from landlab.graph import RadialGraph
>>> graph = RadialGraph((1, 4), sort=True)
>>> graph.number_of_nodes
5
>>> graph.y_of_node
array([-1.,  0.,  0.,  0.,  1.])
>>> graph.x_of_node
array([ 0., -1.,  0.,  1.,  0.])

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the node at the center of the grid.

__init__(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the node at the center of the grid.

property number_of_nodes_in_ring#

Number of nodes in each ring.

Returns:

  • ndarray of int – Number of nodes in each ring, excluding the center node.

  • >>> from landlab.graph import RadialGraph

  • >>> graph = RadialGraph((4, 6))

  • >>> graph.number_of_nodes_in_ring

  • array([ 6, 12, 24, 48])

  • :meta landlab: info-node, quantity

property number_of_rings#

Number of node rings in grid.

Returns:

The number of node rings in the radial grid (not counting the center node).

Return type:

int

Examples

>>> import numpy as np
>>> from landlab.graph import RadialGraph
>>> graph = RadialGraph((1, 4))
>>> graph.number_of_rings
1
property radius_at_node#

Distance for center node to each node.

Returns:

  • ndarray of float – The distance from the center node of each node.

  • >>> from landlab.graph import RadialGraph

  • >>> graph = RadialGraph((2, 6), sort=True)

  • >>> np.round(graph.radius_at_node, 3)

  • array([ 2., 2., 2., 2., 2., 1., 1., 2., 1., 0., 1., 2., 1., – 1., 2., 2., 2., 2., 2.])

  • :meta landlab: info-node, quantity

property spacing_of_rings#

Fixed distance between rings.

Returns:

  • ndarray of float – The distance from the center node of each node.

  • >>> from landlab.graph import RadialGraph

  • >>> graph = RadialGraph((2, 6), spacing=2.0)

  • >>> graph.spacing_of_rings

  • 2.0

  • :meta landlab: info-grid, quantity

property xy_of_center#
class RadialGraphExtras[source]#

Bases: object

property angle_at_node#
property angle_spacing_of_ring#
property nodes_per_ring#
property number_of_rings#
property origin#
property radius_at_node#
property radius_of_ring#
property ring_at_node#
property shape#
property spacing#
property spacing_of_rings#
class RadialGraphLayout[source]#

Bases: object

static number_of_nodes(shape)[source]#
static xy_of_node(shape, spacing=1.0, xy_of_center=(0.0, 0.0))[source]#

Create the node layout for a radial grid.

Examples

>>> import numpy as np
>>> from landlab.graph.radial.radial import RadialGraphLayout
>>> x, y = RadialGraphLayout.xy_of_node((1, 6))
>>> x
array([ 0. ,  1. ,  0.5, -0.5, -1. , -0.5,  0.5])
>>> np.round(y / np.sin(np.pi / 3.0))
array([ 0.,  0.,  1.,  1.,  0., -1., -1.])

Module contents#

class DualRadialGraph(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Bases: DualGraph, RadialGraph

Graph of a series of points on concentric circles.

Examples

>>> from landlab.graph import DualRadialGraph
>>> graph = DualRadialGraph((1, 4), sort=True)
>>> graph.number_of_corners
4
>>> graph.y_of_corner
array([-0.5, -0.5,  0.5,  0.5])
>>> graph.x_of_corner
array([-0.5,  0.5, -0.5,  0.5])

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the center of the grid.

__init__(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the center of the grid.

property adjacent_corners_at_corner#

Get adjacent corners.

See also

adjacent_nodes_at_node

property adjacent_faces_at_face#
property angle_at_corner#
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 corners_per_ring#
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_corners_in_ring#

Number of corners in each ring.

See also

number_of_nodes_in_ring

property number_of_faces#

Get corners at face head.

See also

number_of_links

property origin#
property perimeter_corners#

Get corners on the convex hull of a Graph.

See also

perimeter_nodes

property radius_at_corner#

Distance for center corner to each corner.

See also

radius_at_node

property ring_at_corner#
property shape#
property spacing#
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_center#
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

class RadialGraph(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Bases: RadialGraphExtras, DelaunayGraph

Graph of a series of points on concentric circles.

Examples

>>> import numpy as np
>>> from landlab.graph import RadialGraph
>>> graph = RadialGraph((1, 4), sort=True)
>>> graph.number_of_nodes
5
>>> graph.y_of_node
array([-1.,  0.,  0.,  0.,  1.])
>>> graph.x_of_node
array([ 0., -1.,  0.,  1.,  0.])

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the node at the center of the grid.

__init__(shape, spacing=1.0, xy_of_center=(0.0, 0.0), sort=False)[source]#

Create a structured grid of triangles arranged radially.

Parameters:
  • shape (tuple of int) – Shape of the graph as number of rings and number of points in the first ring.

  • spacing (float, optional) – Spacing between rings.

  • xy_of_center (tuple of float, optional) – Coordinates of the node at the center of the grid.

property number_of_nodes_in_ring#

Number of nodes in each ring.

Returns:

  • ndarray of int – Number of nodes in each ring, excluding the center node.

  • >>> from landlab.graph import RadialGraph

  • >>> graph = RadialGraph((4, 6))

  • >>> graph.number_of_nodes_in_ring

  • array([ 6, 12, 24, 48])

  • :meta landlab: info-node, quantity

property number_of_rings#

Number of node rings in grid.

Returns:

The number of node rings in the radial grid (not counting the center node).

Return type:

int

Examples

>>> import numpy as np
>>> from landlab.graph import RadialGraph
>>> graph = RadialGraph((1, 4))
>>> graph.number_of_rings
1
property radius_at_node#

Distance for center node to each node.

Returns:

  • ndarray of float – The distance from the center node of each node.

  • >>> from landlab.graph import RadialGraph

  • >>> graph = RadialGraph((2, 6), sort=True)

  • >>> np.round(graph.radius_at_node, 3)

  • array([ 2., 2., 2., 2., 2., 1., 1., 2., 1., 0., 1., 2., 1., – 1., 2., 2., 2., 2., 2.])

  • :meta landlab: info-node, quantity

property spacing_of_rings#

Fixed distance between rings.

Returns:

  • ndarray of float – The distance from the center node of each node.

  • >>> from landlab.graph import RadialGraph

  • >>> graph = RadialGraph((2, 6), spacing=2.0)

  • >>> graph.spacing_of_rings

  • 2.0

  • :meta landlab: info-grid, quantity

property xy_of_center#