Commit 854d1b97 authored by unknown's avatar unknown
Browse files

v1.0.9.10 argument RunSnowModule deprecated in CreateRunOptions #4737

parent e2fcad90
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.0.9.9
Version: 1.0.9.10
Date: 2017-07-11
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")),
......
CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run, IniStates = NULL, IniResLevels = NULL,
Outputs_Cal = NULL, Outputs_Sim = "all", RunSnowModule = TRUE, MeanAnSolidPrecip = NULL, verbose = TRUE) {
Outputs_Cal = NULL, Outputs_Sim = "all", RunSnowModule, MeanAnSolidPrecip = NULL, verbose = TRUE) {
if (!missing(RunSnowModule)) {
warning("argument RunSnowModule is deprecated; please adapt FUN_MOD instead.", call. = FALSE)
}
ObjectClass <- NULL
......@@ -234,14 +237,6 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
Outputs_Cal <- Outputs_Cal[!duplicated(Outputs_Cal)];
##check_RunSnowModule
if("CemaNeige" %in% ObjectClass){
if(!is.vector( RunSnowModule)){ stop("RunSnowModule must be a single boolean \n"); return(NULL); }
if(!is.logical(RunSnowModule)){ stop("RunSnowModule must be either TRUE or FALSE \n"); return(NULL); }
if(length(RunSnowModule)!=1 ){ stop("RunSnowModule must be either TRUE or FALSE \n"); return(NULL); }
}
##check_MeanAnSolidPrecip
if("CemaNeige" %in% ObjectClass & is.null(MeanAnSolidPrecip)){
NLayers <- length(InputsModel$LayerPrecip);
......@@ -265,7 +260,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
##check_PliqAndMelt
if(RunSnowModule & "GR" %in% ObjectClass & "CemaNeige" %in% ObjectClass){
if("GR" %in% ObjectClass & "CemaNeige" %in% ObjectClass){
if("PliqAndMelt" %in% Outputs_Cal == FALSE & "all" %in% Outputs_Cal == FALSE){
WTxt <- NULL;
WTxt <- paste(WTxt,"\t PliqAndMelt was not defined in Outputs_Cal but is needed to feed the hydrological model with the snow modele outputs \n",sep="");
......@@ -285,7 +280,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
RunOptions <- list(IndPeriod_WarmUp=IndPeriod_WarmUp,IndPeriod_Run=IndPeriod_Run,IniStates=IniStates,IniResLevels=IniResLevels,
Outputs_Cal=Outputs_Cal,Outputs_Sim=Outputs_Sim);
if("CemaNeige" %in% ObjectClass){
RunOptions <- c(RunOptions,list(RunSnowModule=RunSnowModule,MeanAnSolidPrecip=MeanAnSolidPrecip)); }
RunOptions <- c(RunOptions,list(MeanAnSolidPrecip=MeanAnSolidPrecip)); }
class(RunOptions) <- c("RunOptions",ObjectClass);
return(RunOptions);
......
......@@ -47,7 +47,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
##SNOW_MODULE________________________________________________________________________________##
if(RunOptions$RunSnowModule==TRUE){
if(inherits(RunOptions,"CemaNeige")==TRUE){
if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige));
} else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); }
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers";
......@@ -87,7 +87,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
} ###ENDFOR_iLayer
names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep="");
} ###ENDIF_RunSnowModule
if(RunOptions$RunSnowModule==FALSE){
if(inherits(RunOptions,"CemaNeige")==FALSE){
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL;
CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; }
......@@ -130,7 +130,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
verbose = FALSE)
}
if(RunOptions$RunSnowModule & "Precip" %in% RunOptions$Outputs_Sim){ RESULTS$Outputs[,which(FortranOutputsMod[IndOutputsMod]=="Precip")] <- InputsModel$Precip[IndPeriod1]; }
if(inherits(RunOptions,"CemaNeige")==TRUE & "Precip" %in% RunOptions$Outputs_Sim){ RESULTS$Outputs[,which(FortranOutputsMod[IndOutputsMod]=="Precip")] <- InputsModel$Precip[IndPeriod1]; }
##Output_data_preparation
##OutputsModel_only
......
......@@ -47,7 +47,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
##SNOW_MODULE________________________________________________________________________________##
if(RunOptions$RunSnowModule==TRUE){
if(inherits(RunOptions,"CemaNeige")==TRUE){
if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige));
} else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); }
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers";
......@@ -86,7 +86,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
} ###ENDFOR_iLayer
names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep="");
} ###ENDIF_RunSnowModule
if(RunOptions$RunSnowModule==FALSE){
if(inherits(RunOptions,"CemaNeige")==FALSE){
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL;
CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; }
......@@ -129,7 +129,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
verbose = FALSE)
}
if(RunOptions$RunSnowModule & "Precip" %in% RunOptions$Outputs_Sim){ RESULTS$Outputs[,which(FortranOutputsMod[IndOutputsMod]=="Precip")] <- InputsModel$Precip[IndPeriod1]; }
if(inherits(RunOptions,"CemaNeige")==TRUE & "Precip" %in% RunOptions$Outputs_Sim){ RESULTS$Outputs[,which(FortranOutputsMod[IndOutputsMod]=="Precip")] <- InputsModel$Precip[IndPeriod1]; }
##Output_data_preparation
##OutputsModel_only
......
......@@ -52,7 +52,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
##SNOW_MODULE________________________________________________________________________________##
if(RunOptions$RunSnowModule==TRUE){
if(inherits(RunOptions,"CemaNeige")==TRUE){
if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige));
} else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); }
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers";
......@@ -91,7 +91,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
} ###ENDFOR_iLayer
names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep="");
} ###ENDIF_RunSnowModule
if(RunOptions$RunSnowModule==FALSE){
if(inherits(RunOptions,"CemaNeige")==FALSE){
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL;
CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; }
......@@ -135,7 +135,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
verbose = FALSE)
}
if(RunOptions$RunSnowModule & "Precip" %in% RunOptions$Outputs_Sim){ RESULTS$Outputs[,which(FortranOutputsMod[IndOutputsMod]=="Precip")] <- InputsModel$Precip[IndPeriod1]; }
if(inherits(RunOptions,"CemaNeige")==TRUE & "Precip" %in% RunOptions$Outputs_Sim){ RESULTS$Outputs[,which(FortranOutputsMod[IndOutputsMod]=="Precip")] <- InputsModel$Precip[IndPeriod1]; }
##Output_data_preparation
##OutputsModel_only
......
......@@ -5,7 +5,7 @@
\usage{
CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
IniStates = NULL, IniResLevels = NULL, Outputs_Cal = NULL,
Outputs_Sim = "all", RunSnowModule = TRUE, MeanAnSolidPrecip = NULL,
Outputs_Sim = "all", RunSnowModule, MeanAnSolidPrecip = NULL,
verbose = TRUE)
}
\arguments{
......@@ -26,8 +26,9 @@ CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
\item{Outputs_Sim}{(optional) [character] vector giving the requested outputs \cr (e.g. c("DatesR", "Qsim", "SnowPack")), default = "all"}
\item{RunSnowModule}{(optional) [boolean] option indicating whether CemaNeige should be activated, \code{default = TRUE}}
\item{RunSnowModule}{(deprecated) [boolean] option indicating whether CemaNeige should be activated. Please adapt \code{FUN_MOD} instead}
\item{MeanAnSolidPrecip}{(optional) [numeric] vector giving the annual mean of average solid precipitation for each layer (computed from InputsModel if not defined) [mm/y]}
\item{verbose}{(optional) [boolean] boolean indicating if the function is run in verbose mode or not, \code{default = TRUE}}
......@@ -41,7 +42,6 @@ CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
\emph{IniResLevels } \tab [numeric] vector of initial filling rates for production and routing stores [-] and level fothe the exponential store for GR6J [mm]\cr
\emph{Outputs_Cal } \tab [character] character vector giving only the outputs needed for the calibration \cr
\emph{Outputs_Sim } \tab [character] character vector giving the requested outputs \cr
\emph{RunSnowModule } \tab [boolean] option indicating whether CemaNeige should be activated \cr
\emph{MeanAnSolidPrecip} \tab [numeric] vector giving the annual mean of average solid precipitation for each layer [mm/y] \cr
}
}
......
Markdown is supported
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