diff --git a/R/CreateInputsModel.R b/R/CreateInputsModel.R index 6446cd2ef87c13289c4ea40d3b6729399b2aa192..f11f160081a4295378fda04e39bcaba27a531f04 100644 --- a/R/CreateInputsModel.R +++ b/R/CreateInputsModel.R @@ -35,7 +35,7 @@ CreateInputsModel <- function(FUN_MOD,DatesR,Precip,PotEvap=NULL,TempMean=NULL,T BOOL <- TRUE } if(!BOOL) { - stop("incorrect FUN_MOD for use in CreateInputsModel \n") + stop("Incorrect FUN_MOD for use in CreateInputsModel \n") return(NULL) } @@ -87,7 +87,11 @@ CreateInputsModel <- function(FUN_MOD,DatesR,Precip,PotEvap=NULL,TempMean=NULL,T if(NLayers <= 0) { stop("NLayers must be a positive integer value \n") return(NULL) - } + } + if(NLayers != as.integer(NLayers)) { + warning("Coerce NLayers to be of integer type (", NLayers, " => ", as.integer(NLayers), ")") + NLayers <- as.integer(NLayers) + } } @@ -108,14 +112,14 @@ CreateInputsModel <- function(FUN_MOD,DatesR,Precip,PotEvap=NULL,TempMean=NULL,T WTxt <- NULL; WTxt <- paste(WTxt,"\t Missing values are not allowed in InputsModel \n",sep=""); Select <- (max(which(BOOL_NA))+1):length(BOOL_NA); - if(Select[1L]>Select[2L]) { stop(paste("time series could not be trunced since missing values were detected at the list time-step \n",sep="")); return(NULL); } + if(Select[1L]>Select[2L]) { stop("Time series could not be trunced since missing values were detected at the list time-step"); return(NULL); } if("GR" %in% ObjectClass) { Precip <- Precip[Select]; PotEvap <- PotEvap[Select]; } if("CemaNeige" %in% ObjectClass) { Precip <- Precip[Select]; TempMean <- TempMean[Select]; if(!is.null(TempMin) & !is.null(TempMax)) { TempMin <- TempMin[Select]; TempMax <- TempMax[Select]; } } DatesR <- DatesR[Select]; - WTxt <- paste(WTxt,"\t -> data were trunced to keep the most recent available time-steps \n",sep=""); - WTxt <- paste(WTxt,"\t -> ",length(Select)," time-steps were kept \n",sep=""); + WTxt <- paste(WTxt,"\t -> Data were trunced to keep the most recent available time-steps \n",sep=""); + WTxt <- paste(WTxt,"\t -> ", length(Select), " time-steps were kept \n",sep=""); if(!is.null(WTxt) & verbose) { warning(WTxt); } }