RunModel.GR.R 842 Bytes
Newer Older
#' Run of a rainfall-runoff model on a sub-basin
#'
#' @inherit airGR::RunModel
#' @param x \[object of class `InputsModel`\] `InputsModel` for [airGR::RunModel]
#' @param ... further arguments passed to or from other methods
RunModel.GR <- function(x, RunOptions, Param, ...) {
    # Lag model take one parameter at the beginning of the vector
    iFirstParamRunOffModel <- 2
    RunOptions$FeatFUN_MOD$NbParam <- RunOptions$FeatFUN_MOD$NbParam - 1
  } else {
    # All parameters
    iFirstParamRunOffModel <- 1
  }

  OutputsModel <- FUN_MOD(x, RunOptions = RunOptions,
          Param = Param[iFirstParamRunOffModel:length(Param)])
  # Add Qsim_m3 in m3/timestep
  OutputsModel$Qsim_m3 <- OutputsModel$Qsim * sum(x$BasinAreas) * 1e3

  return(OutputsModel)