View source: R/define_output.R
define_output | R Documentation |
Define the SWAT output variables that should be extracted after the SWAT
model execution and be returned to R. It is required to use this function to
pass the desired outputs with the variable output
in the function calls
run_swat2012
and run_swatplus
. See
the examples how to use the output
definition together with
run_swat2012
or run_swatplus
. Further, more comprehensive
examples are provided on the package's 'Get Started' page in the section
'First SWAT model runs.
define_output(file, variable = NULL, unit = NULL)
file |
Character string. The SWAT output file to read.
(Valid inputs are |
variable |
Character string. Output variable that is extracted from the
respective SWAT output file defined with |
unit |
Numeric vector. The spatial unit (e.g. the reach, subbasin, or HRU) defined by the columns 'RCH', 'SUB', 'HRU' in the respective SWAT2012 output file or the 'unit' column in the SWAT+ output file for which the outputs should be extracted. |
# A single variable can be defined as follows (e.g. "FLOW_OUT" for
# the reaches 1 and 5):
out_flow <- define_output(file = "rch",
variable = "FLOW_OUT",
unit = c(1,5))
# In this case the the variable name of the returned output is then
# the same as defined with 'variable', here "FLOW_OUT"
# If a custom variable name is preferred for the returned output,
# the output must be defined as named list:
out_flow <- list(discharge = define_output(file = "rch",
variable = "FLOW_OUT",
unit = c(1,5)))
# Define the discharge for the RCH units 1 to 5 and the
# nitrate-nitrogen load and ET for the unit 5:
out_def <- list(flow = define_output(file = "rch",
variable = "FLOW_OUT",
unit = 1:5),
no3 = define_output(file = "rch",
variable = "NO3_OUT",
unit = 5),
et_a = define_output(file = "sub",
variable = "ET",
unit = 5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.