API for landlab.grid.framed_voronoi#
Python implementation of FramedVoronoiGrid
, a grid class used to create and
manage unstructured Voronoi-Delaunay grids for 2D numerical models, with a structured
perimeter layout
Do NOT add new documentation here. Grid documentation is now built in a semi- automated fashion. To modify the text seen on the web, edit the files docs/text_for_[gridfile].py.txt.
Code author: sebastien lenard
- class FramedVoronoiGrid(shape, xy_spacing=(1.0, 1.0), xy_of_lower_left=(0.0, 0.0), xy_min_spacing=(0.5, 0.5), seed=200, xy_of_reference=(0.0, 0.0), xy_axis_name=('x', 'y'), xy_axis_units='-')[source]#
Bases:
DualFramedVoronoiGraph
,ModelGrid
A grid of Voronoi Delaunay cells with a structured perimeter layout.
This inherited class implements a irregular 2D grid with Voronoi Delaunay cells and irregular patches. It is a special type of
VoronoiDelaunayGrid
grid in which the initial set of points is arranged in a fixed lattice (e.g. like aRasterModelGrid
), named here “layout”, and the core points are then moved a random distance from their initial positions, bounded by a user-supplied threshold.Examples
Create a grid with 3 rows and 2 columns of nodes.
>>> from landlab import FramedVoronoiGrid >>> grid = FramedVoronoiGrid((3, 2), xy_spacing=1.0) >>> grid.number_of_nodes 6
>>> grid = FramedVoronoiGrid( ... (4, 3), xy_spacing=(10., 10.), xy_min_spacing=(5., 5.), seed=200 ... ) >>> grid.status_at_node array([1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1], dtype=uint8) >>> grid.x_of_node[3] 0.0 >>> grid.x_of_node[5] 20.0 >>> grid.y_of_node[0::3] array([ 0. , 7.499, 17.499, 30. ])
>>> grid = FramedVoronoiGrid((3, 5), xy_spacing=(10., 10.), xy_min_spacing=5., seed=None) >>> grid.boundary_nodes array([ 0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14])
Create a grid of voronoi cells with a structured perimeter.
Create an irregular 2D grid with voronoi cells and triangular patches. It is a special type of
VoronoiDelaunayGrid
in which the initial set of points is arranged in a regular lattice determined by the parameters shape, and xy_spacing. The coordinates of the core points are then randomly moved while the perimeter points remaining fixed, in a way determined by the parameters xy_min_spacing, and seed.- Parameters:
xy_spacing (float or tuple of float, optional) – Node spacing along x and y coordinates. If
float
, same spacing at x and y.xy_of_lower_left (tuple, optional) – Minimum x-of-node and y-of-node values. Depending on the grid, there may not be a node at this coordinate.
xy_min_spacing (float or tuple of float, optional) – Final minimal spacing between nodes. Random moves of the core nodes from their initial positions cannot be above this threshold:
(xy_spacing - xy_min_spacing) / 2
Iffloat
, same minimal spacing for x and y.seed (int, optional) – Seed used to generate the random x and y moves. When set, controls the pseudo-randomness of moves to ensure reproducibility. When
None
, the seed is random and the moves of coordinates are completely random.xy_of_reference (tuple, optional) – Coordinate value in projected space of the reference point, xy_of_lower_left.
xy_axis_units (str, optional) – x and y axis units.
- Returns:
A newly-created grid.
- Return type:
Examples
Create a grid with 3 rows and 2 columns of nodes.
>>> from landlab import FramedVoronoiGrid >>> grid = FramedVoronoiGrid((3, 2), xy_spacing=1.0) >>> grid.number_of_nodes 6
- __init__(shape, xy_spacing=(1.0, 1.0), xy_of_lower_left=(0.0, 0.0), xy_min_spacing=(0.5, 0.5), seed=200, xy_of_reference=(0.0, 0.0), xy_axis_name=('x', 'y'), xy_axis_units='-')[source]#
Create a grid of voronoi cells with a structured perimeter.
Create an irregular 2D grid with voronoi cells and triangular patches. It is a special type of
VoronoiDelaunayGrid
in which the initial set of points is arranged in a regular lattice determined by the parameters shape, and xy_spacing. The coordinates of the core points are then randomly moved while the perimeter points remaining fixed, in a way determined by the parameters xy_min_spacing, and seed.- Parameters:
xy_spacing (float or tuple of float, optional) – Node spacing along x and y coordinates. If
float
, same spacing at x and y.xy_of_lower_left (tuple, optional) – Minimum x-of-node and y-of-node values. Depending on the grid, there may not be a node at this coordinate.
xy_min_spacing (float or tuple of float, optional) – Final minimal spacing between nodes. Random moves of the core nodes from their initial positions cannot be above this threshold:
(xy_spacing - xy_min_spacing) / 2
Iffloat
, same minimal spacing for x and y.seed (int, optional) – Seed used to generate the random x and y moves. When set, controls the pseudo-randomness of moves to ensure reproducibility. When
None
, the seed is random and the moves of coordinates are completely random.xy_of_reference (tuple, optional) – Coordinate value in projected space of the reference point, xy_of_lower_left.
xy_axis_units (str, optional) – x and y axis units.
- Returns:
A newly-created grid.
- Return type:
Examples
Create a grid with 3 rows and 2 columns of nodes.
>>> from landlab import FramedVoronoiGrid >>> grid = FramedVoronoiGrid((3, 2), xy_spacing=1.0) >>> grid.number_of_nodes 6
- property active_adjacent_corners_at_corner#
Adjacent corners for each grid corner.
See also
active_adjacent_nodes_at_node
- property active_face_dirs_at_corner#
Return face directions into each corner.
See also
active_link_dirs_at_node
- property all_corner_azimuths_map#
Get azimuths from every corner to every other corner.
See also
all_node_azimuths_map
- property all_corner_distances_map#
Get distances from every corner to every other corner.
See also
all_node_distances_map
- property angle_of_face_about_head#
Find and return the angle of a face about the corner at the face head.
See also
angle_of_link_about_head
- property boundary_corners#
Get array of boundary corners.
See also
boundary_nodes
- property cells_present_at_corner#
A boolean array, False where a cell has a closed corner or is
See also
patches_present_at_node
- property cells_present_at_face#
A boolean array, False where a cell has a closed corner or is
See also
patches_present_at_link
- property closed_boundary_corners#
Get array of closed boundary corners.
See also
closed_boundary_nodes
- property core_corners#
Get array of core corners.
See also
core_nodes
- property core_patches#
Get array of core patches.
See also
core_cells
- property corner_at_core_patch#
Get array of corners associated with core patches.
See also
node_at_core_cell
- property face_status_at_corner#
- property fixed_faces#
Get array of fixed faces.
See also
fixed_links
- property fixed_gradient_boundary_corner_anchor_corner#
Returns the corner at the other end of the fixed face for a fixed
See also
fixed_gradient_boundary_node_anchor_node
- property fixed_gradient_boundary_corner_fixed_face#
An array of the fixed_faces connected to fixed gradient boundary
See also
fixed_gradient_boundary_node_fixed_link
- property fixed_gradient_boundary_corners#
Get array of fixed gradient boundary corners.
See also
fixed_gradient_boundary_nodes
- property fixed_value_boundary_corners#
Get array of fixed value boundary corners.
See also
fixed_value_boundary_nodes
- classmethod from_dict(kwds)[source]#
Create grid from dictionary.
- Parameters:
params (dictionary) – Dictionary of required parameters to create a model grid.
Examples
>>> from landlab import RasterModelGrid >>> params = {"shape": (3,4), "xy_spacing": 2} >>> grid = RasterModelGrid.from_dict(params) >>> grid.x_of_node array([ 0., 2., 4., 6., 0., 2., 4., 6., 0., 2., 4., 6.]) >>> grid.y_of_node array([ 0., 0., 0., 0., 2., 2., 2., 2., 4., 4., 4., 4.])
- property number_of_cells_present_at_corner#
Return the number of cells at a corner without a closed corner.
See also
number_of_patches_present_at_node
- property number_of_cells_present_at_face#
Return the number of cells at a face without a closed corner.
See also
number_of_patches_present_at_link
- property number_of_core_corners#
Number of core corners.
See also
number_of_core_nodes
- property number_of_core_patches#
Number of core patches.
See also
number_of_core_cells
- property number_of_fixed_faces#
Number of fixed faces.
See also
number_of_fixed_links
- property open_boundary_corners#
Get array of open boundary corners.
See also
open_boundary_nodes
- property patch_area_at_corner#
Cell areas in a ncorners-long array.
See also
cell_area_at_node
- property status_at_corner#
Get array of the boundary status for each corner.
See also
status_at_node
- property status_at_face#
Get array of the status of all faces.
See also
status_at_link
- property unit_vector_sum_xcomponent_at_corner#
Get array of x-component of unit vector sums at each corner.
See also
unit_vector_sum_xcomponent_at_node
- property unit_vector_sum_ycomponent_at_corner#
Get array of y-component of unit vector sums at each corner.
See also
unit_vector_sum_ycomponent_at_node