diff --git a/DESCRIPTION b/DESCRIPTION index 588d1f050d8bb4be4ab9861981ab048f7ab5e55d..b769dd27f55f31c28cd0004384bd59b87fe68405 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.0.8.4 +Version: 1.0.8.5 Date: 2017-06-21 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl")), diff --git a/R/RunModel_CemaNeige.R b/R/RunModel_CemaNeige.R index 24245d9fe6a7271b936f6a8de9364df56d8101a8..fa4e637e70a7409c6653e59fcc962fabdd55c376 100644 --- a/R/RunModel_CemaNeige.R +++ b/R/RunModel_CemaNeige.R @@ -9,7 +9,7 @@ RunModel_CemaNeige <- function(InputsModel,RunOptions,Param){ if(inherits(InputsModel,"CemaNeige" )==FALSE){ stop("InputsModel must be of class 'CemaNeige' \n"); return(NULL); } if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"CemaNeige" )==FALSE){ stop("RunOptions must be of class 'CemaNeige' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_CemaNeigeGR4J.R b/R/RunModel_CemaNeigeGR4J.R index 01f1ecfb4934fe10caa84680f6ed9744ce6884f7..85ed537ed50afcc6f7cb64c7149a6fc8d1e9f6e8 100644 --- a/R/RunModel_CemaNeigeGR4J.R +++ b/R/RunModel_CemaNeigeGR4J.R @@ -13,7 +13,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){ if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"CemaNeige" )==FALSE){ stop("RunOptions must be of class 'CemaNeige' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_CemaNeigeGR5J.R b/R/RunModel_CemaNeigeGR5J.R index 9e9816d15dd4c4ca30f87f3904a9b36d6f86d62a..b0c9206de7dfad1297476af06e5f2dac0dd76c6b 100644 --- a/R/RunModel_CemaNeigeGR5J.R +++ b/R/RunModel_CemaNeigeGR5J.R @@ -13,7 +13,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){ if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"CemaNeige" )==FALSE){ stop("RunOptions must be of class 'CemaNeige' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_CemaNeigeGR6J.R b/R/RunModel_CemaNeigeGR6J.R index 50d87cf7d342b07f2242a4bcffbbd9264031d9ba..b8365fce840aef24a592a6a28a96e46e7eca590f 100644 --- a/R/RunModel_CemaNeigeGR6J.R +++ b/R/RunModel_CemaNeigeGR6J.R @@ -13,7 +13,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){ if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"CemaNeige" )==FALSE){ stop("RunOptions must be of class 'CemaNeige' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_GR1A.R b/R/RunModel_GR1A.R index 5c400d9213ab57fd041f535827690b3b1cb67949..07be9d0baa64776f9430cc70b4a8949c0bb4f038 100644 --- a/R/RunModel_GR1A.R +++ b/R/RunModel_GR1A.R @@ -9,7 +9,7 @@ RunModel_GR1A <- function(InputsModel,RunOptions,Param){ if(inherits(InputsModel,"GR" )==FALSE){ stop("InputsModel must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_GR2M.R b/R/RunModel_GR2M.R index d6e029a5e4d19002219919997507167ed770e86c..74b8ab3ac106241ffa0f6fd1757a5441e5aeff55 100644 --- a/R/RunModel_GR2M.R +++ b/R/RunModel_GR2M.R @@ -9,14 +9,18 @@ RunModel_GR2M <- function(InputsModel,RunOptions,Param){ if(inherits(InputsModel,"GR" )==FALSE){ stop("InputsModel must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); - Param_X1_threshold <- 1e-2 - if (Param[1L] < Param_X1_threshold) { - warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n X1 set to %.2f", Param_X1_threshold, Param_X1_threshold)) - Param[1L] <- Param_X1_threshold + Param_X1X2_threshold <- 1e-2 + if (Param[1L] < Param_X1X2_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n X1 set to %.2f", Param_X1X2_threshold, Param_X1X2_threshold)) + Param[1L] <- Param_X1X2_threshold + } + if (Param[2L] < Param_X1X2_threshold) { + warning(sprintf("Param[2] (X2: routing store capacity [mm]) < %.2f\n X2 set to %.2f", Param_X1X2_threshold, Param_X1X2_threshold)) + Param[2L] <- Param_X1X2_threshold } ##Input_data_preparation diff --git a/R/RunModel_GR4H.R b/R/RunModel_GR4H.R index 0333c972b5ea5c16f03e6768cd10dd789b6ea496..eab3cc3a6d685cbabc170d4fb6d8968ebc00bb66 100644 --- a/R/RunModel_GR4H.R +++ b/R/RunModel_GR4H.R @@ -9,7 +9,7 @@ RunModel_GR4H <- function(InputsModel,RunOptions,Param){ if(inherits(InputsModel,"GR" )==FALSE){ stop("InputsModel must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_GR4J.R b/R/RunModel_GR4J.R index 2e522ffe69ffda0646aa2ed8dfaf1b02143821ac..151032adf0d1e3e9ae0b94229b11124e918e5a91 100644 --- a/R/RunModel_GR4J.R +++ b/R/RunModel_GR4J.R @@ -10,7 +10,7 @@ RunModel_GR4J <- function(InputsModel,RunOptions,Param){ if(inherits(InputsModel,"GR" )==FALSE){ stop("InputsModel must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_GR5J.R b/R/RunModel_GR5J.R index 489f3410570ee749be21f06bcc38bb334256a879..ac5b26b5c4d98861cdd01c352a5db63f44a27451 100644 --- a/R/RunModel_GR5J.R +++ b/R/RunModel_GR5J.R @@ -10,7 +10,7 @@ RunModel_GR5J <- function(InputsModel,RunOptions,Param){ if(inherits(InputsModel,"GR" )==FALSE){ stop("InputsModel must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param); diff --git a/R/RunModel_GR6J.R b/R/RunModel_GR6J.R index c2ca3b384b1a8ff635f56867369cb551f102ad45..6e936306b273531cc6800987817c222db783687a 100644 --- a/R/RunModel_GR6J.R +++ b/R/RunModel_GR6J.R @@ -10,7 +10,7 @@ RunModel_GR6J <- function(InputsModel,RunOptions,Param){ if(inherits(InputsModel,"GR" )==FALSE){ stop("InputsModel must be of class 'GR' \n"); return(NULL); } if(inherits(RunOptions,"RunOptions" )==FALSE){ stop("RunOptions must be of class 'RunOptions' \n"); return(NULL); } if(inherits(RunOptions,"GR" )==FALSE){ stop("RunOptions must be of class 'GR' \n"); return(NULL); } - if(!is.vector(Param)){ stop("Param must be a vector \n"); return(NULL); } + if(!is.vector(Param) | !is.numeric(Param)){ stop("Param must be a numeric vector \n"); return(NULL); } if(sum(!is.na(Param))!=NParam){ stop(paste("Param must be a vector of length ",NParam," and contain no NA \n",sep="")); return(NULL); } Param <- as.double(Param);