diff --git a/vignettes/V04_Closed-loop_regulated_withdrawal.Rmd b/vignettes/V04_Closed-loop_regulated_withdrawal.Rmd index 0c0ae44cc95dcbb09c8a947e311b452ebf55daa5..827e0e01720d555753d5c3749204d79f6b1d3403 100644 --- a/vignettes/V04_Closed-loop_regulated_withdrawal.Rmd +++ b/vignettes/V04_Closed-loop_regulated_withdrawal.Rmd @@ -31,6 +31,8 @@ library(airGRiwrm) Starting from the network and the calibration set in the vignette "V03_Open-loop_influenced_flow", we add 2 intake points for irrigation. +## Network configuration + The following code chunk resumes the procedure of the vignette "V03_Open-loop_influenced_flow": ```{r load_cache} @@ -38,35 +40,40 @@ data(Severn) nodes <- Severn$BasinsInfo[, c("gauge_id", "downstream_id", "distance_downstream", "area")] nodes$distance_downstream <- nodes$distance_downstream nodes$model <- "RunModel_GR4J" -griwrm <- CreateGRiwrm(nodes, list(id = "gauge_id", down = "downstream_id", length = "distance_downstream")) -griwrmV03 <- griwrm -griwrmV03$model[griwrm$id == "54002"] <- NA -griwrmV03$model[griwrm$id == "54095"] <- NA -griwrmV03 +nodes$model[nodes$gauge_id == "54002"] <- NA +nodes$model[nodes$gauge_id == "54001"] <- NA ``` -## Network configuration - The intake points are located: - on the Severn at 35 km upstream Bewdley (Gauging station '54001'); - on the Severn at 10 km upstream Saxons Lode (Gauging station '54032'). -We have to add this 2 nodes in the `GRiwrm` object that describes the network: +We have to add this 2 nodes in the network: -```{r griwrm} -griwrmV04 <- rbind( - griwrmV03, +```{r updated_nodes} +nodes <- rbind( + nodes, data.frame( - id = c("Irrigation1", "Irrigation2"), - down = c("54001", "54032"), - length = c(35, 10), + gauge_id = c("Irrigation1", "Irrigation2"), + downstream_id = c("54001", "54032"), + distance_downstream = c(35, 10), model = NA, area = NA ) ) + +nodes + +``` + +And we create the `GRiwrm` object from this new network: + +```{r griwm} +griwrmV04 <- CreateGRiwrm(nodes, list(id = "gauge_id", down = "downstream_id", length = "distance_downstream")) plot(griwrmV04) ``` + Blue-grey nodes figure upstream basins (rainfall-runoff modeling only) and green nodes figure intermediate basins, coupling rainfall-runoff and hydraulic routing modeling. Nodes in red color are direct injection points (positive or negative flow) in the model. @@ -85,8 +92,8 @@ DatesR <- BasinsObs[[1]]$DatesR PrecipTot <- cbind(sapply(BasinsObs, function(x) {x$precipitation})) PotEvapTot <- cbind(sapply(BasinsObs, function(x) {x$peti})) Qobs <- cbind(sapply(BasinsObs, function(x) {x$discharge_spec})) -Precip <- ConvertMeteoSD(griwrm, PrecipTot) -PotEvap <- ConvertMeteoSD(griwrm, PotEvapTot) +Precip <- ConvertMeteoSD(griwrmV04, PrecipTot) +PotEvap <- ConvertMeteoSD(griwrmV04, PotEvapTot) # Calculation of the water need at the sub-basin scale dailyWaterNeed <- PotEvap - Precip