CreateRunOptions.R 16.45 KiB
CreateRunOptions <- function(FUN_MOD, InputsModel, IndPeriod_WarmUp = NULL, IndPeriod_Run,
                             IniStates = NULL, IniResLevels = NULL, 
                             Outputs_Cal = NULL, Outputs_Sim = "all",
                             RunSnowModule, MeanAnSolidPrecip = NULL,
                             warnings = TRUE, verbose = TRUE) {
  if (!missing(RunSnowModule)) {
    warning("argument RunSnowModule is deprecated; please adapt FUN_MOD instead.", call. = FALSE)
  ObjectClass <- NULL
  ##check_FUN_MOD
  BOOL <- FALSE;
  if (identical(FUN_MOD, RunModel_GR4H)) {
    ObjectClass <- c(ObjectClass, "GR", "hourly")
    BOOL <- TRUE
  if (identical(FUN_MOD, RunModel_GR4J) | identical(FUN_MOD, RunModel_GR5J) | identical(FUN_MOD, RunModel_GR6J)) {
    ObjectClass <- c(ObjectClass, "GR", "daily")
    BOOL <- TRUE
  if (identical(FUN_MOD, RunModel_GR2M)) {
    ObjectClass <- c(ObjectClass, "GR", "monthly")
    BOOL <- TRUE
  if (identical(FUN_MOD, RunModel_GR1A)) {
    ObjectClass <- c(ObjectClass, "GR", "yearly")
    BOOL <- TRUE
  if (identical(FUN_MOD, RunModel_CemaNeige)) {
    ObjectClass <- c(ObjectClass, "CemaNeige", "daily")
    BOOL <- TRUE
  if (identical(FUN_MOD, RunModel_CemaNeigeGR4J) | identical(FUN_MOD, RunModel_CemaNeigeGR5J) | identical(FUN_MOD, RunModel_CemaNeigeGR6J)) {
    ObjectClass <- c(ObjectClass, "GR", "CemaNeige", "daily")
    BOOL <- TRUE
  if (!BOOL) {
    stop("incorrect FUN_MOD for use in CreateRunOptions \n")
    return(NULL)
  ##check_InputsModel
  if (!inherits(InputsModel, "InputsModel")) {
    stop("InputsModel must be of class 'InputsModel' \n")
    return(NULL)
  if ("GR" %in% ObjectClass & !inherits(InputsModel, "GR")) {
    stop("InputsModel must be of class 'GR' \n")
    return(NULL)
  if ("CemaNeige" %in% ObjectClass &
      !inherits(InputsModel, "CemaNeige")) {
    stop("InputsModel must be of class 'CemaNeige' \n")
    return(NULL)
  if ("hourly" %in% ObjectClass &
      !inherits(InputsModel, "hourly")) {
    stop("InputsModel must be of class 'hourly' \n")
    return(NULL)
  if ("daily" %in% ObjectClass & !inherits(InputsModel, "daily")) {
    stop("InputsModel must be of class 'daily' \n")
    return(NULL)
  if ("monthly" %in% ObjectClass &
      !inherits(InputsModel, "monthly")) {
    stop("InputsModel must be of class 'monthly' \n")
    return(NULL)