Commit 31f8e94e authored by David's avatar David
Browse files

refactor: change name of routing functions to Munier and QLR

- RunModel_LLR handle state length smaller than IndPeriod_Run length

Refs HYCAR-Hydro/airgr#153
parent 456d4eb5
No related merge requests found
Pipeline #42859 failed with stages
in 7 minutes and 28 seconds
Showing with 49 additions and 45 deletions
+49 -45
......@@ -55,8 +55,8 @@ export(RunModel_GR5J)
export(RunModel_GR6J)
export(RunModel_Lag)
export(RunModel_LLR)
export(RunModel_LBLR)
export(RunModel_LRQ)
export(RunModel_Munier_LR)
export(RunModel_QLR)
export(SeriesAggreg)
export(TransfoParam)
export(TransfoParam_CemaNeige)
......@@ -70,7 +70,8 @@ export(TransfoParam_GR5J)
export(TransfoParam_GR6J)
export(TransfoParam_Lag)
export(TransfoParam_LLR)
export(TransfoParam_LBLR)
export(TransfoParam_Munier_LR)
export(TransfoParam_QLR)
export(.ErrorCrit)
export(.FeatModels)
......
......@@ -208,17 +208,17 @@ CreateCalibOptions <- function(FUN_MOD,
ParamT <- cbind(ParamTSD, ParamT)
}
else if (identical(RunModel_LLR, FUN_SD)){
ParamTSD <- matrix(c(-9.00, -5,
-7.00, 0,
-5.00, +5), ncol = 2, byrow = TRUE)
ParamTSD <- matrix(c(-9.9, -9.8,
-7.00, -1,
-5.00, +7.8), ncol = 2, byrow = TRUE)
ParamT <- cbind(ParamTSD, ParamT)
}
else if (identical(RunModel_LBLR, FUN_SD)){
else if (identical(RunModel_Munier_LR, FUN_SD)){
ParamTSD <- matrix(c(-9.00, -5,
-7.00, 0,
-5.00, +5), ncol = 2, byrow = TRUE)
ParamT <- cbind(ParamTSD, ParamT)
} else if (identical(RunModel_LRQ, FUN_SD)){
} else if (identical(RunModel_QLR, FUN_SD)){
ParamTSD <- matrix(c(-9.00, -5,
-7.00, 0,
-5.00, +5), ncol = 2, byrow = TRUE)
......
......@@ -176,7 +176,11 @@ RunModel_LLR <- function(InputsModel, RunOptions, Param, QcontribDown) {
if ("StateEnd" %in% RunOptions$Outputs_Sim) {
SD <- lapply(seq(NbUpBasins), function(x) {
lastTS <- RunOptions$IndPeriod_Run[length(RunOptions$IndPeriod_Run)]
InputsModel$Qupstream[(lastTS - floor(PT[x])):lastTS, x]
if (lastTS - floor(PT[x]) < 0) {
InputsModel$Qupstream[1 :lastTS, x]
} else {
InputsModel$Qupstream[(lastTS - floor(PT[x])):lastTS, x]
}
})
if (is.null(OutputsModel$StateEnd)) {
OutputsModel$StateEnd <- CreateIniStates(RunModel_LLR, InputsModel, SD = SD)
......
RunModel_LBLR <- function(InputsModel, RunOptions, Param, QcontribDown) {
RunModel_Munier_LR <- function(InputsModel, RunOptions, Param, QcontribDown) {
NParam <- 2
##RunModel_LBLR
## argument check
......
RunModel_LRQ <- function(InputsModel, RunOptions, Param, QcontribDown) {
RunModel_QLR <- function(InputsModel, RunOptions, Param, QcontribDown) {
NParam <- 2
#RunModel_LRQ
## argument check
if (!inherits(InputsModel, "InputsModel")) {
stop("'InputsModel' must be of class 'InputsModel'")
......
TransfoParam_LBLR <- function(ParamIn, Direction) {
TransfoParam_Munier_LR <- function(ParamIn, Direction) {
## number of model parameters
NParam <- 2L
......
TransfoParam_LRQ <- function(ParamIn, Direction) {
TransfoParam_QLR <- function(ParamIn, Direction) {
## number of model parameters
NParam <- 2L
......@@ -22,7 +22,7 @@ TransfoParam_LRQ <- function(ParamIn, Direction) {
## transformation
if (Direction == "TR") {
ParamOut <- ParamIn
ParamOut[, 1] <- 20 * (ParamIn[, 1] + 10) / 20.0
ParamOut[, 1] <- 20 * (ParamIn[,1] + 10) / 20
ParamOut[, 2] <- 500000 * (ParamIn[, 2] + 10) / 20
}
if (Direction == "RT") {
......
......@@ -80,12 +80,12 @@
}else if(identical(RunModel_LLR, FUN_SD)){
res$NParamSD <- FeatMod$NbParam[15]
res$FUN_SD <- "LLR"
}else if(identical(RunModel_LBLR, FUN_SD)){
}else if(identical(RunModel_Munier_LR, FUN_SD)){
res$NParamSD <- FeatMod$NbParam[16]
res$FUN_SD <- "LBLR"
}else if (identical(RunModel_LRQ, FUN_SD)){
}else if (identical(RunModel_QLR, FUN_SD)){
res$NParamSD <- FeatMod$NbParam[17]
res$FUN_SD <- "LRQ"
res$FUN_SD <- "QLR"
}
}
return(res)
......
......@@ -31,12 +31,11 @@
FUN_ROUT <- TransfoParam_Lag
} else if (identical(RunModel_LLR, FUN_SD)){
FUN_ROUT <- TransfoParam_LLR
} else if (identical(RunModel_LBLR, FUN_SD)){
FUN_ROUT <- TransfoParam_LBLR
} else if (identical(RunModel_LRQ, FUN_SD)){
FUN_ROUT <- TransfoParam_LRQ
} else if (identical(RunModel_Munier_LR, FUN_SD)){
FUN_ROUT <- TransfoParam_Munier_LR
} else if (identical(RunModel_QLR, FUN_SD)){
FUN_ROUT <- TransfoParam_QLR
}
}
## set FUN_TRANSFO
......
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: knitr
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: knitr
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
......@@ -14,5 +14,5 @@ CemaNeigeGR4H;CemaNeigeGR4H;6;hourly;NA;GR;airGR
CemaNeigeGR5H;CemaNeigeGR5H;7;hourly;NA;GR;airGR
Lag;Lag;1;NA;NA;SD;airGR
LLR;LLR;2;NA;NA;SD;airGR
LBLR;LBLR;2;NA;NA;SD;airGR
LRQ;LRQ;2;NA;NA;SD;airGR
Munier_LR;Munier_LR;2;NA;NA;SD;airGR
QLR;QLR;2;NA;NA;SD;airGR
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