Commit fc03458c authored by Dorchies David's avatar Dorchies David
Browse files

v1.6.8.12 doc: fix issues on examples for Imax, RunModel_GR1A and

RunModel_GR2M with new SeriesAggreg

Refs #41
parent 2cae2dd8
Pipeline #17795 failed with stages
in 13 minutes and 18 seconds
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.8.11
Version: 1.6.8.12
Date: 2020-11-24
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -32,7 +32,7 @@ Imax <- function(InputsModel,
TabSeries <- data.frame(DatesR = InputsModel$DatesR[IndPeriod_Run],
Precip = InputsModel$Precip[IndPeriod_Run],
PotEvap = InputsModel$PotEvap[IndPeriod_Run])
daily_data <- SeriesAggreg(TabSeries, "hourly", "daily",
daily_data <- SeriesAggreg(TabSeries, Format = "%Y%m%d",
ConvertFun = c("sum", "sum"))
##calculate total interception of daily GR models on the period
......
......@@ -24,7 +24,7 @@ RunModel_GR1A(InputsModel, RunOptions, Param)
\item{RunOptions}{[object of class \emph{RunOptions}] see \code{\link{CreateRunOptions}} for details}
\item{Param}{[numeric] vector of 1 parameter
\tabular{ll}{
\tabular{ll}{
GR1A X1 \tab model parameter [-] \cr
}}
}
......@@ -56,23 +56,22 @@ library(airGR)
data(L0123001)
## conversion of example data from daily to yearly time step
TabSeries <- data.frame(BasinObs$DatesR, BasinObs$P, BasinObs$E, BasinObs$T, BasinObs$Qmm)
TimeFormat <- "daily"
NewTimeFormat <- "yearly"
ConvertFun <- c("sum", "sum", "mean", "sum")
YearFirstMonth <- 09;
NewTabSeries <- SeriesAggreg(TabSeries = TabSeries, TimeFormat = TimeFormat,
NewTimeFormat = NewTimeFormat, ConvertFun = ConvertFun,
YearFirstMonth = YearFirstMonth)
BasinObs <- NewTabSeries
names(BasinObs) <- c("DatesR", "P", "E", "T", "Qmm")
TabSeries <- data.frame(DatesR = BasinObs$DatesR,
P = BasinObs$P,
E = BasinObs$E,
Qmm = BasinObs$Qmm)
TimeFormat <- "\%Y"
YearFirstMonth <- 09
ConvertFun <- c("sum", "sum", "sum")
BasinObs <- SeriesAggreg(TabSeries = TabSeries, Format = TimeFormat,
YearFirstMonth = YearFirstMonth, ConvertFun = ConvertFun)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR1A, DatesR = BasinObs$DatesR,
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR1A, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y")=="1990"),
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y")=="1990"),
which(format(BasinObs$DatesR, format = "\%Y")=="1999"))
## preparation of the RunOptions object
......@@ -87,7 +86,7 @@ OutputsModel <- RunModel_GR1A(InputsModel = InputsModel, RunOptions = RunOptions
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
}
......@@ -99,8 +98,8 @@ Laurent Coron, Claude Michel, Olivier Delaigue, Guillaume Thirel
\references{
Mouelhi S. (2003).
Vers une chaîne cohérente de modèles pluie-débit conceptuels globaux aux pas de temps pluriannuel, annuel, mensuel et journalier.
Mouelhi S. (2003).
Vers une chaîne cohérente de modèles pluie-débit conceptuels globaux aux pas de temps pluriannuel, annuel, mensuel et journalier.
PhD thesis (in French), ENGREF - Cemagref Antony, France.
}
......
......@@ -24,7 +24,7 @@ RunModel_GR2M(InputsModel, RunOptions, Param)
\item{RunOptions}{[object of class \emph{RunOptions}] see \code{\link{CreateRunOptions}} for details}
\item{Param}{[numeric] vector of 2 parameters
\tabular{ll}{
\tabular{ll}{
GR2M X1 \tab production store capacity [mm] \cr
GR2M X2 \tab groundwater exchange coefficient [-] \cr
}}
......@@ -32,8 +32,8 @@ GR2M X2 \tab groundwater exchange coefficient [-] \cr
\value{
[list] list containing the function outputs organised as follows:
\tabular{ll}{
[list] list containing the function outputs organised as follows:
\tabular{ll}{
\emph{$DatesR } \tab [POSIXlt] series of dates \cr
\emph{$PotEvap } \tab [numeric] series of input potential evapotranspiration [mm/month] \cr
\emph{$Precip } \tab [numeric] series of input total precipitation [mm/month] \cr
......@@ -47,7 +47,7 @@ GR2M X2 \tab groundwater exchange coefficient [-] \cr
\emph{$Rout } \tab [numeric] series of routing store level [mm] \cr
\emph{$Qsim } \tab [numeric] series of simulated discharge [mm/month] \cr
\emph{$StateEnd} \tab [numeric] states at the end of the run (production store level and routing store level) [mm], \cr\tab see \code{\link{CreateIniStates}} for more details \cr
}
}
(refer to the provided references or to the package source code for further details on these model outputs)
}
......@@ -69,21 +69,20 @@ library(airGR)
data(L0123001)
## conversion of example data from daily to monthly time step
TabSeries <- data.frame(BasinObs$DatesR, BasinObs$P, BasinObs$E, BasinObs$T, BasinObs$Qmm)
TimeFormat <- "daily"
NewTimeFormat <- "monthly"
ConvertFun <- c("sum", "sum", "mean", "sum")
NewTabSeries <- SeriesAggreg(TabSeries = TabSeries, TimeFormat = TimeFormat,
NewTimeFormat = NewTimeFormat, ConvertFun = ConvertFun)
BasinObs <- NewTabSeries
names(BasinObs) <- c("DatesR", "P", "E", "T", "Qmm")
TabSeries <- data.frame(DatesR = BasinObs$DatesR,
P = BasinObs$P,
E = BasinObs$E,
Qmm = BasinObs$Qmm)
TimeFormat <- "\%Y\%m"
ConvertFun <- c("sum", "sum", "sum")
BasinObs <- SeriesAggreg(TabSeries = TabSeries, Format = TimeFormat, ConvertFun = ConvertFun)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR2M, DatesR = BasinObs$DatesR,
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR2M, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y-\%m")=="1990-01"),
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y-\%m")=="1990-01"),
which(format(BasinObs$DatesR, format = "\%Y-\%m")=="1999-12"))
## preparation of the RunOptions object
......@@ -98,7 +97,7 @@ OutputsModel <- RunModel_GR2M(InputsModel = InputsModel, RunOptions = RunOptions
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
}
......@@ -110,12 +109,12 @@ Laurent Coron, Claude Michel, Safouane Mouelhi, Olivier Delaigue, Guillaume Thir
\references{
Mouelhi S. (2003).
Vers une chaîne cohérente de modèles pluie-débit conceptuels globaux aux pas de temps pluriannuel, annuel, mensuel et journalier.
Mouelhi S. (2003).
Vers une chaîne cohérente de modèles pluie-débit conceptuels globaux aux pas de temps pluriannuel, annuel, mensuel et journalier.
PhD thesis (in French), ENGREF - Cemagref Antony, France.
\cr\cr
Mouelhi, S., Michel, C., Perrin, C. and Andréassian V. (2006).
Stepwise development of a two-parameter monthly water balance model.
Mouelhi, S., Michel, C., Perrin, C. and Andréassian V. (2006).
Stepwise development of a two-parameter monthly water balance model.
Journal of Hydrology, 318(1-4), 200-214, doi: \href{https://www.doi.org/10.1016/j.jhydrol.2005.06.014}{10.1016/j.jhydrol.2005.06.014}.
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment