diff --git a/DESCRIPTION b/DESCRIPTION index c664ecb8b97df226a139103614f78af5ee9b9470..1bafe679ba656e0e54f7a927a7b846c12e2999fa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ 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")), diff --git a/NEWS.md b/NEWS.md index 8ef8c4da2cfc29855e1f31335fbb5a21e3e82edb..58f7e06c1a0d38f4f47f579091c809a4b943250a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ -### 1.4.3.3 Release Notes (2019-12-12) +### 1.4.3.4 Release Notes (2019-12-12) #### New features diff --git a/R/Calibration_Michel.R b/R/Calibration_Michel.R index f6e5f49daf0271724bd91e645e56067b553e5d64..759630eaee92ea5208624b1bf7fc29d805e50973 100644 --- a/R/Calibration_Michel.R +++ b/R/Calibration_Michel.R @@ -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 } diff --git a/R/CreateCalibOptions.R b/R/CreateCalibOptions.R index 324981159086a3f3843c841c3c2a267a082e4827..56dedd9654b67e3fb79a509274229c42e4db7446 100644 --- a/R/CreateCalibOptions.R +++ b/R/CreateCalibOptions.R @@ -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) | diff --git a/R/CreateIniStates.R b/R/CreateIniStates.R index 20d6cd141585ffd410d3069ef3d414a1fd885ed4..3a5da97fe461811baf1229b0899aa884839db340 100644 --- a/R/CreateIniStates.R +++ b/R/CreateIniStates.R @@ -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)) } diff --git a/R/CreateInputsModel.R b/R/CreateInputsModel.R index 20a0fd2feade2f9c4cc8cc88d3da1e3e53cff9a5..510ea517d40e075b206f1af096ec9ae24fc23829 100644 --- a/R/CreateInputsModel.R +++ b/R/CreateInputsModel.R @@ -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) diff --git a/R/CreateRunOptions.R b/R/CreateRunOptions.R index 1c145a949b5f0504757ef1694f6e84a77a78d342..087a972c0e20d364ebe2137dd0ffebe88ffaff89 100644 --- a/R/CreateRunOptions.R +++ b/R/CreateRunOptions.R @@ -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)