Command Module#
The Command module serves as the main entry point for the D-FAST Bank Erosion software, handling command-line arguments and orchestrating the execution of the different operational modes.
Overview#
The Command module provides the interface between the user (via command-line or GUI) and the core functionality of the D-FAST Bank Erosion software. It parses command-line arguments, initializes the appropriate language settings, and launches the requested operational mode (BANKLINES, BANKEROSION, or GUI).
Components#
The Command module consists of the following components:
Run Function#
dfastbe.cmd
#
Copyright (C) 2020 Stichting Deltares.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 2.1.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, see http://www.gnu.org/licenses/.
contact: delft3d.support@deltares.nl Stichting Deltares P.O. Box 177 2600 MH Delft, The Netherlands
All indications and logos of, and references to, "Delft3D" and "Deltares" are registered trademarks of Stichting Deltares, and remain the property of Stichting Deltares. All rights reserved.
INFORMATION This file is part of D-FAST Bank Erosion: https://github.com/Deltares/D-FAST_Bank_Erosion
run(language: str = 'UK', run_mode: str = 'GUI', configfile: str = 'dfastbe.cfg') -> None
#
Initializes the language file and starts the chosen run mode.
This function loads the appropriate language file and executes one of the
available modes: 'BANKLINES', 'BANKEROSION', or 'GUI'. The default configuration
file is dfastbe.cfg
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
language
|
str
|
Display language code. Acceptable values are 'NL' (Dutch) or 'UK' (English). Defaults to 'UK'. |
'UK'
|
run_mode
|
str
|
Mode in which the program should run. Available options:
Defaults to 'GUI'. |
'GUI'
|
configfile
|
str
|
Path to the configuration file. Defaults to 'dfastbe.cfg'. |
'dfastbe.cfg'
|
Raises:
Type | Description |
---|---|
Exception
|
If an invalid |
Example
Running the program with Dutch language and bank erosion mode:
run(language="NL", run_mode="BANKEROSION", configfile="custom_config.cfg")
Running the program in default mode (GUI) with the English language:
run()
Source code in src/dfastbe/cmd.py
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 |
|
The run
function is the main entry point for the D-FAST Bank Erosion software. It initializes the language settings and launches the requested operational mode.
Operational Modes#
The D-FAST Bank Erosion software supports three operational modes:
- BANKLINES: Detects bank lines from hydrodynamic simulation results
- BANKEROSION: Calculates bank erosion based on detected bank lines and hydrodynamic data
- GUI: Provides a graphical user interface for configuring and running the above processes
Workflow#
The typical workflow for using the Command module is:
- Call the
run
function with the desired language, run mode, and configuration file - The
run
function initializes the language settings - Depending on the run mode, the
run
function: - Launches the GUI
- Runs bank line detection
- Runs bank erosion calculation
Usage Example#
from dfastbe.cmd import run
# Run in GUI mode with English language
run(language="UK", run_mode="GUI", configfile="config.cfg")
# Run bank line detection with Dutch language
run(language="NL", run_mode="BANKLINES", configfile="config.cfg")
# Run bank erosion calculation with English language
run(language="UK", run_mode="BANKEROSION", configfile="config.cfg")
For more details on the specific functions, refer to the API reference below.