From 088a5ddbfedba5572b9cf4229fdc31a9920fc078 Mon Sep 17 00:00:00 2001 From: Dorchies David <david.dorchies@irstea.fr> Date: Wed, 27 May 2020 12:09:52 +0200 Subject: [PATCH] v1.6.1.13 feat: SD LenghtHydro in meters instead of km Refs #34 in particular https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/34#note_20648 --- DESCRIPTION | 4 ++-- R/RunModel.R | 2 +- tests/testthat/test-RunModel_LAG.R | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 66d5146b..84f1b2f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.6.1.13 -Date: 2020-05-22 +Version: 1.6.1.14 +Date: 2020-05-27 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"), diff --git a/R/RunModel.R b/R/RunModel.R index 496a3d53..3fc49636 100644 --- a/R/RunModel.R +++ b/R/RunModel.R @@ -18,7 +18,7 @@ RunModel <- function (InputsModel, RunOptions, Param, FUN_MOD) { AreaTot <- sum(InputsModel$BasinAreas) # propagation time from upstream meshes to outlet - PT <- InputsModel$LengthHydro[1, ] * 1000 / Param[length(Param)] / TimeStep + PT <- InputsModel$LengthHydro[1, ] / Param[length(Param)] / TimeStep HUTRANS <- rbind(1 - (PT - floor(PT)), PT - floor(PT)) NbUpBasins <- length(InputsModel$LengthHydro) diff --git a/tests/testthat/test-RunModel_LAG.R b/tests/testthat/test-RunModel_LAG.R index 0cb38307..3876ba9b 100644 --- a/tests/testthat/test-RunModel_LAG.R +++ b/tests/testthat/test-RunModel_LAG.R @@ -42,7 +42,7 @@ InputsModel <- CreateInputsModel( Precip = BasinObs$P, PotEvap = BasinObs$E, QobsUpstr = matrix(QobsUpstr, ncol = 1), - LengthHydro = matrix(c(1), nrow = 1), + LengthHydro = matrix(c(1000), nrow = 1), BasinAreas = matrix(c( BasinInfo$BasinArea * 2, BasinInfo$BasinArea ), nrow = 1) @@ -96,7 +96,7 @@ test_that( } ) -ParamSD = c(Param, InputsModel$LengthHydro * 1000 / (24 * 60 * 60)) +ParamSD = c(Param, InputsModel$LengthHydro / (24 * 60 * 60)) # Speed corresponding to one time step delay OutputsSD <- RunModel(InputsModel, RunOptions, Param = ParamSD, FUN_MOD = RunModel_GR4J) -- GitLab