knitr::opts_chunk$set(echo = TRUE)

The aim of this vignette is to perform a first calibration of the semi-distributed hydrological model, using naturalized discharge.

Loading libraries, network and time series data

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

library(airGRiwrm)
load("_cache/V01.RData")
load("_cache/V02.RData")
library(seinebasin)
data(QNAT)

InputsCrit object

We need then to prepare the InputsCrit object that is necessary to define the calibration objective function. We chose here the KGE' criterion:

InputsCrit <- CreateInputsCrit(
  InputsModel = InputsModel,
  FUN_CRIT = ErrorCrit_KGE2,
  RunOptions = RunOptions,
  Obs = Qnat[IndPeriod_Run,]
)
str(InputsCrit)

GRiwrmCalibOptions object

CalibOptions <- CreateCalibOptions(InputsModel)
str(CalibOptions)

Calibration

The optimization (i.e. calibration) of parameters can now be performed:

OutputsCalib <- Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions)

Run the GR4J model with parameters obtained from the Michel calibration

Now that the model is calibrated, we can run it with the optimized parameter values:

ParamMichel <- extractParam(OutputsCalib)

OutputsModels <- RunModel(
  InputsModel,
  RunOptions = RunOptions,
  Param = ParamMichel
)

Plot the result for each basin

plot(OutputsModels, Qobs = Qnat[IndPeriod_Run,])

Save calibration data for next vignettes

save(ParamMichel, file = "_cache/V03.RData")


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