Skip to content

Commit

Permalink
feat(plot.OutputsModelReservoir): add argument checks
Browse files Browse the repository at this point in the history
Refs #90
  • Loading branch information
David committed Jul 31, 2024
1 parent c0d9066 commit c2b04ea
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/RunModel_Reservoir.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' The reservoir model is a model combining a lag model and the calculation of
#' the water storage time series according to the released flow time series
#' from the `Qinf` parameter of [CreateInputsModel.GRiwrm].
#' from the `Qrelease` parameter of [CreateInputsModel.GRiwrm].
#'
#' @details
#' The simulated flow corresponds to the released flow except when the reservoir
Expand Down
8 changes: 8 additions & 0 deletions R/plot.OutputsModelReservoir.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
#'
#' @example man-examples/RunModel_Reservoir.R
plot.OutputsModelReservoir <- function(x, Qobs = NULL, ...) {

# Argument checks
if (!is.null(Qobs)) {
stopifnot(is.numeric(Qobs),
length(Qobs) == length(x$Qsim_m3))

}

oldpar <- par(mfrow=c(2,1),
mar = c(2,3.3,1.2,0.5),
mgp = c(2,1,0))
Expand Down
2 changes: 1 addition & 1 deletion man-examples/RunModel_Reservoir.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ plot(OutputsModel, Qobs = Qobs)
# N.B. "Observed releases" should be considered as "Target releases" here

# The plot for the reservoir can also be plotted alone
plot(OutputsModel$Reservoir)
plot(OutputsModel$Reservoir, Qobs = Qobs[, "Reservoir"])
4 changes: 2 additions & 2 deletions man/RunModel_Reservoir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot.OutputsModelReservoir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c2b04ea

Please sign in to comment.