Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The RiverSystem.CommandLine.exe provides a mechanism to run existing projects without the Source interface. It is possible to modify or change the behaviour of the project from the command line, by changing the values of global expressions. Results can be returned for recorded items or global expressions within the project.

RiverSystem.CommandLine.exe is included with Source.

...

In client/server mode, results are always computed on the server, but returned through the client. By default, results are displayed on the console (in both standalone and client modes), but it is possible to save the results directly to a file using the following command (file name is resultsfilename.res.csv.):

Code Block
RiverSystem.CommandLine.exe -m Client -o resultsfilename.res.csv

Modifying parameters

To modify parameters in the model, they need to be set up as functions. This can be done in one of three ways:

...

Anchor
CommandLineOptions
CommandLineOptions
Table 1. Command Line Runner (options)
 


Display option commands

Function

Example

-a, --address
Address for server to create, or client to connect.
-a "net.pipe://localhost/PipeReverse" or "net.tcp://localhost:8523/eWater/Services/RiverSystemService"
-b, --baseSIUnits
Ignore units set within project and output base SI units
--baseSIUnits
-c, --recording
File to load state from when in client mode or file to save state in when in server mode.
-c "c:\StateFiles\state.txt"
-d, --directory
Directory in which to look for projects.
-d "c:\ProjectFiles"
-e, --timeout
Operation timeout for WCF service in seconds.
-e 2000
-f, --settingFile
File to merge command-line settings from.
-f "settings.txt"
-l, --loadPlugin
This option allows a plugin (that the project has been saved with) to be loaded for this run only. The path specified is a relative path to the plugin from the command line. eg. "Plugins\ExampleRainfallRunoffModel.dll"
-l "plugin.dll"
-m, --mode
Application mode Client/Server/InProcess.
-m Client or -m Server
-o, --output
File to save output into. The extension selects the output format based on the standard TIME I/O formats. A directory of the name specified will be created if the format only supports a single time series.
-o "output.res.csv" for CSV or -o "output.nc" for NetCDF etc.
-p, --project

Path to the project, or project name on server and optional scenario within that project, DateTime values to override the default start and end times of the loaded scenario and data source input set to run.

-p "projectName.rsproj", or to specify the scenario within the project
-p "c:\somePath\projectName.rsproj;someScenarioName", or to set the run period
-p "c:\somePath\projectName.rsproj;;1/1/2011;31/12/2011", or to specify a Scenario Input Set
-p "c:\somePath\projectName.rsproj;;;;ScenarioInputSetName" or when using child input sets
-p "c:\somePath\projectName.rsproj;;;;ScenarioInputSetName\ChildInputSetName" 
-r, --results

Which results to return. This can appear multiple times.

Info
iconfalse
Note: By default, all recorded results are saved into the specified output file. When this options is used, it only allows you to reduce the number of results saved out. Requested results must be set to record in the project file. To specify the output file name, save the result to a file with a .res.csv extension. Use the column name for the time series.
-r "someResult" -r "someOtherResult"
-s, --step
Number of time-steps to run.
--step 1
-t, --reset
Reset the loaded project.
--reset
-u, --current
Return only the current time step's value for the specified results
--current
-v, --value

Set the value of a Function (also called meta-parameter for calibration)

-v "$metaparam=25", or -v "$anotherMetaParam=2.3"
-y, --saveAs
Save the loaded project after the run is complete to the specified path and file. The string argument cannot be empty, and the path provided must be an existing directory and have saving permissions for the current user.
-y "C:\ProjectFiles\newProject.rsproj"

PEST calibration using the command line

PEST (Parameter ESTimation and uncertainty analysis) allows analysis of complex environmental models, and can be used in Source for calibration of catchments. You can use the command line to do calibration and uncertainty in a catchments model. The steps to do the calibration are as follows:

  1. Starting with a Source Catchment project file, use the Calibration Wizard to set up ‘global expressions’ for the parameters of the rainfall runoff models.
    When defining the metaparameters in the Calibration Wizard, the list of Existing Metaparameters will be used in the parameter file for invoking RiverSystem.CommandLine;
  2. Turn on any recorders for the hydrological quantities that will be used in the objective function. In step 4 of the Calibration Wizard, choose Manual optimisation and enable Create global expressions for use from an external tool;
  3. Save the project;
  4. Set up the RiverSystem.CommandLine input file;
  5. Setup the PEST input and template files;
  6. Prepare a batch file to invoke the commandline and pre-processors; and
  7. Run PEST.

Once the Calibration wizard has been set up, start the command line server (RiverSystem.CommandLine.exe -p projectname.rsproj -m server) and then PEST (pest pestcontrolfile.pst).

Batch running using the command line

Insert excerpt
SC:Batch running using the command line
SC:Batch running using the command line
nopaneltrue

Refer to this page in the Source community for details and an example.