From c4c5909b9ffb62dcc9ad78bee225259c01404a55 Mon Sep 17 00:00:00 2001 From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv> Date: Wed, 15 Mar 2017 11:08:33 +0100 Subject: [PATCH] v1.0.5.24 when X1 and X3 < 1e-2, new values set to 1e-2 --- DESCRIPTION | 4 ++-- R/RunModel_CemaNeigeGR4J.R | 10 ++++++++++ R/RunModel_CemaNeigeGR5J.R | 10 ++++++++++ R/RunModel_CemaNeigeGR6J.R | 10 ++++++++++ R/RunModel_GR2M.R | 6 ++++++ R/RunModel_GR4H.R | 10 ++++++++++ R/RunModel_GR4J.R | 10 ++++++++++ R/RunModel_GR5J.R | 12 +++++++++++- R/RunModel_GR6J.R | 10 ++++++++++ 9 files changed, 79 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5e006f13..eb60b7a1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.0.5.22 -Date: 2017-02-23 +Version: 1.0.5.24 +Date: 2017-03-15 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl")), person("Charles", "Perrin", role = c("aut", "ths")), diff --git a/R/RunModel_CemaNeigeGR4J.R b/R/RunModel_CemaNeigeGR4J.R index fc9a2f68..8ce9b7a7 100644 --- a/R/RunModel_CemaNeigeGR4J.R +++ b/R/RunModel_CemaNeigeGR4J.R @@ -16,6 +16,16 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){ 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_X1X3_threshold <- 1e-2 + if (Param[1L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[1L] <- Param_X1X3_threshold + } + if (Param[3L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[3L] <- Param_X1X3_threshold + } + ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } IndPeriod1 <- c(RunOptions$IndPeriod_WarmUp,RunOptions$IndPeriod_Run); diff --git a/R/RunModel_CemaNeigeGR5J.R b/R/RunModel_CemaNeigeGR5J.R index 3121c897..f7e3b982 100644 --- a/R/RunModel_CemaNeigeGR5J.R +++ b/R/RunModel_CemaNeigeGR5J.R @@ -15,6 +15,16 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){ if(!is.vector(Param)){ stop("Param must be a 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_X1X3_threshold <- 1e-2 + if (Param[1L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[1L] <- Param_X1X3_threshold + } + if (Param[3L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[3L] <- Param_X1X3_threshold + } ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } diff --git a/R/RunModel_CemaNeigeGR6J.R b/R/RunModel_CemaNeigeGR6J.R index af07973f..641922d7 100644 --- a/R/RunModel_CemaNeigeGR6J.R +++ b/R/RunModel_CemaNeigeGR6J.R @@ -15,6 +15,16 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){ if(!is.vector(Param)){ stop("Param must be a 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_X1X3_threshold <- 1e-2 + if (Param[1L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[1L] <- Param_X1X3_threshold + } + if (Param[3L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[3L] <- Param_X1X3_threshold + } ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } diff --git a/R/RunModel_GR2M.R b/R/RunModel_GR2M.R index c0415938..cbefa5dd 100644 --- a/R/RunModel_GR2M.R +++ b/R/RunModel_GR2M.R @@ -12,6 +12,12 @@ RunModel_GR2M <- function(InputsModel,RunOptions,Param){ if(!is.vector(Param)){ stop("Param must be a 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 New X1 value: %.2f", Param_X1_threshold, Param_X1_threshold)) + Param[1L] <- Param_X1_threshold + } ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } diff --git a/R/RunModel_GR4H.R b/R/RunModel_GR4H.R index 792642f6..d803c7e4 100644 --- a/R/RunModel_GR4H.R +++ b/R/RunModel_GR4H.R @@ -12,6 +12,16 @@ RunModel_GR4H <- function(InputsModel,RunOptions,Param){ if(!is.vector(Param)){ stop("Param must be a 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_X1X3_threshold <- 1e-2 + if (Param[1L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[1L] <- Param_X1X3_threshold + } + if (Param[3L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[3L] <- Param_X1X3_threshold + } ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } diff --git a/R/RunModel_GR4J.R b/R/RunModel_GR4J.R index 193dc91f..a5f6e7d5 100644 --- a/R/RunModel_GR4J.R +++ b/R/RunModel_GR4J.R @@ -12,6 +12,16 @@ RunModel_GR4J <- function(InputsModel,RunOptions,Param){ if(!is.vector(Param)){ stop("Param must be a 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_X1X3_threshold <- 1e-2 + if (Param[1L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[1L] <- Param_X1X3_threshold + } + if (Param[3L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[3L] <- Param_X1X3_threshold + } ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } diff --git a/R/RunModel_GR5J.R b/R/RunModel_GR5J.R index 63d0a9e5..e0ee240a 100644 --- a/R/RunModel_GR5J.R +++ b/R/RunModel_GR5J.R @@ -12,7 +12,17 @@ RunModel_GR5J <- function(InputsModel,RunOptions,Param){ if(!is.vector(Param)){ stop("Param must be a 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_X1X3_threshold <- 1e-2 + if (Param[1L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[1L] <- Param_X1X3_threshold + } + if (Param[3L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[3L] <- Param_X1X3_threshold + } + ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } IndPeriod1 <- c(RunOptions$IndPeriod_WarmUp,RunOptions$IndPeriod_Run); diff --git a/R/RunModel_GR6J.R b/R/RunModel_GR6J.R index a3227689..8bfd01b8 100644 --- a/R/RunModel_GR6J.R +++ b/R/RunModel_GR6J.R @@ -12,6 +12,16 @@ RunModel_GR6J <- function(InputsModel,RunOptions,Param){ if(!is.vector(Param)){ stop("Param must be a 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_X1X3_threshold <- 1e-2 + if (Param[1L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X1: production store capacity [mm]) < %.2f\n New X1 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[1L] <- Param_X1X3_threshold + } + if (Param[3L] < Param_X1X3_threshold) { + warning(sprintf("Param[1] (X3: routing store capacity [mm]) < %.2f\n New X3 value: %.2f", Param_X1X3_threshold, Param_X1X3_threshold)) + Param[3L] <- Param_X1X3_threshold + } ##Input_data_preparation if(identical(RunOptions$IndPeriod_WarmUp,as.integer(0))){ RunOptions$IndPeriod_WarmUp <- NULL; } -- GitLab