...
This tutorial assumes that you have a SOBEK 3 model at your disposal. If you have not, follow this tutorial first to build one.
Running a single model using only the command line
- Navigate to the directory in which you model (*.dsproj) is located. If you have no model, follow this tutorial first to build one.
Create a new .bat file in the same directory with your favorite text editor. In the bat file, enter 1 line using the following syntax: Path_To_DSConsole -p path_to_dsproj -f path_toscript. For example:
Code Block language powershell title RunModel.bat firstline 1 linenumbers true "d:\software\SOBEK (3.4.0.32140)\bin\DeltaShell.Console.exe" -s -p SingleChannel.dsproj -f RunModel.pyr "water flow 1d" >> output.txt
This script consists of the following items:
'(....)\bin\DeltaShell.Console.exe' is the path to DeltaShell's console interface. For more information on this interface, please check the 'Command Line and Scripting' chapter of the DeltaShell User Manual.
- "-s" This tells DeltaShell to not lead standard Python libraries (we don't need them, so this reduces the start-up time)
'-p *.dsproj' This tells DeltaShell to load a project
'-
f *.pyr water flow 1d' This tells DeltaShell to execute
said script. We will write the script in the next steps.a model within the loaded project
>> output.
txttxt The output of the bat script will be written to file, instead echoed to the command
promp
...
prompt
- Save the .bat script and run it by double clicking on the file. Your model should now run! The command prompt will automatically close after the model run has finished. Check 'output.txt' if the model run was succesful. If it was, it should say 'normal end of sobeksim'.
Running a single model using a Python script
Alternatively, we can use a Python script to run the model. While this does bring extra overhead, it does allow us to expand t
Related articles
Content by Label | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|