.GetOutputsModelGR: crash when RunOptions$Outputs_Sim contains "WarmUpQsim"
Try this:
data(L0123001)
InputsModel <- CreateInputsModel(
FUN_MOD = RunModel_GR4J,
DatesR = BasinObs$DatesR,
Precip = BasinObs$P,
PotEvap = BasinObs$E
)
Param <- c(X1 = 257.238, X2 = 1.012, X3 = 88.235, X4 = 2.208)
Ind_Run <- seq(
which(format(BasinObs$DatesR, format = "%Y-%m-%d") == "1990-01-01"),
which(format(BasinObs$DatesR, format = "%Y-%m-%d") == "1990-12-31")
)
RunOptions <- suppressWarnings(CreateRunOptions(
FUN_MOD = RunModel_GR4J,
InputsModel = InputsModel,
IndPeriod_Run = Ind_Run,
Outputs_Sim = c("WarmUpQsim", "Qsim")
))
OutputsModel <- RunModel(
FUN_MOD = RunModel_GR4J,
InputsModel = InputsModel,
RunOptions = RunOptions,
Param = Param
)
... and admire:
Error in `RESULTS$Outputs[seq_len(length(RunOptions$
IndPeriod_WarmUp)), which(
FortranOutputs == "Qsim")]`:
! subscript out of bounds
The error is in .GetOutputsModelGR on this assignation:
OutputsModel$RunOptions$WarmUpQsim <- RESULTS$Outputs[seq_len(length(RunOptions$IndPeriod_WarmUp)),
which(FortranOutputs == "Qsim")]
The column selection should be which(names(seqOutputs) == "Qsim")