Commit 70e1f185 authored by Dorchies David's avatar Dorchies David
Browse files

fix (SeriesAggreg2): irrelevant warnings with InputsModel/Cemaneige object on obsolete arguments

- Add test case
- Replace missing arguments by default NULL arguments.

Refs #41
parent 42e581c4
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.8.8
Version: 1.6.8.9
Date: 2020-11-20
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
SeriesAggreg2.InputsModel <- function(TabSeries,
Format,
TimeFormat,
NewTimeFormat,
TimeFormat = NULL,
NewTimeFormat = NULL,
YearFirstMonth = 1, TimeLag = 0,
verbose = TRUE, ..., simplify = FALSE) {
......
SeriesAggreg2 <- function(TabSeries,
Format, TimeFormat, NewTimeFormat,
Format, TimeFormat = NULL, NewTimeFormat = NULL,
YearFirstMonth = 1, TimeLag = 0,
verbose = TRUE,
...) {
......@@ -7,14 +7,14 @@ SeriesAggreg2 <- function(TabSeries,
}
SeriesAggreg2.data.frame <- function(TabSeries, Format, TimeFormat, NewTimeFormat,
SeriesAggreg2.data.frame <- function(TabSeries, Format, TimeFormat = NULL, NewTimeFormat = NULL,
YearFirstMonth = 1, TimeLag = 0, verbose = TRUE, ..., ConvertFun) {
## Arguments checks
if (!missing(TimeFormat)) {
if (!is.null(TimeFormat)) {
warning("deprecated 'TimeFormat' argument", call. = FALSE)
}
if (!missing(NewTimeFormat)) {
if (!is.null(NewTimeFormat)) {
if (missing(Format)) {
TimeStep <- c("hourly", "daily", "monthly", "yearly")
NewTimeFormat <- match.arg(NewTimeFormat, choices = TimeStep)
......
SeriesAggreg2.default <- function(TabSeries,
Format,
TimeFormat,
NewTimeFormat,
TimeFormat = NULL,
NewTimeFormat = NULL,
YearFirstMonth = 1, TimeLag = 0,
verbose = TRUE, ..., simplify = FALSE) {
......
context("SeriesAggreg2")
test_that("No warning with InputsModel Cemaneige'", {
## load of catchment data
data(L0123002)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_CemaNeige, DatesR = BasinObs$DatesR,
Precip = BasinObs$P,TempMean = BasinObs$T,
ZInputs = BasinInfo$HypsoData[51], HypsoData=BasinInfo$HypsoData,
NLayers = 5)
expect_warning(
SeriesAggreg2(InputsModel, "%m"),
regexp = NA)
})
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