Load libraries

Load parameters of GR4 run-off model

Loading network and time series data

Run vignette("01_First_network", package = "airGRiwrm") before this one in order to create the Rdata file loaded below:

load("_cache/V01.RData")

Loading

Data comes from calibration of ClimAware project with naturalised flows.

library(seinebasin)
data(ClimAwareParams)
ClimAwareParams
##      id_sgl Tau0   K0     S     IGF     KR    T NashId
## 1  TRANN_01  0.0  0.0 244.0    0.00   90.4  5.4  92.20
## 2  LASSI_20  0.0  0.0 228.3   -1.56   87.0  3.6  82.15
## 3  ARCIS_24 47.5  0.0  75.7  -33.33  667.3 11.7  98.40
## 4  BAR-S_06  0.0  0.0 279.8    0.00   86.5  5.2  91.28
## 5  MERY-_22 63.1  0.0 107.2  -32.47  590.3  3.1  97.31
## 6  NOGEN_13 48.0  0.0  85.0  -48.96  814.1 15.0  98.53
## 7  CHAUM_07  0.0  0.0 367.0    0.00  187.2  1.2  88.84
## 8  CUSSY_08  0.0  0.0  98.4   -4.40  419.8  2.1  74.62
## 9  STGER_09  0.0  0.0 404.8    0.00  174.3  1.1  89.10
## 10 GURGY_02 49.1  0.0 525.6   -4.59  144.6  0.0  91.46
## 11 AISY-_11  0.0  0.0 138.7   -3.72  116.0  2.3  82.50
## 12 BRIEN_03 15.5  0.0 295.1    0.00   72.6  4.6  94.16
## 13 GUILL_10  0.0  0.0 169.4   -5.91  107.2  2.0  77.22
## 14 CHABL_12 24.5  0.0 250.8  -42.80  553.3  0.0  82.68
## 15 COURL_23 25.1  0.0   1.0 -100.00 1759.8 15.0  97.85
## 16 MONTE_15 48.0  0.0 367.9 -100.00  976.2  0.5  99.57
## 17 EPISY_14  0.0  0.0   1.0  -63.15  757.1  3.0  53.79
## 18 ALFOR_16  5.1  0.0 250.8  -37.11  710.3  0.8  98.54
## 19 STDIZ_04  0.0  0.0 217.0   -0.20   78.2  3.5  90.42
## 20 VITRY_25  0.0  0.0 242.7   -1.78  109.2  4.3  91.83
## 21 LOUVE_19  0.0  0.0 197.6   -1.36   95.2  3.2  84.38
## 22 CHALO_21 48.0  0.0 616.1   -4.73  216.7  7.5  98.98
## 23 MONTR_18  0.0  0.0  20.6  -21.68  665.5  2.0  53.10
## 24 NOISI_17 36.4 57.6  26.2  -95.21 1568.5  4.2  96.68
## 25 PARIS_05 12.0  0.0 750.3 -100.00  921.0  0.0  99.82

The lag \(\tau_0\) and route \(K_0\) parameters of TGR are expressed as time delay in hours corresponding to the delay time between the farest upstream inlet and the outlet of the sub-basin. Almost all sub basin has only a lag parameter. The only exception is for La Marne à Noisiel (NOISI_17) that has a routing parameter which can be approximated to a single lag parameter equals to \(\tau_0 + K_0\).

This lag parameter has to be converted in a speed in m/s used in the airGR lag model:

# Convert TGR routing parameter into speed
params <- merge(griwrm, ClimAwareParams, by.x = "id", by.y = "id_sgl")

ParamClimAware <- sapply(griwrm$id, function(id) {
  nodeParam <- ClimAwareParams[ClimAwareParams$id_sgl == id,]
  # Record hydrological model parameters
  Param <- unlist(nodeParam[c("S", "IGF", "KR", "T")])
  # Add lag model parameter if upstream nodes exist
  UpstrNodes <- which(griwrm$down == id & !is.na(griwrm$down))
  if(length(UpstrNodes) > 0) {
    maxLength <- max(griwrm$length[UpstrNodes])
    Param <- c(
      maxLength * 1000 / ((nodeParam$Tau0 + nodeParam$K0) * 3600),
      Param
    )
  }
  return(Param)
})

GriwmRunOptions object

The CreateRunOptions() function allows to prepare the options required to the RunModel() function.

