diff --git a/DESCRIPTION b/DESCRIPTION index 5565241621aaed2484ef0bfd919379c7f4aba2ef..5a8c4b47ab9aae04a238d1171cc06bcf3b0bd8e0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.6.3.9 +Version: 1.6.3.10 Date: 2020-10-14 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NEWS.md b/NEWS.md index e229e4cb9bcd3263de69c9eaed5afa09721bfd7f..8a95f801e0088c50cf5effaede52482881947072 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ ## Release History of the airGR Package -### 1.6.3.9 Release Notes (2020-10-14) +### 1.6.3.10 Release Notes (2020-10-14) #### New features diff --git a/vignettes/V05_sd_model.Rmd b/vignettes/V05_sd_model.Rmd index e185cca344c2839275ac282d0778bd3c72c86c2a..5e814abc10a965416d4aef1a78e95bb6631893b1 100644 --- a/vignettes/V05_sd_model.Rmd +++ b/vignettes/V05_sd_model.Rmd @@ -1,5 +1,6 @@ --- title: "Simulating a reservoir with semi-distributed GR4J model" +author: "David Dorchies" bibliography: V00_airgr_ref.bib output: rmarkdown::html_vignette vignette: > @@ -20,7 +21,7 @@ library(imputeTS) The **airGR** package implements semi-distributed model capabilities using a lag model between subcatchments. It allows to chain together several lumped models as well as integrating anthropogenic influence such as reservoirs or withdrawals. -`RunModel_LAG` documentation gives an example of simulating the influence of a reservoir in a lumped model. Try `example(RunModel_LAG)` to get it. +`RunModel_Lag` documentation gives an example of simulating the influence of a reservoir in a lumped model. Try `example(RunModel_Lag)` to get it. In this vignette, we show how to calibrate 2 sub-catchments in series with a semi-distributed model consisting of 2 GR4J models. For doing this we compare two strategies for calibrating the downstream subcatchment: @@ -64,18 +65,18 @@ The operations are exactly the same as the ones for a GR4J lumped model. So we d ```{r} InputsModelUp <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR, - Precip = BasinObs$P, PotEvap = BasinObs$E) + Precip = BasinObs$P, PotEvap = BasinObs$E) Ind_Run <- seq(which(format(BasinObs$DatesR, format = "%Y-%m-%d") == "1990-01-01"), which(format(BasinObs$DatesR, format = "%Y-%m-%d") == "1999-12-31")) RunOptionsUp <- CreateRunOptions(FUN_MOD = RunModel_GR4J, - InputsModel = InputsModelUp, IndPeriod_Run = Ind_Run, - IniStates = NULL, IniResLevels = NULL, IndPeriod_WarmUp = NULL) + InputsModel = InputsModelUp, IndPeriod_Run = Ind_Run, + IniStates = NULL, IniResLevels = NULL, IndPeriod_WarmUp = NULL) InputsCritUp <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModelUp, - RunOptions = RunOptionsUp, VarObs = "Q", Obs = BasinObs$Qmm[Ind_Run]) + RunOptions = RunOptionsUp, VarObs = "Q", Obs = BasinObs$Qmm[Ind_Run]) CalibOptionsUp <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel) OutputsCalibUp <- Calibration_Michel(InputsModel = InputsModelUp, RunOptions = RunOptionsUp, - InputsCrit = InputsCritUp, CalibOptions = CalibOptionsUp, - FUN_MOD = RunModel_GR4J) + InputsCrit = InputsCritUp, CalibOptions = CalibOptionsUp, + FUN_MOD = RunModel_GR4J) ``` And see the result of the simulation: @@ -88,7 +89,7 @@ OutputsModelUp <- RunModel_GR4J(InputsModel = InputsModelUp, RunOptions = RunOpt # Calibration of the downstream subcatchment with upstream flow observations -Observed flow data contain `NA` values and a complete time series is mandatory for running the LAG model. We propose to complete the observed upstream flow with linear interpolation: +Observed flow data contain `NA` values and a complete time series is mandatory for running the Lag model. We propose to complete the observed upstream flow with linear interpolation: ```{r} QObsUp <- imputeTS::na_interpolation(BasinObs$Qmm) @@ -106,14 +107,14 @@ InputsModelDown1 <- CreateInputsModel( ) ``` -And then calibrate the combination of LAG model for upstream flow transfer and GR4J model for the runoff of the downstream subcatchment: +And then calibrate the combination of Lag model for upstream flow transfer and GR4J model for the runoff of the downstream subcatchment: ```{r} RunOptionsDown <- CreateRunOptions(FUN_MOD = RunModel_GR4J, - InputsModel = InputsModelDown1, IndPeriod_Run = Ind_Run, - IniStates = NULL, IniResLevels = NULL, IndPeriod_WarmUp = NULL) + InputsModel = InputsModelDown1, IndPeriod_Run = Ind_Run, + IniStates = NULL, IniResLevels = NULL, IndPeriod_WarmUp = NULL) InputsCritDown <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModelDown1, - RunOptions = RunOptionsDown, VarObs = "Q", Obs = QObsDown[Ind_Run]) + RunOptions = RunOptionsDown, VarObs = "Q", Obs = QObsDown[Ind_Run]) CalibOptionsDown <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel, IsSD = TRUE) # Don't forget to specify that it's an SD model here @@ -129,7 +130,7 @@ InputsModelDown2 <- InputsModelDown1 InputsModelDown2$Qupstream[Ind_Run] <- OutputsModelUp$Qsim ``` -`RunModel` is run in order to automatically combine GR4J and LAG models. +`RunModel` is run in order to automatically combine GR4J and Lag models. ```{r} OutputsModelDown1 <- RunModel(InputsModel = InputsModelDown2, @@ -159,22 +160,22 @@ ParamDown2 <- OutputsCalibDown2$ParamFinalR # Discussion -## Identification of LAG parameter +## Identification of Lag parameter The theoretical LAG parameter should be equal to: ```{r} -LAG <- InputsModelDown1$LengthHydro / (2 * 86400) -paste(format(LAG), "m/s") +Lag <- InputsModelDown1$LengthHydro / (2 * 86400) +paste(format(Lag), "m/s") ``` Both calibrations overestimate this parameter: ```{r} -mLag <- matrix(c(LAG, OutputsCalibDown1$ParamFinalR[1], OutputsCalibDown2$ParamFinalR[1]), ncol = 1) +mLag <- matrix(c(Lag, OutputsCalibDown1$ParamFinalR[1], OutputsCalibDown2$ParamFinalR[1]), ncol = 1) rownames(mLag) = c("theoretical", "calibrated with observed upstream flow", "calibrated with simulated upstream flow") -colnames(mLag) = c("LAG parameter") +colnames(mLag) = c("Lag parameter") knitr::kable(mLag) ``` @@ -183,7 +184,7 @@ knitr::kable(mLag) Theoretically, the parameters of the downstream GR4J model should be the same as the upstream one and we know the lag time. So this set of parameter should give a better performance criteria: ```{r} -ParamDownTheo <- c(LAG, OutputsCalibUp$ParamFinalR) +ParamDownTheo <- c(Lag, OutputsCalibUp$ParamFinalR) OutputsModelDownTheo <- RunModel(InputsModel = InputsModelDown2, RunOptions = RunOptionsDown, Param = ParamDownTheo, @@ -200,7 +201,7 @@ comp <- matrix(c(0, OutputsCalibUp$ParamFinalR, rep(OutputsCalibDown1$ParamFinal OutputsCalibDown2$ParamFinalR, ParamDownTheo), ncol = 5, byrow = TRUE) comp <- cbind(comp, c(OutputsCalibUp$CritFinal, OutputsCalibDown1$CritFinal, CritDown1$CritValue, OutputsCalibDown2$CritFinal, CritDownTheo$CritValue)) -colnames(comp) <- c("LAG", paste0("x", 1:4), "NSE") +colnames(comp) <- c("Lag", paste0("x", 1:4), "NSE") rownames(comp) <- c("Calibration of the upstream subcatchment", "Calibration 1 with observed upstream flow", "Validation 1 with simulated upstream flow",