vignettes/basicWorkflow.Rmd
basicWorkflow.Rmd
This vignette provides an overview of the basic modelling workflow
with the RPhosFate
package.
Load the package and obtain a copy of the demonstration project:
library(RPhosFate)
cv_dir <- demoProject()
Use RPhosFate()
or catchment()
to
initialise the project:
firstRun()
calls all low-level interface methods for the
specified substance in the required order:
x <- firstRun(x, substance = "SS")
Snap coordinates of provided calibration gauges to the respective midpoint of the nearest channel cell if necessary and check calibration quality:
x <- snapGauges(x)
metrics <- calibrationQuality(x, substance = "SS", col = "SS_load")
SS is calibrated by iteratively specifying better parameter values
for ns_dep_ovl
(overland deposition rate) and/or
ns_dep_cha
(channel deposition rate) as well as calling
subsequentRun()
for SS afterwards until pleased with the
metrics. By default, subsequentRun()
only calls the
transport()
low-level interface method for the specified
substance:
x <- setParameter(x, ns_dep_ovl = 15e-4)
x <- subsequentRun(x, substance = "SS")
metrics <- calibrationQuality(x, substance = "SS", col = "SS_load")
The autoCalibrate()
and autoCalibrate2()
methods may provide more comfortable alternatives to this process.
First, a further call to subsequentRun()
for PP is
necessary:
x <- subsequentRun(x, substance = "PP")
metrics <- calibrationQuality(x, substance = "PP", col = "PP_load")
Same procedure as with SS apart from iteratively specifying better parameter values for the enrichment ratio:
x <- setParameter(x, nv_enr_rto = c(PP = 1.4))
x <- subsequentRun(x, substance = "PP")
metrics <- calibrationQuality(x, substance = "PP", col = "PP_load")
In case the only substance of interest is PP, it is possible to set
its enrichment ratio to one and directly calibrate it via
ns_dep_ovl
and/or ns_dep_cha
.
Simply load the previously saved state of the project via the
ls_ini
argument of RPhosFate()
or
catchment()
:
x <- RPhosFate(
cv_dir = cv_dir,
ls_ini = TRUE
)