priority_flow.find_orphan
Find Orphan functions for PriorityFlow.
This module provides functions to find orphan branches - unprocessed river cells that have D8 neighbors on the river network or on the boundary. This is useful for identifying missed cells during river network processing.
Functions
|
Find orphan branches in river network processing. |
Module Contents
- priority_flow.find_orphan.find_orphan(dem: numpy.ndarray, mask: numpy.ndarray, marked: numpy.ndarray) Dict[str, int | numpy.ndarray | None][source]
Find orphan branches in river network processing.
Function to look for unprocessed river cells that have D8 neighbors on the river network or on the boundary.
- Parameters:
dem (np.ndarray) – Digital elevation model matrix
mask (np.ndarray) – River network mask (1 for river cells, 0 for non-river cells)
marked (np.ndarray) – Matrix of grid cells that have been processed (1 for processed, 0 for unprocessed)
- Returns:
A dictionary containing: - ‘norphan’: Number of orphaned branches found - ‘queue’: Queue of marked neighbors to be processed (numpy array with columns: x, y, elevation)
- Return type:
Dict[str, Union[int, np.ndarray, None]]
Notes
This function implements an orphan detection algorithm that: 1. Identifies unprocessed river cells (masked but not marked) 2. Checks D8 connectivity to find marked neighbors 3. Counts marked neighbors for each orphan cell 4. Creates a processing queue from marked neighbors of orphan cells
The algorithm uses D8 connectivity (8-directional) to ensure complete neighbor checking and proper orphan identification.