Prepare calibration of WTAQ-model by creation of needed input and control files
Source:R/wtUcode.R
ucPrepCalib.Rd
All input files needed to run a UCODE calibration of a WTAQ model are created
in the directory tdir. By default (open.tdir = TRUE) this
directory is opened in the Windows explorer. You can use the created batch
file runParallelUCode.bat
to start the UCODE calibration.
Usage
ucPrepCalib(
wtaqConfiguration = wtDefaultConfiguration(),
uconf = ucConf(),
tdir = tempdir(),
open.tdir = TRUE,
wtaq = system.file("extdata", "wtaq.2.1.exe", package = "kwb.wtaq"),
ucode = system.file("extdata", "ucode_2005.exe", package = "kwb.wtaq")
)
Arguments
- wtaqConfiguration
WTAQ configuration as retrieved by
wtConfigure
- uconf
UCode configuration as retrieved by
ucConf
- tdir
target directory in which all input and control files are to be created. Default: temporary directory of current R Session. Attention! This temporary directory will be emptied after the R session has finished!
- open.tdir
if TRUE, the target directory will be opened in the Windows Explorer in order to allow inspecting the created files
- wtaq
full path to WTAQ executable
- ucode
full path to UCODE executable
Examples
# Define WTAQ configuration...
# Here: just load the configuration of WTAQ's Sample problem 2
wtaqConfiguration <- kwb.wtaq::wtConfigurationExample2()
# Define parameters
p <- rbind(
ucConfParameter(
"HKR",
startvalue = 2e-5,
lowerConstraint = 1e-5,
upperConstraint = 1e-1,
maxChange = 1,
perturbAmt = 0.5
),
ucConfParameter(
"HKZ",
startvalue = 2e-7,
lowerConstraint = 1e-7,
upperConstraint = 1e-3,
maxChange = 1,
perturbAmt = 0.5
)
)
# Define weights
#
# The following weight matrix w gives a weight of 1 to the root mean square
# error (RMSE) and the Nash-Sutcliffe-Efficiency (NSE) between simulated
# and observed values at the pumping well ("PW") and to the NSE between
# simulated and observed values at the observation well "PS1".
#
# well -> PW PS1
w <- matrix(c( 1, 1, # RMSE <- GOF
1, 1), # NSE
nrow = 2, byrow = TRUE,
dimnames = list(c("RMSE", "NSE"), c("PW", "PS1")))
# Create UCODE configuration
uconf <- ucConf(general = ucConfGeneral(maxIter = 100),
parameters = p, weights = w)
# Create all input files needed to run the UCODE calibration of WTAQ
# sample problem 2
tdir <- ucPrepCalib(wtaqConfiguration = wtaqConfiguration, uconf = uconf)
#> *** Writing WTAQ arguments file /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//Rtmp5NjDGD/wtaq.args ...
#> *** Writing GOF evaluation script /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//Rtmp5NjDGD/serialWtaqGof.R ...
#> *** Writing batch file /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//Rtmp5NjDGD/runSerialWtaq.bat ...
#> *** Writing batch file /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//Rtmp5NjDGD/runSerialWtaqDbg.bat ...
#> *** Writing batch file /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//Rtmp5NjDGD/runParallelWtaq.bat ...
#> *** Writing test input file ...
#> *** Running test ...
#> Error in shell(bfile): could not find function "shell"
# Run loop waiting for input files provided by UCODE (remove the comment
# character in the following line!)
#ucRunParallel(tdir, uconf = uconf)
# Now, run runParallelUCode.bat in the target directory...