landlab.grid.unstructured.nodes

class NodeGrid[source]

Bases: object

__init__((coord0, coord1)) Create a grid of nodes.

Parameters:
  • coord0 (sequence of array-like) – Coordinates of grid nodes

  • coord1 (sequence of array-like) – Coordinates of grid nodes

Returns:

A newly-created NodeGrid

Return type:

NodeGrid

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1, 1], [0, 1, 0, 1]))
>>> ngrid.ndim == 2
True
>>> ngrid.number_of_nodes == 4
True
>>> ngrid.x
array([0.,  1.,  0.,  1.])
>>> ngrid.y
array([0.,  0.,  1.,  1.])

Create a 1D grid.

>>> ngrid = NodeGrid(((0, 1, 3),))
>>> ngrid.ndim == 1
True
>>> ngrid.number_of_nodes
3
>>> ngrid.x
array([0.,  1.,  3.])
>>> ngrid.y
Traceback (most recent call last):
AttributeError: Grid has no y-coordinate

__init__((coord0, coord1)) Create a grid of nodes.

Parameters:
  • coord0 (sequence of array-like) – Coordinates of grid nodes

  • coord1 (sequence of array-like) – Coordinates of grid nodes

Returns:

A newly-created NodeGrid

Return type:

NodeGrid

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1, 1], [0, 1, 0, 1]))
>>> ngrid.ndim == 2
True
>>> ngrid.number_of_nodes == 4
True
>>> ngrid.x
array([0.,  1.,  0.,  1.])
>>> ngrid.y
array([0.,  0.,  1.,  1.])

Create a 1D grid.

>>> ngrid = NodeGrid(((0, 1, 3),))
>>> ngrid.ndim == 1
True
>>> ngrid.number_of_nodes
3
>>> ngrid.x
array([0.,  1.,  3.])
>>> ngrid.y
Traceback (most recent call last):
AttributeError: Grid has no y-coordinate
__init__(nodes)[source]

__init__((coord0, coord1)) Create a grid of nodes.

Parameters:
  • coord0 (sequence of array-like) – Coordinates of grid nodes

  • coord1 (sequence of array-like) – Coordinates of grid nodes

Returns:

A newly-created NodeGrid

Return type:

NodeGrid

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1, 1], [0, 1, 0, 1]))
>>> ngrid.ndim == 2
True
>>> ngrid.number_of_nodes == 4
True
>>> ngrid.x
array([0.,  1.,  0.,  1.])
>>> ngrid.y
array([0.,  0.,  1.,  1.])

Create a 1D grid.

>>> ngrid = NodeGrid(((0, 1, 3),))
>>> ngrid.ndim == 1
True
>>> ngrid.number_of_nodes
3
>>> ngrid.x
array([0.,  1.,  3.])
>>> ngrid.y
Traceback (most recent call last):
AttributeError: Grid has no y-coordinate
__new__(**kwargs)
property coord

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.coord[0]
array([0.,  0.,  1.])
>>> ngrid.coord[1]
array([0.,  1.,  0.])
property ndim
property number_of_nodes

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.number_of_nodes
3
property point

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.point
array([[0.,  0.],
       [0.,  1.],
       [1.,  0.]])
>>> ngrid.point[1]
array([0.,  1.])
property x

Node coordinates of the “fast” dimension.

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.x
array([0.,  1.,  0.])
property y

Node y-coordinates.

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.y
array([0.,  0.,  1.])
property z

Node z-coordinates.

Examples

>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.y
array([0.,  0.,  1.])