hydromod: Definition and execution of the model to be optimised using...

View source: R/hydromod.R

hydromodR Documentation

Definition and execution of the model to be optimised using an executable file that runs out of R (system console or external script)

Description

It runs a user-defined model to be optimised and returns the output variables of the model requested by the user according to the number of functions indicated in the list out.FUNs. This specific function was designed to run an executable file from the system console

Usage

hydromod(param.values,
         param.files="ParamFiles.txt",
         model.drty=getwd(),
         exe.fname,
         exe.args = character(),
         stdout=FALSE,
         stderr="",
         verbose= FALSE,
         out.FUNs,
         out.FUNs.args
)

Arguments

param.values

(numeric)
A numeric vector with the parameter set used to run the model specified in exe.fname.

param.files

(character)
character, file name (full path) storing location and names of the files that have to be modified for each parameter.
By default param.files="ParamFiles.txt"

model.drty

(character)
Path to the executable file of the model specified in exe.fname. ALL the files required to run the model have to be located within this directory (input files for the model may be located in a different directory, if properly referenced).

exe.fname

(character)
Model command line arguments to be entered through a prompted string to execute the user-defined model.

exe.args

(character)
Optional arguments to be passed in the command line to the user-defined model.

stdout

(logical or character)
Where output to ‘stdout’ should be sent. Possible values are FALSE (discard output, the default), "", to the R console. See system2
By default stdout=FALSE and any message printed by the model code to the screen will be omitted. This setting is recommended when calibrating the model with hydroMOPSO. However, when trying to run the model code with hydromod by the first time, it is recommend to set stdout="", in order to detect if the model was properly executed or not.

stderr

(logical or character)
Where output to ‘stderr’ should be sent. Possible values are FALSE (discard output, the default), "", to the R console. See system2
By default stderr="" and any error message of the model code will be printed to the screen

verbose

(logical)
Indicate if progress messages are printed to the screen
If verbose=TRUE, the following messages will appear: i) parameter values for each particle; (ii) model execution; iii) extraction of simulated values; and iv) computation of the goodness-of-fit measures

out.FUNs

(list)
Name of valid R functions to read the model outputs and transform them into a (zoo) object (Should generally require at least basic use of read.table or read.csv. The list must have as many elements (names) as output variables of the model to read.

out.FUNs.args

(list)
At a first level, each object inside this list corresponds to a set of arguments that, RESPECTIVELY, must be passed to out.FUNs. At a second level, the arguments to read each of the output variables are entered as lists (let's say sub-lists).

Value

A list with as many output variables (usually time series in zoo class) as functions listed in out.FUNs

Author(s)

Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com, Rodrigo Marinao Rivas ra.marinao.rivas@gmail.com

See Also

hydroMOPSO


hydroMOPSO documentation built on April 26, 2023, 1:14 a.m.