Bank Erosion Debugger#
The Bank Erosion Debugger module provides utilities for debugging and outputting bank erosion calculations in the D-FAST Bank Erosion software.
Overview#
The Bank Erosion Debugger module contains a class and utility functions for writing debug information about bank erosion calculations to shapefiles and CSV files. This information can be used to analyze and troubleshoot bank erosion calculations.
Components#
The Bank Erosion Debugger module consists of the following components:
Debugger Class#
dfastbe.bank_erosion.debugger
#
Bank Erosion Debugger.
Debugger
#
Class to handle debugging and output of bank erosion calculations.
Source code in src/dfastbe/bank_erosion/debugger.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
__init__(crs: str, output_dir: str)
#
Debugger constructor.
Source code in src/dfastbe/bank_erosion/debugger.py
23 24 25 26 |
|
last_discharge_level(bank_index: int, single_bank: SingleBank, fairway_data: FairwayData, erosion_inputs: SingleErosion, single_parameters: SingleParameters, single_calculation: SingleCalculation)
#
Write the last discharge level to a shapefile and CSV file.
Source code in src/dfastbe/bank_erosion/debugger.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
middle_levels(bank_ind: int, q_level: int, single_bank: SingleBank, fairway_data: FairwayData, erosion_inputs: SingleErosion, single_parameters: SingleParameters, single_calculation: SingleCalculation)
#
Write the middle levels to a shapefile and CSV file.
Source code in src/dfastbe/bank_erosion/debugger.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
The Debugger class provides methods for writing debug information about bank erosion calculations, such as:
- last_discharge_level: Writes debug information about the last discharge level to a shapefile and CSV file
- middle_levels: Writes debug information about the middle discharge levels to a shapefile and CSV file
- _write_data: Writes data to a shapefile and CSV file
Utility Functions#
The Bank Erosion Debugger module includes utility functions for writing data to files:
- _write_shp: Writes data to a shapefile
- _write_csv: Writes data to a CSV file
Usage Example#
from dfastbe.bank_erosion.debugger import Debugger
from dfastbe.io.config import ConfigFile
from dfastbe.bank_erosion.bank_erosion import Erosion
# Load configuration file
config_file = ConfigFile.read("config.cfg")
# Initialize Erosion object
erosion = Erosion(config_file)
# Access debugger
debugger = erosion.debugger
# Write debug information for the last discharge level
debugger.last_discharge_level(
bank_index=0,
single_bank=bank_data.left,
fairway_data=fairway_data,
erosion_inputs=erosion_inputs.left,
single_parameters=level_parameters.left,
single_calculation=single_calculation,
bank_height=bank_height
)
For more details on the specific classes and functions, refer to the API reference below.