Commit 4e3fb7b5 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

test(SeriesAggreg): use LengthHydro in km and do not replace NA value in...

test(SeriesAggreg): use LengthHydro in km and do not replace NA value in Qupstream in the use of CreateInputsModel
parent 91eab32a
1 merge request!73Merge branch 'dev' into 'master'
Pipeline #22749 passed with stages
in 9 minutes and 12 seconds
Showing with 4 additions and 6 deletions
+4 -6
......@@ -182,24 +182,22 @@ test_that("Check SeriesAggreg.outputsModel", {
})
test_that("Check data.frame handling in SeriesAggreg.list", {
QObsUp <- imputeTS::na_interpolation(BasinObs$Qmm)
InputsModelDown1 <- CreateInputsModel(
FUN_MOD = RunModel_GR4J,
DatesR = BasinObs$DatesR,
Precip = BasinObs$P,
PotEvap = BasinObs$E,
Qupstream = matrix(QObsUp, ncol = 1),
Qupstream = matrix(BasinObs$Qmm, ncol = 1),
# Upstream observed flow
LengthHydro = 100 * 1000,
# Distance between upstream catchment outlet and the downstream one in m
LengthHydro = 100,
# Distance between upstream catchment outlet and the downstream one in km
BasinAreas = c(180, 180) # Upstream and downstream areas in km²
)
expect_warning(SeriesAggreg(InputsModelDown1, "%Y%m"),
regexp = NA)
I2 <- SeriesAggreg(InputsModelDown1, "%Y%m")
expect_equal(length(I2$DatesR), nrow(I2$Qupstream))
InputsModelDown1$Qupstream <-
InputsModelDown1$Qupstream[-1, , drop = FALSE] # https://stackoverflow.com/a/7352287/5300212
InputsModelDown1$Qupstream <- InputsModelDown1$Qupstream[-1, , drop = FALSE]
expect_warning(SeriesAggreg(InputsModelDown1, "%Y%m"),
regexp = "it will be ignored in the aggregation")
})
......
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