Import / Export execution from command lines¶
When setting up numerical models, you often utilize the MIKE+ editor to access all the tools to define the model data, including the 'Import and export' tool. However, there are times when it is required to import or export files in an automated way without going through the related editors.
The MIKE+ executables enable you to execute some tools without opening the editor, through command lines.
Executing the Import / Export tool¶
It is possible to run the 'Import and export' tool in this manner, assuming you have prepared the Import/Export configuration file beforehand in MIKE+.
Start by locating the MIKE+ executable named DHI.MIKEPlus.ToolShell.exe in the installation folder. From a command prompt, type the command below to access the list of supported tools, replacing the … characters by the actual path to the file:
The format of the command for executing an Import/Export configuration is:
Where [Configuration file] is the path to the *.xml configuration file.
Two options are available:
- -s. This option prevents the tool's validation and error messages from being saved to a .log file. If this option is not used, all messages are saved by default to a new log file each time the tool is run from this command line (the path to this file is shown in the command window after the tool has run).
- -p [Path to Oracle.DataAccess.dll]. This option is mandatory when the source database is an Oracle Spatial database, and must supply the path to the file Oracle.DataAccess.dll which must be installed on the machine prior to the import.
Note
The selected *.xml configuration file must contain the path to the MIKE+ database to import to / from. This configuration file must be saved from the MIKE+ interface, and when the import job imports to the currently opened MIKE+ database, the configuration file is saved with an empty path and file name (this is designed to make the configuration file applicable to any database in which is it loaded). So, before using such a configuration file from a command line, it is necessary to update it and provide the path to the MIKE+ database (typically *.sqlite file). This is a path relative to the location of the configuration file, for example if the *.sqlite file is located in the same folder as the configuration file, the path should look like this: \<JobPropertyValue property=”Target” value=".\DatabaseName.sqlite" jobNodeType=”Jobproperty" />
Executing a predefined export or simulation¶
This requires that you have prepared the simulation setups beforehand in MIKE+.
Start by locating the MIKE+ executable named DHI.MIKEPlus.EngineShell.exe in the installation folder. From a command prompt, type the command below to access the description of available options, replacing the … characters by the actual path to the file:
The format of the commands for exporting simulation files or running simulations is:
where [File] is the path to the *.mupp or *.sqlite file.
The main options are described below:
- -e: Export simulation files (e.g. *.couple and *.m21fm files for a simulation including 2D overland)
- -r: Run the simulation
- -rb: Run the batch simulation
- -id: The simulation ID to be exported or executed (optional). If not specified, the active simulation is used.
Note
Simulations are executed with the parallelisation settings specified in the project, from the 'Parallelisation configuration' dialog.