priority_flow.calc_flow
Calculate Overland Flow functions for PriorityFlow.
This module contains functions for calculating overland flow from ParFlow pressure file outputs. It supports both OverlandFlow and OverlandKinematic formulations.
Functions
|
Calculate overland flow from ParFlow pressure file outputs. |
Module Contents
- priority_flow.calc_flow.calc_flow(file_path: str, run_name: str, file_nums: List[int], slopex_file: str, slopey_file: str, overland_type: str, mannings: float | numpy.ndarray, epsilon: float = 1e-05, dx: float = 1.0, dy: float = 1.0, mask: numpy.ndarray | None = None) None[source]
Calculate overland flow from ParFlow pressure file outputs.
This function will write three pfb outputs for every timestep: (1) outflow - volumetric outflow from each grid cell [l3/t] (2) q_east - volumetric flow across the east face of each cell (Note:
this will have dimensions nx+1, ny to account for the western edge of the domain)
q_north - volumetric flow across the north face of each cell. (Note this will have dimensions nx, ny+1 to account for the southern edge of the domain)
- Parameters:
file_path (str) – Directory path where pressure and slope files are located, also where flow files will be written
run_name (str) – ParFlow run name used to read pressure files (standard naming: runname.out.press.00000.pfb)
file_nums (List[int]) – List of file numbers to be processed
slopex_file (str) – Name of the x slopes file (must be a pfb file)
slopey_file (str) – Name of the y slopes file (must be a pfb file)
overland_type (str) – Type of overland flow used for ParFlow simulation. Choices: “OverlandFlow” or “OverlandKinematic”
mannings (Union[float, np.ndarray]) – Manning roughness coefficient, can be either a value or a matrix
epsilon (float, optional) – Epsilon used only in OverlandKinematic formulation. Set with Solver.OverlandKinematic.Epsilon key in ParFlow. Defaults to 1e-5.
dx (float, optional) – Grid size in x direction [l]. Defaults to 1.0.
dy (float, optional) – Grid size in y direction [l]. Defaults to 1.0.
mask (np.ndarray, optional) – Mask with ones for cells to be processed and zeros for everything else. Defaults to mask of all 1’s. Should be [nx, ny] matrix where [0,0] is lower left corner.
Notes
This is a Python port of the R function CalcFlow from PriorityFlow. The function calculates overland flow using either OverlandFlow or OverlandKinematic formulations.
File naming convention expected: - Pressure files: {run_name}.out.press.{file_num:05d}.pfb - Output files: {run_name}.out.{outflow/q_east/q_north}.{file_num:05d}.pfb