knitr::opts_chunk$set(echo = TRUE)
library(airGRiwrm)

The example below is inspired by the semi-distributed model developed in the ClimAware project [@theobaldClimAwareImpactsClimate2014a], in which we used the daily rainfall-runoff model GR4J.

The aim of this vignette is to create the semi-distributed network necessary for the hydrological model.

Semi-distributed network description

The model is distributed according to the gauging stations described in @dorchiesClimateChangeImpacts2014.

First, we must read the list of nodes and the associated metadata:

seine_nodes <- read.table(
  file = system.file("seine_data", "network_gauging_stations.txt", package = "seinebasin"),
  sep = ";", header = TRUE, fileEncoding = "UTF-8", quote = "\"", stringsAsFactors = FALSE
)
seine_nodes

Using that information, we must create the GRiwrm object that lists the nodes and describes the network diagram. It is a dataframe of class GRiwrm with specific column names:

The CreateGRiwrm function helps to rename the columns of the dataframe and assign the variable classes.

seine_nodes$id_aval[seine_nodes$id_aval == ""] <- NA
seine_nodes$distance_aval <- as.double(seine_nodes$distance_aval) / 1000
seine_nodes$model <- "RunModel_GR4J"
# Generate the GRiwrm object
griwrm <- CreateGRiwrm(seine_nodes,
                       list(id = "id_sgl",
                            down = "id_aval",
                            length = "distance_aval"))
griwrm

The diagram of the network structure is represented below with in blue the upstream nodes with a GR4J model and in green the intermediate nodes with an SD (GR4J + LAG) model.

plot(griwrm)

Observation time series

The daily mean precipitation and potential evaporation at the scale of the intermediate sub-basins are extracted from the SAFRAN reanalysis [@vidal50yearHighresolutionAtmospheric2010].

The daily naturalized flow is provided by @hydratecActualisationBaseDonnees2011a.

These data are embedded in the R package 'seinebasin', which is not publicly available.

library(seinebasin)
data(QNAT)

Generate the GRiwrm InputsModel object

The GRiwrm InputsModel object is a list of airGR InputsModel objects. The identifier of the sub-basin is used as a key in the list, which is ordered from upstream to downstream.

The airGR CreateInputsModel function is extended in order to handle the GRiwrm object that describes the basin diagram:

InputsModel <- CreateInputsModel(griwrm, DatesR, Precip, PotEvap)

Save data for next vignettes

dir.create("_cache", showWarnings = FALSE)
save(seine_nodes, griwrm, InputsModel, file = "_cache/V01.RData")

References



inrae/airGRiwrm documentation built on Sept. 27, 2024, 6:08 p.m.