priority_flow.get_border

Get Border functions for PriorityFlow.

This module provides functions to identify border cells by reading in a mask and returning a mask of the border cells for irregular boundaries.

Functions

get_border(→ numpy.ndarray)

Identify border cells.

Module Contents

priority_flow.get_border.get_border(mask_mat: numpy.ndarray) numpy.ndarray[source]

Identify border cells.

Function that reads in a mask and returns a mask of the border cells for the irregular boundary. Border cells are identified as cells that have fewer than 4 valid neighbors within the domain.

Parameters:

mask_mat (np.ndarray) – Matrix mask with values of 0 for cells outside the domain and 1 for cells inside the domain

Returns:

Matrix mask where 1 indicates border cells and 0 indicates non-border cells

Return type:

np.ndarray

Notes

This function implements a border detection algorithm that: 1. Identifies cells at the domain boundary 2. Counts valid neighbors for each cell 3. Classifies cells with fewer than 4 neighbors as border cells 4. Handles irregular domain boundaries

The algorithm uses D4 connectivity (4-directional) to identify border cells: - Cells with 4 valid neighbors are interior cells (not borders) - Cells with fewer than 4 valid neighbors are border cells - Only cells within the domain mask are considered

Border cells are typically: - Domain edge cells - Cells adjacent to masked areas - Cells in irregular boundary regions - Cells with incomplete neighbor connectivity