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.
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:
id
: the identifier of the node in the network.down
: the identifier of the next hydrological node downstream.length
: hydraulic distance to the next hydrological downstream node.model
: Name of the hydrological model used (E.g. "RunModel_GR4J"). NA
for other types of nodes.area
: Area of the sub-catchment (km2). Used for hydrological models such as GR models. NA
if not used.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)
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)
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)
dir.create("_cache", showWarnings = FALSE) save(seine_nodes, griwrm, InputsModel, file = "_cache/V01.RData")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.