rmacroliteRun-methods: Run one or several MACRO Simulation(s)

Description Usage Arguments Value Examples

Description

Run one or several MACRO Simulation(s)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
rmacroliteRun(x, f = NULL, export = TRUE, verbose = 1L, ...)

## S3 method for class 'character'
rmacroliteRun(x, f = NULL, export = TRUE,
  verbose = 1L, ...)

## S3 method for class 'macroParFile'
rmacroliteRun(x, f = NULL, export = TRUE,
  verbose = 1L, indump = TRUE, run = TRUE, rename = FALSE, ...)

## S3 method for class 'macroParFileList'
rmacroliteRun(x, f = NULL, export = TRUE,
  verbose = 1L, ...)

Arguments

x

A macroParFile- or a macroParFileList-object, containing one or several simulations to be ran. Alternatively, a single character string giving the name of and optionally the path to a par-file to be imported and simulated. When x is a single character string and export is FALSE, f should be NULL or identical to x, for consistency. When x is a single character string and export is TRUE, f should be NULL or set to a name different than the one in x, in order not to overwrite the original file.

f

Single character string. When export is TRUE, name (without path) of the par-file where the simulations parameters should be written. If NULL, a name will be attributed using the template given by getRmlPar("fileNameTemplate") and the RUNID contained in the par-file. When export is FALSE, name (without path) of an existing par-file that should be used to run the simulation. In all cases the location of the par-file is the directory in which MACRO is installed, as given by rmacroliteGetModelVar()[["path"]].

export

Single logical value. If TRUE (the default), the par-file is exported prior to the simulation. If FALSE, it is assumed that the par-file to be simulated already exists and its name and optionally location is indicated by

verbose

Single integer value. If set to a value < 1, the program is silent (except on errors or warnings). If set to 1, the program outputs messages. Values > 1 may also activate messages from lower level functions (for debugging purpose).

...

Additional parameters passed to specific methods.

indump

Single logical value. If TRUE (the default), the so called indump.tmp parameter file is produced. Must be TRUE when run is TRUE.

run

Single logical value. If TRUE (the default), the simulation is run. If FALSE, only the par-file is exported (when export is TRUE) but the simulation is not run.

rename

Single logical value. If TRUE, the bin-file output by MACRO is renamed automatically, using the template in getRmlPar("fileNameTemplate"). If FALSE (the default), the bin-file output by MACRO is not renamed.

Value

Returns a data.frame with the simulation results, a column date and if relevant a column runId.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
library( "rmacrolite" ) 

# # Setup MACRO directory (if needed)
# rmacroliteSetModelVar( "C:/swash/macro" )



# Import a par-file

#   Path to an example par-file
par_file_path <- system.file( "par-files", 
    "chat_winCer_GW-X_900gHa_d182_1910-1911.par", 
    package = "rmacrolite" )  

#   Import the example par-file
par_file <- rmacroliteImportParFile( 
    file = par_file_path ) 



# Run the simulation
out <- rmacroliteRun( x = par_file ) 



# Inspect the results

#   View the water and solute balance as output by MACRO
#   attributes( out ) # full list of attributes
attr( x = out, which = "waterSoluteBalance" )

library( "macroutils2" )

macroPlot( x = out[, c( "Date", "WOUT_99-100_100", 
    "SFLOW_99-100_100" ) ], gui = FALSE, subPlots = TRUE ) 

julienmoeys/rmacrolite documentation built on May 22, 2019, 6:31 p.m.