Commit 918ee8ce authored by David's avatar David
Browse files

fix(CreateInputsCrit): model of Apriori node should be the same of the current one

Fix #93
2 merge requests!93Draft: Version 0.7.0,!45Resolve "Regularisation: taking into account X4 transformation"
Pipeline #38677 passed with stage
in 6 minutes and 55 seconds
Showing with 16 additions and 0 deletions
+16 -0
......@@ -61,6 +61,10 @@ CreateInputsCrit.GRiwrmInputsModel <- function(InputsModel,
stop("'AprioriIds': the node \"", AprioriIds[id],
"\" is an ungauged upstream node of the node \"", id,"\"")
}
if (!identical(InputsModel[[id]]$FUN_MOD, InputsModel[[AprioriIds[id]]]$FUN_MOD)) {
stop("'AprioriIds': the node \"", AprioriIds[id],
"\" must use the same hydrological model as the node \"", id,"\"")
}
})
}
......
......@@ -109,6 +109,18 @@ test_that("Lavenne criterion: wrong sub-catchment order should throw error", {
)
})
test_that("Lavenne criterion: current node and a priori node must use the same model", {
InputsModel[["54032"]]$FUN_MOD <- RunModel_GR6J
expect_error(
CreateInputsCrit(InputsModel = InputsModel,
RunOptions = RunOptions,
Obs = Qobs[IndPeriod_Run,],
AprioriIds = AprioriIds,
transfo = "sqrt"),
regexp = "must use the same hydrological model"
)
})
test_that("Ungauged node as Apriori node should throw an error", {
nodes$model[nodes$gauge_id == "54001"] <- "Ungauged"
griwrm <- CreateGRiwrm(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment