Commit 1d5a50be authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.4.3.4 UPDATE: conditionnal tests concerning the RunModel_CemaneiGR5H added...

v1.4.3.4 UPDATE: conditionnal tests concerning the RunModel_CemaneiGR5H added in CreateInputsModel,  CreateRunOptions , CreateIniStates and CreateCalibOptions and Calibration_Michel #13
parent 67f8c828
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.4.3.3
Version: 1.4.3.4
Date: 2019-12-12
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -2,7 +2,7 @@
### 1.4.3.3 Release Notes (2019-12-12)
### 1.4.3.4 Release Notes (2019-12-12)
#### New features
......
......@@ -85,14 +85,14 @@ Calibration_Michel <- function(InputsModel,
FUN_TRANSFO <- TransfoParam_CemaNeige
}
}
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H) | #identical(FUN_MOD, RunModel_CemaNeigeGR5H) |
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H) |
identical(FUN_MOD, RunModel_CemaNeigeGR4J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) {
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H)) {
FUN1 <- TransfoParam_GR4H
}
# if (identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
# FUN1 <- TransfoParam_GR5H
# }
if (identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
FUN1 <- TransfoParam_GR5H
}
if (identical(FUN_MOD, RunModel_CemaNeigeGR4J)) {
FUN1 <- TransfoParam_GR4J
}
......
......@@ -56,10 +56,10 @@ CreateCalibOptions <- function(FUN_MOD,
ObjectClass <- c(ObjectClass, "CemaNeigeGR4H")
BOOL <- TRUE
}
# if (identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
# ObjectClass <- c(ObjectClass, "CemaNeigeGR5H")
# BOOL <- TRUE
# }
if (identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
ObjectClass <- c(ObjectClass, "CemaNeigeGR5H")
BOOL <- TRUE
}
if (identical(FUN_MOD, RunModel_CemaNeigeGR4J)) {
ObjectClass <- c(ObjectClass, "CemaNeigeGR4J")
BOOL <- TRUE
......@@ -100,9 +100,8 @@ CreateCalibOptions <- function(FUN_MOD,
identical(FUN_MOD, RunModel_CemaNeigeGR4H)) {
FUN1 <- TransfoParam_GR4H
}
# if (identical(FUN_MOD, RunModel_GR5H) |
# identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
if (identical(FUN_MOD, RunModel_GR5H)) {
if (identical(FUN_MOD, RunModel_GR5H) |
identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
FUN1 <- TransfoParam_GR5H
}
if (identical(FUN_MOD, RunModel_GR4J) |
......
......@@ -37,7 +37,7 @@ CreateIniStates <- function(FUN_MOD, InputsModel, IsHyst = FALSE, IsIntStore = F
ObjectClass <- c(ObjectClass, "CemaNeige", "daily")
BOOL <- TRUE
}
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H)) { # | identical(FUN_MOD, RunModel_CemaNeigeGR5H)
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
ObjectClass <- c(ObjectClass, "GR", "CemaNeige", "hourly")
BOOL <- TRUE
}
......@@ -53,7 +53,7 @@ CreateIniStates <- function(FUN_MOD, InputsModel, IsHyst = FALSE, IsIntStore = F
if (!"CemaNeige" %in% ObjectClass & IsHyst) {
stop("'IsHyst' cannot be TRUE if CemaNeige is not used in 'FUN_MOD'")
}
if (!(identical(FUN_MOD, RunModel_GR5H)) & IsIntStore) {# | !(identical(FUN_MOD, RunModel_CemaNeigeGR5H))
if (!(identical(FUN_MOD, RunModel_GR5H | identical(FUN_MOD, RunModel_CemaNeigeGR5H))) & IsIntStore) {
stop("'IsIntStore' cannot be TRUE if GR5H is not used in 'FUN_MOD'")
}
......@@ -107,7 +107,7 @@ CreateIniStates <- function(FUN_MOD, InputsModel, IsHyst = FALSE, IsIntStore = F
}
UH1 <- rep(Inf, UH1n)
}
if ((!identical(FUN_MOD, RunModel_GR5H)) & !is.null(IntStore)) {# !identical(FUN_MOD, RunModel_CemaNeigeGR5H)
if ((!identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & !is.null(IntStore)) {
if (verbose) {
warning(sprintf("'%s' does not require 'IntStore'. Values set to NA", nameFUN_MOD))
}
......
......@@ -59,7 +59,7 @@ CreateInputsModel <- function(FUN_MOD,
BOOL <- TRUE
}
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H)) {#} | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
ObjectClass <- c(ObjectClass, "hourly", "GR", "CemaNeige")
TimeStep <- as.integer(60 * 60)
......
......@@ -50,7 +50,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
ObjectClass <- c(ObjectClass, "GR", "CemaNeige", "daily")
BOOL <- TRUE
}
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H)) { # | identical(FUN_MOD, RunModel_CemaNeigeGR5H)
if (identical(FUN_MOD, RunModel_CemaNeigeGR4H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) {
ObjectClass <- c(ObjectClass, "GR", "CemaNeige", "hourly")
BOOL <- TRUE
}
......@@ -67,8 +67,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
if (!"CemaNeige" %in% ObjectClass & "hysteresis" %in% ObjectClass) {
stop("'IsHyst' cannot be TRUE for the chosen 'FUN_MOD'")
}
# if ((!(identical(FUN_MOD, RunModel_GR5H)) | !(identical(FUN_MOD, RunModel_CemaNeigeGR5H))) & "interception" %in% ObjectClass) {
if (!(identical(FUN_MOD, RunModel_GR5H)) & "interception" %in% ObjectClass) {
if (!(identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & "interception" %in% ObjectClass) {
stop("'IMax' cannot be set for the chosen 'FUN_MOD'")
}
......@@ -209,7 +208,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
IniResLevels[3L] <- NA
}
}
if (identical(FUN_MOD,RunModel_GR5H)) { # | identical(FUN_MOD,RunModel_CemaNeigeGR5H)
if (identical(FUN_MOD,RunModel_GR5H) | identical(FUN_MOD,RunModel_CemaNeigeGR5H)) {
if (IsIntStore & is.na(IniResLevels[4L])) {
stop("the fourth value of 'IniResLevels' cannot be a missing value for the chosen 'FUN_MOD' with a given value set for 'Imax")
}
......@@ -228,8 +227,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
if (identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) {
IniResLevels <- as.double(c(0.3, 0.5, 0, NA))
}
# if ((identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & IsIntStore) {
if ((identical(FUN_MOD, RunModel_GR5H)) & IsIntStore) {
if ((identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & IsIntStore) {
IniResLevels <- as.double(c(0.3, 0.5, NA, 0))
}
# if (!identical(FUN_MOD, RunModel_GR6J) & !identical(FUN_MOD, RunModel_CemaNeigeGR6J) &
......@@ -281,25 +279,22 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
if (identical(FUN_MOD, RunModel_GR1A) & !is.null(IniStates)) { ## GR1A
stop(paste0("'IniStates' is not available for the chosen 'FUN_MOD'"))
}
# if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) | identical(FUN_MOD, RunModel_GR5H) |
# identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & !all(is.na(IniStates$UH$UH1))) { ## GR5J or GR5H
if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) | identical(FUN_MOD, RunModel_GR5H)) &
if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) |
identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) &
!all(is.na(IniStates$UH$UH1))) { ## GR5J or GR5H
stop(paste0("non convenient 'IniStates' for the chosen 'FUN_MOD'.' In 'IniStates', 'UH1' has to be a vector of NA for GR5J"))
}
if ((identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & is.na(IniStates$Store$Exp)) { ## GR6J
stop(paste0("non convenient 'IniStates' for the chosen 'FUN_MOD'.' GR6J needs an exponential store value in 'IniStates'"))
}
# if ((identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & is.na(IniStates$Store$Int)) { ## GR5H interception
if ((identical(FUN_MOD, RunModel_GR5H)) & is.na(IniStates$Store$Int)) { ## GR5H interception
if ((identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & is.na(IniStates$Store$Int)) { ## GR5H interception
stop(paste0("non convenient 'IniStates' for the chosen 'FUN_MOD'.' GR5H (with interception store) needs an interception store value in 'IniStates'"))
}
if (!(identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & !is.na(IniStates$Store$Exp)) { ## except GR6J
stop(paste0("non convenient 'IniStates' for the chosen 'FUN_MOD'.' No exponential store value needed in 'IniStates'"))
}
# if (!(identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & !is.na(IniStates$Store$Int)) { ## except GR5H interception
if (!(identical(FUN_MOD, RunModel_GR5H)) & !is.na(IniStates$Store$Int)) { ## except GR5H interception
if (!(identical(FUN_MOD, RunModel_GR5H) | identical(FUN_MOD, RunModel_CemaNeigeGR5H)) & !is.na(IniStates$Store$Int)) { ## except GR5H interception
stop(paste0("non convenient 'IniStates' for the chosen 'FUN_MOD'.' No interception store value needed in 'IniStates'"))
}
# if (length(na.omit(unlist(IniStates))) != NState) {
......@@ -343,8 +338,8 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
if (identical(FUN_MOD,RunModel_GR4H) | identical(FUN_MOD,RunModel_CemaNeigeGR4H)) {
Outputs_all <- c(Outputs_all, .FortranOutputs(GR = "GR4H")$GR)
}
if (identical(FUN_MOD,RunModel_GR5H)) {
Outputs_all <- c(Outputs_all, .FortranOutputs(GR = "GR5H")$GR) # | identical(FUN_MOD,RunModel_CemaNeigeGR5H)
if (identical(FUN_MOD,RunModel_GR5H) | identical(FUN_MOD,RunModel_CemaNeigeGR5H)) {
Outputs_all <- c(Outputs_all, .FortranOutputs(GR = "GR5H")$GR)
}
if (identical(FUN_MOD,RunModel_GR4J) | identical(FUN_MOD,RunModel_CemaNeigeGR4J)) {
Outputs_all <- c(Outputs_all, .FortranOutputs(GR = "GR4J")$GR)
......
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