Versions Compared

Key

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

...

The Metaparameter explorer (Metaparameter Explorer) can be used to attach global expressions directly to model variables for situations where the expression editor Function Editor has not been enabled by default.

...

By default, all recorded items are returned, as configured from within the Source application (Running scenarios). Alternatively, you can specify specific items to record by using a command line argument:

...

Several global expressions can be set using the -v argument:

  • Set the values: 

    Code Block
    RiverSystem.CommandLine -m Client -v "$metaParam=2.5" 
  • Set multiple expressions:

...

The next example runs the project from start to finish and puts all recorded values in the file ‘test.csv’. 

Code Block
>RiverSystem.CommandLine.exe -p "C:\ProjectDir\test.rsproj" -o test.csv
Loading 100%
Meta-Parameters:
+ $inflow
-r "Forest\Catchment for node #2\Quick Flow\Flow"
+ Straight-Through Routing\Default Link #1\Upstream Flow Volume
+ Straight-Through Routing\Default Link #1\Downstream Flow Volume
+ Straight-Through Routing\Default Link #1\Mass Balance
+ Inflow\Inflow 1\Upstream Flow Volume
+ Inflow\Inflow 1\Downstream Flow Volume
+ Inflow\Inflow 1\Inflow Volume
+ Inflow\Inflow 1\Mass Balance
+ Gauge\Gauge 2\Upstream Flow Volume
+ Gauge\Gauge 2\Mass Balance
+ Global Expressions\$inflow\Value
Running 100%

...


The service is ready at net.tcp://localhost:8523/eWater/Services/RiverSystemService.

Additional examples of running Source using a DOS batch file, a Python script or an R script can be found here.

Advanced configuration options

...

Notice in the examples that the command line contains various options, which result in different outputs. The function of these options is provided in Table 1. Note that these are optional extras.

...

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

 

Display option commands

Function

Example

-p, --project

Path to project, or project name on server followed by these optional parameters: scenario within that project, start and end times, name of data input set

-p "projectName.rsproj" or -p "c:\somePath\projectName.rsproj;someScenarioName;1/1/2011;31/12/2011;dry"

-m, --mode

Application mode Client/Server/InProcess.

-m Client or -m Server

-d, --directory

Directory in which to look for projects.

-d "c:\ProjectFiles"

-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 specifed 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.

-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"

-v, --value

Set value of meta-parameter or internal setting.

-v "$metaparam=25", or -v "$anotherMetaParam=2.3"

-s, --step

Number of time-steps to run.

--step 1

-t, --reset

Reset the loaded project.

 

-e, --timeout

Operation timeout for WCF service in seconds.

-e 2000

-b, -baseSIUnits

Ignore units set within project and output base SI units

 

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:

  • Starting with a Source Catchment project file, use the new calibration tool to set up ‘global expressions’ for the parameters of the rainfall runoff models. When defining the metaparameters in the Calibration Wizard (Figure 168), the list of Existing Metaparameters will be used in the parameter file for invoking riversystem.commandline;
  • 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;
  • Save the project;
  • Set up the Riversystem.Commandline input file;
  • Setup the PEST input and template files;
  • Prepare a batch file to invoke the commandline and pre-processors; and
  • Run PEST.

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

Batch running using the command line

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

Please see /wiki/spaces/SD50/pages/50137610 in the Source community for details and an example.