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

v1.0.9.10 argument RunSnowModule deprecated in CreateRunOptions #4737

Showing with 20 additions and 25 deletions
+20 -25
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.9.9 Version: 1.0.9.10
Date: 2017-07-11 Date: 2017-07-11
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")), person("Laurent", "Coron", role = c("aut", "trl")),
......
CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run, IniStates = NULL, IniResLevels = NULL, 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 ObjectClass <- NULL
...@@ -234,14 +237,6 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -234,14 +237,6 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
Outputs_Cal <- Outputs_Cal[!duplicated(Outputs_Cal)]; 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 ##check_MeanAnSolidPrecip
if("CemaNeige" %in% ObjectClass & is.null(MeanAnSolidPrecip)){ if("CemaNeige" %in% ObjectClass & is.null(MeanAnSolidPrecip)){
NLayers <- length(InputsModel$LayerPrecip); NLayers <- length(InputsModel$LayerPrecip);
...@@ -265,7 +260,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP ...@@ -265,7 +260,7 @@ CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndP
##check_PliqAndMelt ##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){ if("PliqAndMelt" %in% Outputs_Cal == FALSE & "all" %in% Outputs_Cal == FALSE){
WTxt <- NULL; 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=""); 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 ...@@ -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, RunOptions <- list(IndPeriod_WarmUp=IndPeriod_WarmUp,IndPeriod_Run=IndPeriod_Run,IniStates=IniStates,IniResLevels=IniResLevels,
Outputs_Cal=Outputs_Cal,Outputs_Sim=Outputs_Sim); Outputs_Cal=Outputs_Cal,Outputs_Sim=Outputs_Sim);
if("CemaNeige" %in% ObjectClass){ if("CemaNeige" %in% ObjectClass){
RunOptions <- c(RunOptions,list(RunSnowModule=RunSnowModule,MeanAnSolidPrecip=MeanAnSolidPrecip)); } RunOptions <- c(RunOptions,list(MeanAnSolidPrecip=MeanAnSolidPrecip)); }
class(RunOptions) <- c("RunOptions",ObjectClass); class(RunOptions) <- c("RunOptions",ObjectClass);
return(RunOptions); return(RunOptions);
......
...@@ -47,7 +47,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){ ...@@ -47,7 +47,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
##SNOW_MODULE________________________________________________________________________________## ##SNOW_MODULE________________________________________________________________________________##
if(RunOptions$RunSnowModule==TRUE){ if(inherits(RunOptions,"CemaNeige")==TRUE){
if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige)); if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige));
} else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); } } else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); }
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers"; CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers";
...@@ -87,7 +87,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){ ...@@ -87,7 +87,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
} ###ENDFOR_iLayer } ###ENDFOR_iLayer
names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep=""); names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep="");
} ###ENDIF_RunSnowModule } ###ENDIF_RunSnowModule
if(RunOptions$RunSnowModule==FALSE){ if(inherits(RunOptions,"CemaNeige")==FALSE){
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL; CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL;
CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; } CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; }
...@@ -130,7 +130,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){ ...@@ -130,7 +130,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
verbose = FALSE) 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 ##Output_data_preparation
##OutputsModel_only ##OutputsModel_only
......
...@@ -47,7 +47,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){ ...@@ -47,7 +47,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
##SNOW_MODULE________________________________________________________________________________## ##SNOW_MODULE________________________________________________________________________________##
if(RunOptions$RunSnowModule==TRUE){ if(inherits(RunOptions,"CemaNeige")==TRUE){
if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige)); if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige));
} else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); } } else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); }
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers"; CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers";
...@@ -86,7 +86,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){ ...@@ -86,7 +86,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
} ###ENDFOR_iLayer } ###ENDFOR_iLayer
names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep=""); names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep="");
} ###ENDIF_RunSnowModule } ###ENDIF_RunSnowModule
if(RunOptions$RunSnowModule==FALSE){ if(inherits(RunOptions,"CemaNeige")==FALSE){
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL; CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL;
CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; } CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; }
...@@ -129,7 +129,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){ ...@@ -129,7 +129,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
verbose = FALSE) 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 ##Output_data_preparation
##OutputsModel_only ##OutputsModel_only
......
...@@ -52,7 +52,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){ ...@@ -52,7 +52,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
##SNOW_MODULE________________________________________________________________________________## ##SNOW_MODULE________________________________________________________________________________##
if(RunOptions$RunSnowModule==TRUE){ if(inherits(RunOptions,"CemaNeige")==TRUE){
if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige)); if("all" %in% RunOptions$Outputs_Sim){ IndOutputsCemaNeige <- as.integer(1:length(FortranOutputsCemaNeige));
} else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); } } else { IndOutputsCemaNeige <- which(FortranOutputsCemaNeige %in% RunOptions$Outputs_Sim); }
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers"; CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- "CemaNeigeLayers";
...@@ -91,7 +91,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){ ...@@ -91,7 +91,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
} ###ENDFOR_iLayer } ###ENDFOR_iLayer
names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep=""); names(CemaNeigeLayers) <- paste("Layer",formatC(1:NLayers,width=2,flag="0"),sep="");
} ###ENDIF_RunSnowModule } ###ENDIF_RunSnowModule
if(RunOptions$RunSnowModule==FALSE){ if(inherits(RunOptions,"CemaNeige")==FALSE){
CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL; CemaNeigeLayers <- list(); CemaNeigeStateEnd <- NULL; NameCemaNeigeLayers <- NULL;
CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; } CatchMeltAndPliq <- InputsModel$Precip[IndPeriod1]; }
...@@ -135,7 +135,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){ ...@@ -135,7 +135,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
verbose = FALSE) 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 ##Output_data_preparation
##OutputsModel_only ##OutputsModel_only
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
\usage{ \usage{
CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run, CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
IniStates = NULL, IniResLevels = NULL, Outputs_Cal = NULL, IniStates = NULL, IniResLevels = NULL, Outputs_Cal = NULL,
Outputs_Sim = "all", RunSnowModule = TRUE, MeanAnSolidPrecip = NULL, Outputs_Sim = "all", RunSnowModule, MeanAnSolidPrecip = NULL,
verbose = TRUE) verbose = TRUE)
} }
\arguments{ \arguments{
...@@ -26,8 +26,9 @@ CreateRunOptions(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run, ...@@ -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{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{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}} \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, ...@@ -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{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_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{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 \emph{MeanAnSolidPrecip} \tab [numeric] vector giving the annual mean of average solid precipitation for each layer [mm/y] \cr
} }
} }
......
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