priority_flow.data_loader
Data loading functions for PriorityFlow package.
This module provides functions to load the test data files that were converted from the R package’s TestDomain_Inputs directory.
Functions
|
Load the Digital Elevation Model (DEM) test data. |
Load the watershed mask test data. |
|
Load the river mask test data. |
|
Load all test data files at once. |
|
Get information about the available test data files. |
Module Contents
- priority_flow.data_loader.load_dem()[source]
Load the Digital Elevation Model (DEM) test data.
This is a small elevation dataset (215km by 172km at 1km spatial resolution) converted from the R package’s TestDomain_Inputs.
- Returns:
A 2D array of elevation values with shape (215, 172) representing the domain dimensions (nrow=215, ncol=172).
- Return type:
numpy.ndarray
Examples
>>> import priority_flow.data_loader as dl >>> dem = dl.load_dem() >>> print(f"DEM shape: {dem.shape}") >>> print(f"Elevation range: {dem.min():.2f} to {dem.max():.2f}")
- priority_flow.data_loader.load_watershed_mask()[source]
Load the watershed mask test data.
A mask showing the watershed drainage area for the test domain.
- Returns:
A 2D array of 0’s and 1’s showing the watershed extent (1=inside the watershed, 0=outside the watershed) with shape (215, 172).
- Return type:
numpy.ndarray
Examples
>>> import priority_flow.data_loader as dl >>> mask = dl.load_watershed_mask() >>> print(f"Watershed mask shape: {mask.shape}") >>> print(f"Watershed cells: {np.sum(mask)}")
- priority_flow.data_loader.load_river_mask()[source]
Load the river mask test data.
A mask showing an example river network for the test domain.
- Returns:
A 2D array of 0’s and 1’s showing the location of river cells (1=river, 0=non-river) with shape (215, 172).
- Return type:
numpy.ndarray
Examples
>>> import priority_flow.data_loader as dl >>> river_mask = dl.load_river_mask() >>> print(f"River mask shape: {river_mask.shape}") >>> print(f"River cells: {np.sum(river_mask)}")
- priority_flow.data_loader.load_all_test_data()[source]
Load all test data files at once.
- Returns:
A dictionary containing all test data arrays with keys: - ‘dem’: Digital Elevation Model - ‘watershed_mask’: Watershed drainage area mask - ‘river_mask’: River network mask
- Return type:
dict
Examples
>>> import priority_flow.data_loader as dl >>> data = dl.load_all_test_data() >>> print(f"Available data: {list(data.keys())}") >>> print(f"DEM shape: {data['dem'].shape}")