Commit 25e04582 authored by Dorchies David's avatar Dorchies David
Browse files

Revert "fix(CreateInputsCrit): wrong Qobs in Lavenne criteria (temporary fix)"

This reverts commit 839d28ac.
parent 839d28ac
Pipeline #26825 passed with stage
in 5 minutes and 50 seconds
......@@ -85,19 +85,12 @@ getInputsCrit_Lavenne <- function(id, OutputsModel, InputsCrit) {
stop("'InputsCrit[[id]]' must be of class InputsCritLavenneFunction")
}
AprioriId <- attr(InputsCrit[[id]], "AprioriId")
Lavenne_DATA <- attr(InputsCrit[[id]], "Lavenne_DATA")
Lavenne_FUN <- attr(InputsCrit[[id]], "Lavenne_FUN")
AprParamR <- OutputsModel[[AprioriId]]$Param
if(!inherits(OutputsModel[[AprioriId]], "SD")) {
# Add neutral velocity parameter for upstream catchment
AprParamR <- c(NA, AprParamR)
}
AprCrit <- ErrorCrit(InputsCrit[[AprioriId]], OutputsModel[[AprioriId]])$CritValue
CreateInputsCrit_Lavenne(FUN_CRIT = Lavenne_DATA$FUN_CRIT,
InputsModel = Lavenne_DATA$InputsModel,
RunOptions = Lavenne_DATA$RunOptions,
Obs = Lavenne_DATA$Obs,
AprParamR = AprParamR,
AprCrit = AprCrit,
k = Lavenne_DATA$k,
transfo = Lavenne_DATA$transfo)
return(Lavenne_FUN(AprParamR, AprCrit))
}
......@@ -6,7 +6,6 @@ CreateInputsCrit.GRiwrmInputsModel <- function(InputsModel,
Obs,
AprioriIds = NULL,
k = 0.15,
transfo = "",
...) {
# Parameter checks
......@@ -66,18 +65,32 @@ CreateInputsCrit.GRiwrmInputsModel <- function(InputsModel,
)
if (!is.null(AprioriIds) && IM$id %in% names(AprioriIds)) {
# De Lavenne regularisation for this sub-catchment
attr(InputsCrit[[IM$id]], "Lavenne_DATA") <-
list(
attr(InputsCrit[[IM$id]], "Lavenne_FUN") <-
CreateLavenneFunction(
InputsModel = IM,
FUN_CRIT = FUN_CRIT,
RunOptions = RunOptions[[IM$id]],
Obs = Obs[, IM$id],
k = k,
transfo = transfo
...
)
attr(InputsCrit[[IM$id]], "AprioriId") <- AprioriIds[IM$id]
class(InputsCrit[[IM$id]]) <- c("InputsCritLavenneFunction", class(InputsCrit[[IM$id]]))
}
}
return(InputsCrit)
}
CreateLavenneFunction <- function(InputsModel, FUN_CRIT, RunOptions, Obs, k, ...) {
function(AprParamR, AprCrit) {
CreateInputsCrit_Lavenne(FUN_CRIT = FUN_CRIT,
InputsModel = InputsModel,
RunOptions = RunOptions,
Obs = Obs,
AprParamR = AprParamR,
AprCrit = AprCrit,
k = k,
...)
}
}
Markdown is supported
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