The user must at least define the following arguments:

  • InputsModel: the associated input data
  • IndPeriod_Run: the period on which the model is run
IndPeriod_Run <- seq(
  which(InputsModel[[1]]$DatesR == (InputsModel[[1]]$DatesR[1] + 365*24*60*60)), # Set aside warm-up period
  length(InputsModel[[1]]$DatesR) # Until the end of the time series
)

The warmup period could also be defined as is:

IndPeriod_WarmUp = seq(1,IndPeriod_Run[1]-1)
RunOptions <- CreateRunOptions(
  InputsModel = InputsModel,
  IndPeriod_WarmUp = IndPeriod_WarmUp,
  IndPeriod_Run = IndPeriod_Run
)

Run the SD model for the whole basin

OutputsModelsClimAware <- RunModel(
  InputsModel,
  RunOptions = RunOptions,
  Param = ParamClimAware
)
## RunModel.GRiwrmInputsModel: Treating sub-basin TRANN_01...
## RunModel.GRiwrmInputsModel: Treating sub-basin STDIZ_04...
## RunModel.GRiwrmInputsModel: Treating sub-basin BAR-S_06...
## RunModel.GRiwrmInputsModel: Treating sub-basin CHAUM_07...
## RunModel.GRiwrmInputsModel: Treating sub-basin CUSSY_08...
## RunModel.GRiwrmInputsModel: Treating sub-basin STGER_09...
## RunModel.GRiwrmInputsModel: Treating sub-basin GUILL_10...
## RunModel.GRiwrmInputsModel: Treating sub-basin AISY-_11...
## RunModel.GRiwrmInputsModel: Treating sub-basin EPISY_14...
## RunModel.GRiwrmInputsModel: Treating sub-basin MONTR_18...
## RunModel.GRiwrmInputsModel: Treating sub-basin LOUVE_19...
## RunModel.GRiwrmInputsModel: Treating sub-basin LASSI_20...
## RunModel.GRiwrmInputsModel: Treating sub-basin VITRY_25...
## RunModel.GRiwrmInputsModel: Treating sub-basin MERY-_22...
## RunModel.GRiwrmInputsModel: Treating sub-basin GURGY_02...
## Warning in FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param[iFirstParamRunOffModel:length(Param)], : Param[4] (X4: unit hydrograph time constant [d]) < 0.50
##  X4 set to 0.50
## RunModel.GRiwrmInputsModel: Treating sub-basin CHABL_12...
## Warning in FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param[iFirstParamRunOffModel:length(Param)], : Param[4] (X4: unit hydrograph time constant [d]) < 0.50
##  X4 set to 0.50
## RunModel.GRiwrmInputsModel: Treating sub-basin BRIEN_03...
## RunModel.GRiwrmInputsModel: Treating sub-basin ARCIS_24...
## RunModel.GRiwrmInputsModel: Treating sub-basin CHALO_21...
## RunModel.GRiwrmInputsModel: Treating sub-basin COURL_23...
## RunModel.GRiwrmInputsModel: Treating sub-basin NOISI_17...
## RunModel.GRiwrmInputsModel: Treating sub-basin NOGEN_13...
## RunModel.GRiwrmInputsModel: Treating sub-basin MONTE_15...
## RunModel.GRiwrmInputsModel: Treating sub-basin ALFOR_16...
## RunModel.GRiwrmInputsModel: Treating sub-basin PARIS_05...
## Warning in FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param[iFirstParamRunOffModel:length(Param)], : Param[4] (X4: unit hydrograph time constant [d]) < 0.50
##  X4 set to 0.50

Save data for next vignettes

save(RunOptions, ParamClimAware, IndPeriod_Run, file = "_cache/V02.RData")

Plot the result for each basin

data(QNAT)
plot(OutputsModelsClimAware, Qobs = Qnat[IndPeriod_Run,])

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL
## 
## [[10]]
## NULL
## 
## [[11]]
## NULL
## 
## [[12]]
## NULL
## 
## [[13]]
## NULL
## 
## [[14]]
## NULL
## 
## [[15]]
## NULL
## 
## [[16]]
## NULL
## 
## [[17]]
## NULL
## 
## [[18]]
## NULL
## 
## [[19]]
## NULL
## 
## [[20]]
## NULL
## 
## [[21]]
## NULL
## 
## [[22]]
## NULL
## 
## [[23]]
## NULL
## 
## [[24]]
## NULL
## 
## [[25]]
## NULL