diff --git a/NAMESPACE b/NAMESPACE index e98e84243a6f6910bb1289cb4ee876ca5d5365ba..86ea5952aab48013348cbfbfe3ae156606bf5604 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/CreateCalibOptions.R b/R/CreateCalibOptions.R index 8a974aa041ac962a788224c8fb5564b571d41464..691903fa5ad276d1e2f2302f5929481008a70ac8 100644 --- a/R/CreateCalibOptions.R +++ b/R/CreateCalibOptions.R @@ -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) diff --git a/R/RunModel_LLR.R b/R/RunModel_LLR.R index 8bc6519856f824c28ca8d4e3600cc0556e840059..aa31e5022f32166850d13be07b974eb515a25b4e 100644 --- a/R/RunModel_LLR.R +++ b/R/RunModel_LLR.R @@ -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) diff --git a/R/RunModel_LBLR.R b/R/RunModel_Munier_LR.R similarity index 96% rename from R/RunModel_LBLR.R rename to R/RunModel_Munier_LR.R index c8591eab39ebe4895839f094ff701a0da2931804..a3ea21a2b3d8f9b877ff39e603514a5751ddedd0 100644 --- a/R/RunModel_LBLR.R +++ b/R/RunModel_Munier_LR.R @@ -1,4 +1,4 @@ -RunModel_LBLR <- function(InputsModel, RunOptions, Param, QcontribDown) { +RunModel_Munier_LR <- function(InputsModel, RunOptions, Param, QcontribDown) { NParam <- 2 ##RunModel_LBLR ## argument check diff --git a/R/RunModel_LRQ.R b/R/RunModel_QLR.R similarity index 96% rename from R/RunModel_LRQ.R rename to R/RunModel_QLR.R index 8bf801b5968dcd61054f51723b76974c1f01c8fc..01c43f6a0e312d3697df1bd973035eebef52f1c8 100644 --- a/R/RunModel_LRQ.R +++ b/R/RunModel_QLR.R @@ -1,6 +1,6 @@ -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'") diff --git a/R/TransfoParam_LBLR.R b/R/TransfoParam_Munier_LR.R similarity index 91% rename from R/TransfoParam_LBLR.R rename to R/TransfoParam_Munier_LR.R index dbcd52d50bfb6ad60406d3c258b4d6d27f4f23b9..c5e62594c8fe83d85448beecdeb79594f0a3590f 100644 --- a/R/TransfoParam_LBLR.R +++ b/R/TransfoParam_Munier_LR.R @@ -1,4 +1,4 @@ -TransfoParam_LBLR <- function(ParamIn, Direction) { +TransfoParam_Munier_LR <- function(ParamIn, Direction) { ## number of model parameters NParam <- 2L diff --git a/R/TransfoParam_LRQ.R b/R/TransfoParam_QLR.R similarity index 86% rename from R/TransfoParam_LRQ.R rename to R/TransfoParam_QLR.R index 5400ee69db6e9f02269314d8bc7949c9c53c954f..bcb8795b4835adf33c6a4a2bcbc5199989a04bed 100644 --- a/R/TransfoParam_LRQ.R +++ b/R/TransfoParam_QLR.R @@ -1,4 +1,4 @@ -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") { diff --git a/R/Utils.R b/R/Utils.R index e75d51d46247e611dbda6732f632ed81a14b8b5b..f28a9c09bcf357a19c6aa2ab3ecb3bd07471e405 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -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) diff --git a/R/UtilsCalibOptions.R b/R/UtilsCalibOptions.R index 90f14eef9e69f2b1d758c5576f4be03a8ffe532e..67501d6cb3dde7e951a91477c4ff165af03010bf 100644 --- a/R/UtilsCalibOptions.R +++ b/R/UtilsCalibOptions.R @@ -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 diff --git a/airGR.Rproj b/airGR.Rproj index 398aa1438c2c45f6eb3efd75ef2d4052d5ae7923..5caa49b436e8cf1d840715e2dc1710ac97716b54 100644 --- a/airGR.Rproj +++ b/airGR.Rproj @@ -1,20 +1,20 @@ -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 diff --git a/inst/modelsFeatures/FeatModelsGR.csv b/inst/modelsFeatures/FeatModelsGR.csv index b8738de4329d227716c123b3ba10b453e1879a30..730bdbdfb465dd7e8cc34f67768589e3b0c3b873 100644 --- a/inst/modelsFeatures/FeatModelsGR.csv +++ b/inst/modelsFeatures/FeatModelsGR.csv @@ -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