An error occurred while loading the file. Please try again.
-
Dorchies David authoredfa48c8a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateInputsModel.GRiwrm.R
\name{CreateInputsModel.GRiwrm}
\alias{CreateInputsModel.GRiwrm}
\title{Create InputsModel object for a \strong{airGRiwrm} network}
\usage{
\method{CreateInputsModel}{GRiwrm}(x, DatesR, Precip, PotEvap, Qobs, ...)
}
\arguments{
\item{x}{GRiwrm object describing the diagram of the semi-distributed model, see \code{[GRiwrm]}.}
\item{DatesR}{Vector of POSIXt observation time steps.}
\item{Precip}{Matrix or data frame of numeric containing precipitation in mm. Column names correspond to node IDs.}
\item{PotEvap}{Matrix or data frame of numeric containing potential evaporation in mm. Column names correspond to node IDs.}
\item{Qobs}{Matrix or data frame of numeric containing potential observed flow in mm. Column names correspond to node IDs.}
\item{...}{further arguments passed to \link[airGR:CreateInputsModel]{airGR::CreateInputsModel}.}
}
\value{
GRiwrmInputsModel object equivalent to \strong{airGR} InputsModel object for a semi-distributed model (See \link[airGR:CreateInputsModel]{airGR::CreateInputsModel})
}
\description{
Create InputsModel object for a \strong{airGRiwrm} network
}
\examples{
#################################################################
# Run the `airGRRunModel_Lag` example in the GRiwrm fashion way #
#################################################################
# Run airGR RunModel_Lag example for harvesting necessary data
library(airGR)
example(RunModel_Lag)
# detach the package because airGR overwrite airGRiwrm functions here
detach("package:airGR")
# This example is a network of 2 nodes which can be describe like this:
db <- data.frame(id = c("Reservoir", "GaugingDown"),
length = c(LengthHydro, NA),
down = c("GaugingDown", NA),
area = c(NA, BasinInfo$BasinArea),
model = c(NA, "RunModel_GR4J"),
stringsAsFactors = FALSE)
# Create GRiwrm object from the data.frame
griwrm <- GRiwrm(db)
str(griwrm)
# Formatting observations for the hydrological models
# Each input data should be a matrix or a data.frame with the good id in the name of the column
Precip <- matrix(BasinObs$P, ncol = 1)
colnames(Precip) <- "GaugingDown"
PotEvap <- matrix(BasinObs$E, ncol = 1)
colnames(PotEvap) <- "GaugingDown"
# Observed flows are integrated now because we mix:
# - flows that are directly injected in the model
# - flows that could be used for the calibration of the hydrological models
Qobs = matrix(c(Qupstream, BasinObs$Qmm), ncol = 2)
colnames(Qobs) <- griwrm$id
str(Qobs)
InputsModels <- CreateInputsModel(griwrm,
DatesR = BasinObs$DatesR,
Precip = Precip,
PotEvap = PotEvap,
Qobs = Qobs)
str(InputsModels)
}