Commit d75dad9e authored by unknown's avatar unknown
Browse files

v1.0.8.9 warning messages updated in CreateRunOptions

Showing with 4 additions and 63 deletions
+4 -63
Package: airGR Package: airGR
Type: Package Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.0.8.8 Version: 1.0.8.9
Date: 2017-06-22 Date: 2017-06-22
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")), person("Laurent", "Coron", role = c("aut", "trl")),
......
...@@ -146,10 +146,6 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -146,10 +146,6 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
stop("IniStates must be an object of class IniStates\n") stop("IniStates must be an object of class IniStates\n")
return(NULL) return(NULL)
} }
# print(str(IniStates))
# print(ObjectClass)
# print(class(IniStates))
# print(sum(ObjectClass %in% class(IniStates)))
if (sum(ObjectClass %in% class(IniStates)) < 2) { if (sum(ObjectClass %in% class(IniStates)) < 2) {
stop(paste0("Non convenient IniStates for this FUN_MOD\n")) stop(paste0("Non convenient IniStates for this FUN_MOD\n"))
return(NULL) return(NULL)
...@@ -159,15 +155,15 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -159,15 +155,15 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
return(NULL) return(NULL)
} }
if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J)) & !all(is.na(IniStates$UH$UH1))) { ## GR5J if ((identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J)) & !all(is.na(IniStates$UH$UH1))) { ## GR5J
stop(paste0("Non convenient IniStates for this FUN_MOD. In IniStates, UH1 have to be a vector of NA for GR5J \n")) stop(paste0("Non convenient IniStates for this FUN_MOD. In IniStates, UH1 has to be a vector of NA for GR5J \n"))
return(NULL) return(NULL)
} }
if ((identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & is.na(IniStates$Store$Exp)) { ## GR6J if ((identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & is.na(IniStates$Store$Exp)) { ## GR6J
stop(paste0("Non convenient IniStates for this FUN_MOD. GR6J need an exponential store value in IniStates\n")) stop(paste0("Non convenient IniStates for this FUN_MOD. GR6J needs an exponential store value in IniStates \n"))
return(NULL) return(NULL)
} }
if (!(identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & !is.na(IniStates$Store$Exp)) { ## except GR6J if (!(identical(FUN_MOD, RunModel_GR6J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) & !is.na(IniStates$Store$Exp)) { ## except GR6J
stop(paste0("Non convenient IniStates for this FUN_MOD\n")) stop(paste0("Non convenient IniStates for this FUN_MOD. No exponential store value needed in IniStates \n"))
return(NULL) return(NULL)
} }
# if (length(na.omit(unlist(IniStates))) != NState) { # if (length(na.omit(unlist(IniStates))) != NState) {
...@@ -183,68 +179,13 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -183,68 +179,13 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
IniStates$Store$Rest <- rep(NA, 4) IniStates$Store$Rest <- rep(NA, 4)
IniStates <- unlist(IniStates) IniStates <- unlist(IniStates)
IniStates[is.na(IniStates)] <- 0 IniStates[is.na(IniStates)] <- 0
# print(IniStates)
if ("monthly" %in% ObjectClass) { if ("monthly" %in% ObjectClass) {
IniStates <- IniStates[seq_len(NState)] IniStates <- IniStates[seq_len(NState)]
# print(NState)
# print(IniStates)
} }
} else { } else {
IniStates <- as.double(rep(0.0, NState)) IniStates <- as.double(rep(0.0, NState))
} }
# if (is.null(IniStates) & is.null(IniResLevels) & verbose) {
# warning("\t Model states initialisation not defined -> default configuration used \n")
# }
# if("CemaNeige" %in% ObjectClass){ NLayers <- length(InputsModel$LayerPrecip); } else { NLayers <- 0; }
# NState <- NULL;
# if("GR" %in% ObjectClass | "CemaNeige" %in% ObjectClass){
# if("hourly" %in% ObjectClass){ NState <- 3*24*20 + 7; }
# if("daily" %in% ObjectClass){ if (identical(FUN_MOD,RunModel_GR5J)){NState <- 2*20 + 2*NLayers + 7; } else {NState <- 3*20 + 2*NLayers + 7; }}
# if("monthly" %in% ObjectClass){ NState <- 2; }
# if("yearly" %in% ObjectClass){ NState <- 1; }
# }
# if (!is.null(IniStates)) {
# if (!is.vector( IniStates) | !is.numeric(IniStates)) {
# stop("IniStates must be a vector of numeric values \n")
# return(NULL)
# }
# if (length(IniStates) != NState) {
# stop(paste0("The length of IniStates must be ", NState, " for the chosen FUN_MOD \n"))
# return(NULL)
# }
# } else {
# IniStates <- as.double(rep(0.0, NState))
# IniStates[1:3] <- NA
# }
# if ("GR" %in% ObjectClass & ("monthly" %in% ObjectClass | "daily" %in% ObjectClass | "hourly" %in% ObjectClass)) {
# if (!is.null(IniResLevels)) {
# if (!is.vector(IniResLevels) | !is.numeric(IniResLevels)) {
# stop("IniResLevels must be a vector of numeric values \n")
# return(NULL)
# }
# if ((identical(FUN_MOD, RunModel_GR4H) |
# identical(FUN_MOD, RunModel_GR4J) | identical(FUN_MOD, RunModel_CemaNeigeGR4J) |
# identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) |
# identical(FUN_MOD, RunModel_GR2M)) &
# length(IniResLevels) != 2) {
# stop("The length of IniStates must be 2 for the chosen FUN_MOD \n")
# return(NULL)
# }
# if ((identical(FUN_MOD,RunModel_GR6J) | identical(FUN_MOD,RunModel_CemaNeigeGR6J)) &
# length(IniResLevels) != 3) {
# stop("The length of IniStates must be 3 for the chosen FUN_MOD \n")
# return(NULL)
# }
# } else {
# IniResLevels <- as.double(c(0.3, 0.5, 0))
# }
# } else {
# if (!is.null(IniResLevels)) {
# stop("IniResLevels can only be used with monthly or daily or hourly GR models \n")
# }
# }
##check_Outputs_Cal_and_Sim ##check_Outputs_Cal_and_Sim
......
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