fastscapelib.FlowGraphImpl

class fastscapelib.FlowGraphImpl

Flow graph fixed-shape array implementation.

This class has no initializer. Instead, use the FlowGraph.impl() method to access an implementation instance from a flow graph instance.

This class exposes low-level arrays of fixed-shape used to represent the flow graph. In general, FlowGraph API should be used instead when possible.

IMPORTANT NOTES:

This class is not considered as part of Fastscapelib’s public API!

The (read-only) properties of this class return the original arrays (no copy). Directly changing value items may invalidate the flow graph.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

Attributes

basins

Returns an array with the id of the basin (catchment) to which each node belongs.

bfs_indices

Returns the node indices ordered topologically from base level nodes up to top nodes.

bfs_levels

Returns a 1-D array of graph node index intervals (left-closed, right-open) representing breadth-first search levels.

dfs_indices

Deprecated alias of FlowGraphImpl.nodes_indices_bottomup.

donors

Returns the array of flow donor grid node (flat) indices.

donors_count

Returns the total number of donors for each node (1-dimensional array).

nodes_indices_bottomup

Returns the node indices ordered topologically from base level nodes up to top nodes.

receivers

Returns the array of flow receiver grid node (flat) indices.

receivers_count

Returns the total number of receivers for each node (1-dimensional array).

receivers_distance

Returns the array of distances from a node to each of its receivers.

receivers_weight

Returns the array of flow partition weights from a node to each of its receivers.

single_flow

Returns True if the graph has single flow directions (flow tree).

property basins

Returns an array with the id of the basin (catchment) to which each node belongs.

Array values are valid only for a single-flow graph!

property bfs_indices

Returns the node indices ordered topologically from base level nodes up to top nodes.

The order results from graph traversal using breadth-first search.

property bfs_levels

Returns a 1-D array of graph node index intervals (left-closed, right-open) representing breadth-first search levels.

property dfs_indices

Deprecated alias of FlowGraphImpl.nodes_indices_bottomup.

property donors

Returns the array of flow donor grid node (flat) indices.

The array has the shape (size, n_neighbors_max).

Note: values returned by donors[i, j] where j >= donors_count[i] are meaningless.

property donors_count

Returns the total number of donors for each node (1-dimensional array).

property nodes_indices_bottomup

Returns the node indices ordered topologically from base level nodes up to top nodes.

The order results from graph traversal using depth-first search.

property receivers

Returns the array of flow receiver grid node (flat) indices.

The shape of the array is either (size, 1) for single flow graphs or (size, n_neighbors_max) for multiple flow graphs.

For base-level or pit nodes: flow receiver index = node index.

Note: values returned by receivers[i, j] where j >= receivers_count[i] are meaningless.

property receivers_count

Returns the total number of receivers for each node (1-dimensional array).

property receivers_distance

Returns the array of distances from a node to each of its receivers.

The shape of the array is either (size, 1) for single flow graphs or (size, n_neighbors_max) for multiple flow graphs.

Note: values returned by receivers_distance[i, j] where j >= receivers_count[i] are meaningless.

property receivers_weight

Returns the array of flow partition weights from a node to each of its receivers.

The shape of the array is either (size, 1) for single flow graphs or (size, n_neighbors_max) for multiple flow graphs.

Note: values returned by receivers_weight[i, j] where j >= receivers_count[i] are meaningless.

property single_flow

Returns True if the graph has single flow directions (flow tree).