Commit 795cbd0a authored by Dorchies David's avatar Dorchies David
Browse files

refactor: add roxygen output to the repository

- also solve airGR compatibility issue

Refs #34
Showing with 591 additions and 5 deletions
+591 -5
......@@ -2,10 +2,7 @@
# Project-specific
# Man pages generated by Roxygen
man/*.Rd
/.vscode/
/NAMESPACE
###############################################################################
......
......@@ -22,9 +22,8 @@ cache:
before_script:
- mkdir -p $R_LIBS_USER $BUILD_LOGS_DIR
- echo "R_LIBS='$R_LIBS_USER'" > .Renviron
- R -e 'remotes::install_gitlab("HYCAR-Hydro/airgr@dev", host = "gitlab.irstea.fr")'
- R -e 'install.packages("airGR")'
- R -e 'devtools::install_deps(dep = T)'
- R -e "devtools::document(roclets = c('rd', 'collate', 'namespace'))"
.check:
stage: checks
......
NAMESPACE 0 → 100644
# Generated by roxygen2: do not edit by hand
S3method(Calibration,GRiwrmInputsModel)
S3method(Calibration,InputsModel)
S3method(ConvertMeteoSD,GRiwrm)
S3method(ConvertMeteoSD,character)
S3method(ConvertMeteoSD,matrix)
S3method(CreateCalibOptions,GRiwrmInputsModel)
S3method(CreateCalibOptions,InputsModel)
S3method(CreateInputsCrit,GRiwrmInputsModel)
S3method(CreateInputsCrit,InputsModel)
S3method(CreateInputsModel,GRiwrm)
S3method(CreateInputsModel,default)
S3method(CreateRunOptions,GRiwrmInputsModel)
S3method(CreateRunOptions,InputsModel)
S3method(RunModel,GR)
S3method(RunModel,GRiwrmInputsModel)
S3method(RunModel,InputsModel)
S3method(RunModel,SD)
S3method(RunModel,Supervisor)
S3method(plot,Qm3s)
export(Calibration)
export(CheckColumnTypes)
export(ConvertMeteoSD)
export(CreateCalibOptions)
export(CreateController)
export(CreateInputsCrit)
export(CreateInputsModel)
export(CreateRunOptions)
export(CreateSupervisor)
export(DiagramGRiwrm)
export(GRiwrm)
export(RunModel)
export(createControl)
export(getNodeRanking)
import(airGR)
importFrom(grDevices,rainbow)
importFrom(graphics,matplot)
File added
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Calibration.GRiwrmInputsModel.R
\name{Calibration.GRiwrmInputsModel}
\alias{Calibration.GRiwrmInputsModel}
\title{Calibration of a semi-distributed run-off model}
\usage{
\method{Calibration}{GRiwrmInputsModel}(
InputsModel,
RunOptions,
InputsCrit,
CalibOptions,
useUpstreamQsim = TRUE,
...
)
}
\arguments{
\item{InputsModel}{object of class \emph{GRiwrmInputsModel}, see \code{\link{CreateInputsModel.GRiwrm}} for details.}
\item{RunOptions}{object of class \emph{GRiwrmRunOptions}, see \code{\link{CreateRunOptions.GRiwrmInputsModel}} for details.}
\item{InputsCrit}{object of class \emph{GRiwrmInputsCrit}, see \code{\link{CreateInputsCrit.GRiwrmInputsModel}} for details.}
\item{CalibOptions}{object of class \emph{GRiwrmCalibOptions}, see \code{\link{CreateCalibOptions.GRiwrmInputsModel}} for details.}
\item{useUpstreamQsim}{boolean describing if simulated (\code{TRUE}) or observed (\code{FALSE}) flows are used for calibration. Default is \code{TRUE}.}
\item{...}{further arguments passed to \code{\link[airGR]{Calibration}}.}
}
\value{
GRiwrmOutputsCalib object which is a list of OutputsCalib (See \code{\link[airGR]{Calibration}}) for each node of the semi-distributed model.
}
\description{
Calibration of a semi-distributed run-off model
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Calibration.InputsModel.R
\name{Calibration.InputsModel}
\alias{Calibration.InputsModel}
\title{Wrapper to \code{\link[airGR]{Calibration}} for one sub-basin.}
\usage{
\method{Calibration}{InputsModel}(InputsModel, ...)
}
\arguments{
\item{InputsModel}{[object of class \emph{InputsModel}] see \code{\link[airGR]{CreateInputsModel}} for details}
\item{...}{Further arguments for compatibility with S3 method}
}
\value{
[list] see \code{\link[airGR]{Calibration_Michel}}
}
\description{
Calibration algorithm that optimises the error criterion selected as objective function using the provided functions.
}
\examples{
library(airGR)
## loading catchment data
data(L0123001)
## preparation of InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
## calibration period selection
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1990-01-01"),
which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1999-12-31"))
## preparation of RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
## calibration criterion: preparation of the InputsCrit object
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run])
## preparation of CalibOptions object
CalibOptions <- CreateCalibOptions(FUN_MOD = RunModel_GR4J, FUN_CALIB = Calibration_Michel)
## calibration
OutputsCalib <- Calibration(InputsModel = InputsModel, RunOptions = RunOptions,
InputsCrit = InputsCrit, CalibOptions = CalibOptions,
FUN_MOD = RunModel_GR4J,
FUN_CALIB = Calibration_Michel)
## simulation
Param <- OutputsCalib$ParamFinalR
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions,
Param = Param, FUN = RunModel_GR4J)
## results preview
plot(OutputsModel, Qobs = BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
## efficiency criterion: Kling-Gupta Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_KGE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_KGE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
}
\seealso{
\code{\link[airGR]{Calibration_Michel}},
\code{\link[airGR]{ErrorCrit}}, \code{\link[airGR]{TransfoParam}},
\code{\link[airGR]{CreateInputsModel}}, \code{\link[airGR]{CreateRunOptions}},
\code{\link[airGR]{CreateInputsCrit}}, \code{\link[airGR]{CreateCalibOptions}}.
}
\author{
Laurent Coron, Olivier Delaigue
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Calibration.R
\name{Calibration}
\alias{Calibration}
\title{Calibration of either \strong{airGR} model and \strong{airGRiwrm} semi-distributive model}
\usage{
Calibration(InputsModel, ...)
}
\arguments{
\item{InputsModel}{the class of the first parameter determine which calibration is used}
\item{...}{further arguments passed to or from other methods.}
}
\value{
\emph{OutputsCalib} or \emph{GRiwrmOutputsCalib} object
}
\description{
Calibration of either \strong{airGR} model and \strong{airGRiwrm} semi-distributive model
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/GRiwrm.R
\name{CheckColumnTypes}
\alias{CheckColumnTypes}
\title{Check the column types of a \link{data.frame}}
\usage{
CheckColumnTypes(df, coltypes)
}
\arguments{
\item{df}{\link{data.frame} to check}
\item{coltypes}{named \link{list} with the name of the columns to check as key and the required type as value}
}
\value{
\link{NULL} or throw an error if a wrong type is detected.
}
\description{
Check the column types of a \link{data.frame}
}
\examples{
CheckColumnTypes(
data.frame(string = c("A"), numeric = c(1), stringsAsFactors = FALSE),
list(string = "character", numeric = "double")
)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ConvertMeteoSD.R
\name{ConvertMeteoSD}
\alias{ConvertMeteoSD}
\alias{ConvertMeteoSD.GRiwrm}
\alias{ConvertMeteoSD.character}
\alias{ConvertMeteoSD.matrix}
\title{Convert meteorological data from basin scale to sub-basin scale}
\usage{
ConvertMeteoSD(x, ...)
\method{ConvertMeteoSD}{GRiwrm}(x, meteo, ...)
\method{ConvertMeteoSD}{character}(x, griwrm, meteo, ...)
\method{ConvertMeteoSD}{matrix}(x, areas, temperature = FALSE, ...)
}
\arguments{
\item{x}{either a \link{GRiwrm} network description, a \link{character} id of a node, a \link{matrix} containing meteorological data}
\item{...}{Parameters passed to the methods}
\item{meteo}{\link{matrix} or \link{data.frame} containing meteorological data. Its \link{colnames} should be equal to the IDof the basins}
\item{griwrm}{\link{GRiwrm} object describing the semi-distributive network}
\item{areas}{\link{numeric} vector with the total area of the basin followed by the areas of the upstream basins in km^2^}
\item{temperature}{\link{logical} \code{TRUE} if the meteorological data is temperature. if \code{FALSE} minimum output values are bounded to zero}
}
\value{
Either a \link{matrix} containing the converted meteorological data
}
\description{
Convert meteorological data from basin scale to sub-basin scale
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateCalibOptions.GRiwrmInputsModel.R
\name{CreateCalibOptions.GRiwrmInputsModel}
\alias{CreateCalibOptions.GRiwrmInputsModel}
\title{Title}
\usage{
\method{CreateCalibOptions}{GRiwrmInputsModel}(InputsModel, ...)
}
\arguments{
\item{InputsModel}{object of class \emph{GRiwrmInputsModel}, see \code{\link{CreateInputsModel.GRiwrm}} for details.}
\item{...}{further arguments passed to \code{\link[airGR]{CreateCalibOptions}}.}
}
\value{
\emph{GRiwrmCalibOptions} object.
}
\description{
Title
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateCalibOptions.InputsModel.R
\name{CreateCalibOptions.InputsModel}
\alias{CreateCalibOptions.InputsModel}
\title{Wrapper to \code{\link[airGR]{CreateCalibOptions}} for one sub-basin.}
\usage{
\method{CreateCalibOptions}{InputsModel}(InputsModel, ...)
}
\arguments{
\item{InputsModel}{object of class \emph{InputsModel}. See \code{\link[airGR]{CreateInputsModel}} for details}
\item{...}{Arguments passed to \code{\link[airGR]{CreateCalibOptions}}}
}
\description{
Wrapper to \code{\link[airGR]{CreateCalibOptions}} for one sub-basin.
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateCalibOptions.R
\name{CreateCalibOptions}
\alias{CreateCalibOptions}
\title{CreateCalibOptions both available for \emph{InputsModel} and \emph{GRwirmInputsModel} objects}
\usage{
CreateCalibOptions(InputsModel, ...)
}
\arguments{
\item{InputsModel}{object of class \emph{InputsModel} or \emph{GRwirmInputsModel}. See \code{\link{CreateInputsModel}} for details}
\item{...}{further arguments passed to or from other methods}
}
\value{
Either a \code{CalibOptions} or a \code{GRiwrmCalibOptions} object
}
\description{
CreateCalibOptions both available for \emph{InputsModel} and \emph{GRwirmInputsModel} objects
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/createController.R
\name{CreateController}
\alias{CreateController}
\title{Create and add a controller in a supervisor}
\usage{
CreateController(supervisor, ctrl.id, Y, U, FUN)
}
\arguments{
\item{supervisor}{\code{Supervisor} object, see \link{CreateSupervisor}}
\item{ctrl.id}{\link{character} id of the controller (see Details)}
\item{Y}{\link{character} location of the controlled and/or measured variables in the model. See \link{createControl}}
\item{U}{\link{character} location of the command variables in the model. See \link{createControl}}
\item{FUN}{\link{function} controller logic which calculates \code{U} from \code{Y} (see Details)}
}
\value{
\code{Controller}
}
\description{
Create and add a controller in a supervisor
}
\details{
\code{ctrl.id} parameter is a unique id for finding the controller in the supervisor.
If a controller with the same id already exists, it is overwritten by this new one.
\code{FUN} parameter should be a function with one \link{numeric} parameter.
This parameter will receive the measured values of at \code{Y} locations as input
for the previous time step and returns calculated \code{U}. These \code{U} will then be applied
at their location for the current time step of calculation of the model.
}
\examples{
# First create a Supervisor from a model
example("CreateSupervisor")
# A controller which usually releases 0.1 m3/s and provides
# extra release if the downstream flow is below 0.5 m3/s
logicDamRelease <- function(Y) max(0.5 - Y[1], 0.1)
CreateController(sv, "DamRelease", Y = c("54001"), U = c("54095"), FUN = logicDamRelease)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateInputsModel.GRiwrm.R
\name{CreateEmptyGRiwrmInputsModel}
\alias{CreateEmptyGRiwrmInputsModel}
\title{Create an empty InputsModel object for \strong{airGRiwrm} nodes}
\usage{
CreateEmptyGRiwrmInputsModel(griwrm)
}
\arguments{
\item{griwrm}{a \code{GRiwrm} object (See \link{GRiwrm})}
}
\value{
\emph{GRiwrmInputsModel} empty object
}
\description{
Create an empty InputsModel object for \strong{airGRiwrm} nodes
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateInputsCrit.GRiwrmInputsModel.R
\name{CreateInputsCrit.GRiwrmInputsModel}
\alias{CreateInputsCrit.GRiwrmInputsModel}
\title{Create \emph{GRiwrmInputsCrit} object for \strong{airGRiwrm}.}
\usage{
\method{CreateInputsCrit}{GRiwrmInputsModel}(
InputsModel,
FUN_CRIT = airGR::ErrorCrit_NSE,
RunOptions,
Qobs,
...
)
}
\arguments{
\item{InputsModel}{object of class \emph{GRiwrmInputsModel}, see \code{\link{CreateInputsModel.GRiwrm}} for details.}
\item{FUN_CRIT}{[function (atomic or list)] error criterion function (e.g. \code{\link[airGR]{ErrorCrit_RMSE}}, \code{\link[airGR]{ErrorCrit_NSE}})}
\item{RunOptions}{object of class \emph{GRiwrmRunOptions}, see \code{[CreateRunOptions.GRiwrm]} for details.}
\item{Qobs}{matrix or data frame containing observed flows. Column names correspond to nodes ID}
\item{...}{further arguments passed to \link[airGR:CreateInputsCrit]{airGR::CreateInputsCrit}.}
}
\value{
Object of class \emph{GRiwrmInputsCrit} which is a list of \code{airGR::InputsCrit} objects (See \link[airGR:CreateInputsCrit]{airGR::CreateInputsCrit})
}
\description{
This function does the same operations as \link[airGR:CreateInputsCrit]{airGR::CreateInputsCrit} for all sub-basins of the GRiwrm model.
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateInputsCrit.InputsModel.R
\name{CreateInputsCrit.InputsModel}
\alias{CreateInputsCrit.InputsModel}
\title{Wrapper to \code{\link[airGR]{CreateInputsCrit}} for one sub-basin.}
\usage{
\method{CreateInputsCrit}{InputsModel}(InputsModel, FUN_CRIT, ...)
}
\arguments{
\item{InputsModel}{[object of class \emph{InputsModel}] see \code{\link[airGR]{CreateInputsModel}} for details}
\item{FUN_CRIT}{[function (atomic or list)] error criterion function (e.g. \code{\link[airGR]{ErrorCrit_RMSE}}, \code{\link[airGR]{ErrorCrit_NSE}})}
\item{...}{Further arguments for compatibility with S3 method}
}
\value{
[list] object of class \emph{InputsCrit} containing the data required to evaluate the model outputs; it can include the following:
\tabular{ll}{
\emph{$FUN_CRIT } \tab [function] error criterion function (e.g. \code{\link[airGR]{ErrorCrit_RMSE}}, \code{\link[airGR]{ErrorCrit_NSE}}) \cr
\emph{$Obs } \tab [numeric] series of observed variable(s) ([mm/time step] for discharge or SWE, [-] for SCA) \cr
\emph{$VarObs } \tab [character] names of the observed variable(s) \cr
\emph{$BoolCrit } \tab [boolean] boolean giving the time steps considered in the computation \cr
\emph{$transfo } \tab [character] name of the transformation (e.g. \code{""}, \code{"sqrt"}, \code{"log"}, \code{"inv"}, \code{"sort"}, \code{"boxcox"} or a number for power transformation) \cr
\emph{$epsilon } \tab [numeric] small value to add to all observations and simulations when \code{"log"} or \code{"inv"} transformations are used [same unit as \code{Obs}] \cr
\emph{$Weights } \tab [numeric] vector (same length as \code{VarObs}) giving the weights to use for elements of \code{FUN_CRIT} [-] \cr
}
When \code{Weights = NULL}, \code{CreateInputsCrit} returns an object of class \emph{Single} that is a list such as the one described above. \cr
When \code{Weights} contains at least one \code{NULL} value and \code{Obs} contains a list of observations, \code{CreateInputsCrit} returns an object of class \emph{Multi} that is a list of lists such as the one described above. The \code{\link[airGR]{ErrorCrit}} function will then compute the different criteria prepared by \code{CreateInputsCrit}. \cr
When \code{Weights} is a list of at least 2 numerical values, \code{CreateInputsCrit} returns an object of class \emph{Compo} that is a list of lists such as the one described above. This object will be useful to compute composite criterion with the \code{\link[airGR]{ErrorCrit}} function. \cr
To calculate composite or multiple criteria, it is necessary to use the \code{ErrorCrit} function. The other \code{ErrorCrit_*} functions (e.g. \code{\link[airGR]{ErrorCrit_RMSE}}, \code{\link[airGR]{ErrorCrit_NSE}}) can only use objects of class \emph{Single} (and not \emph{Multi} or \emph{Compo}). \cr
}
\description{
Creation of the \code{InputsCrit} object required to the \code{ErrorCrit_*} functions. This function is used to define whether the user wants to calculate a single criterion, multiple criteria in the same time, or a composite criterion, which averages several criteria.
}
\details{
Users wanting to use \code{FUN_CRIT} functions that are not included in the package must create their own InputsCrit object accordingly. \cr \cr
## --- Period of calculation
Criteria can be calculated over discontinuous periods (i.e. only over winter periods, or when observed discharge is below a certain threshold). To do so, please indicate in \code{Bool_Crit} which indices must be used for calcullation. Discontinuous periods are allowed in the \code{Bool_Crit} argument.
## --- Transformations
Transformations are simple functions applied to the observed and simulated variables used in order to change their distribution. Transformations are often used in hydrology for modifying the weight put on errors made for high flows or low flows. The following transformations are available: \cr \cr
\itemize{
\item \code{""}: no transformation is used (default case)
\item \code{"sqrt"}: squared root transformation
\item \code{"log"}: logarithmic transformation (see below regarding the specific case of KGE or KGE2)
\item \code{"inv"}: inverse transformation
\item \code{"sort"}: sort transformation (the simulated and observed variables are sorted from lowest to highest)
\item \code{"boxcox"}: Box-Cox transformation (see below for details)
\item numeric: power transformation (see below for details)
}
We do not advise computing KGE or KGE' with log-transformation as it might be wrongly influenced by discharge values close to 0 or 1 and the criterion value is dependent on the discharge unit. See Santos et al. (2018) for more details and alternative solutions (see the references list below). \cr \cr
In order to make sure that KGE and KGE2 remain dimensionless and are not impacted by zero values, the Box-Cox transformation (\code{transfo = "boxcox"}) uses the formulation given in Equation 10 of Santos et al. (2018). Lambda is set to 0.25 accordingly. \cr \cr
The syntax of the power transformation allows a numeric or a string of characters. For example for a squared transformation, the following can be used: \code{transfo = 2}, \code{transfo = "2"} or \code{transfo = "^2"}. Negative values are allowed. Fraction values are not allowed (e.g., \code{"-1/2"} must instead be written \code{"-0.5"}).\cr \cr
## --- The epsilon value
The epsilon value is useful when \code{"log"} or \code{"inv"} transformations are used (to avoid calculation of the inverse or of the logarithm of zero). If an epsilon value is provided, then it is added to the observed and simulated variable time series at each time step and before the application of a transformation. The epsilon value has no effect when the \code{"boxcox"} transformation is used. The impact of this value and a recommendation about the epsilon value to use (usually one hundredth of average observation) are discussed in Pushpalatha et al. (2012) for NSE and in Santos et al. (2018) for KGE and KGE'. \cr \cr
## --- Single, multiple or composite criteria calculation
Users can set the following arguments as atomic or list: \code{FUN_CRIT}, \code{Obs}, \code{VarObs}, \code{BoolCrit}, \code{transfo}, \code{Weights}. If the list format is chosen, all the lists must have the same length. \cr
Calculation of a single criterion (e.g. NSE computed on discharge) is prepared by providing to \code{CreateInputsCrit} arguments atomics only. \cr
Calculation of multiple criteria (e.g. NSE computed on discharge and RMSE computed on discharge) is prepared by providing to \code{CreateInputsCrit} arguments lists except for \code{Weights} that must be set as \code{NULL}. \cr
Calculation of a composite criterion (e.g. the average between NSE computed on discharge and NSE computed on log of discharge) is prepared by providing to \code{CreateInputsCrit} arguments lists including \code{Weights}. \cr
\code{\link[airGR]{ErrorCrit_RMSE}} cannot be used in a composite criterion since it is not a unitless value.
}
\examples{
library(airGR)
## loading catchment data
data(L0123001)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
## calibration period selection
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1990-01-01"),
which(format(BasinObs$DatesR, format = "\%Y-\%m-\%d")=="1999-12-31"))
## preparation of RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J, InputsModel = InputsModel,
IndPeriod_Run = Ind_Run)
## simulation
Param <- c(X1 = 257.238, X2 = 1.012, X3 = 88.235, X4 = 2.208)
OutputsModel <- RunModel_GR4J(InputsModel = InputsModel, RunOptions = RunOptions, Param = Param)
## single efficiency criterion: Nash-Sutcliffe Efficiency
InputsCritSingle <- CreateInputsCrit(FUN_CRIT = ErrorCrit_NSE,
InputsModel = InputsModel, RunOptions = RunOptions,
Obs = list(BasinObs$Qmm[Ind_Run]),
VarObs = "Q", transfo = "",
Weights = NULL)
str(InputsCritSingle)
invisible(ErrorCrit(InputsCrit = InputsCritSingle, OutputsModel = OutputsModel))
## 2 efficiency criteria: RMSE and Nash-Sutcliffe Efficiency
InputsCritMulti <- CreateInputsCrit(FUN_CRIT = list(ErrorCrit_RMSE, ErrorCrit_NSE),
InputsModel = InputsModel, RunOptions = RunOptions,
Obs = list(BasinObs$Qmm[Ind_Run], BasinObs$Qmm[Ind_Run]),
VarObs = list("Q", "Q"), transfo = list("", "sqrt"),
Weights = NULL)
str(InputsCritMulti)
invisible(ErrorCrit(InputsCrit = InputsCritMulti, OutputsModel = OutputsModel))
## efficiency composite criterion: Nash-Sutcliffe Efficiency mixing
## both raw and log-transformed flows
InputsCritCompo <- CreateInputsCrit(FUN_CRIT = list(ErrorCrit_NSE, ErrorCrit_NSE),
InputsModel = InputsModel, RunOptions = RunOptions,
Obs = list(BasinObs$Qmm[Ind_Run], BasinObs$Qmm[Ind_Run]),
VarObs = list("Q", "Q"), transfo = list("", "log"),
Weights = list(0.4, 0.6))
str(InputsCritCompo)
invisible(ErrorCrit(InputsCrit = InputsCritCompo, OutputsModel = OutputsModel))
}
\references{
Pushpalatha, R., Perrin, C., Le Moine, N. and Andréassian, V. (2012).
A review of efficiency criteria suitable for evaluating low-flow simulations.
Journal of Hydrology, 420-421, 171-182, doi: 10.1016/j.jhydrol.2011.11.055.
\cr\cr
Santos, L., Thirel, G. and Perrin, C. (2018).
Technical note: Pitfalls in using log-transformed flows within the KGE criterion.
Hydrol. Earth Syst. Sci., 22, 4583-4591, doi: 10.5194/hess-22-4583-2018.
}
\seealso{
\code{\link[airGR]{RunModel}}, \code{\link[airGR]{CreateInputsModel}}, \code{\link[airGR]{CreateRunOptions}}, \code{\link[airGR]{CreateCalibOptions}}, \code{\link[airGR]{ErrorCrit}}
}
\author{
Olivier Delaigue, Laurent Coron, Guillaume Thirel
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateInputsCrit.R
\name{CreateInputsCrit}
\alias{CreateInputsCrit}
\title{Creation of the InputsCrit object required to the ErrorCrit functions}
\usage{
CreateInputsCrit(InputsModel, ...)
}
\arguments{
\item{InputsModel}{InputsModel for \strong{airGRiwrm} (See \code{[CreateInputsModel.GRiwrm]}) or \strong{airGR} (See \code{\link[airGR]{CreateInputsModel}})}
\item{...}{further arguments passed to or from other methods.}
}
\value{
Either a \code{InputsCrit} or a \code{GRiwrmInputsCrit} object
}
\description{
Creation of the InputsCrit object required to the ErrorCrit functions
}
% 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 \code{\link[airGR]{CreateInputsModel}}.}
}
\value{
GRiwrmInputsModel object equivalent to \strong{airGR} InputsModel object for a semi-distributed model (See \code{\link[airGR]{CreateInputsModel}})
}
\description{
Create InputsModel object for a \strong{airGRiwrm} network
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateInputsModel.R
\name{CreateInputsModel}
\alias{CreateInputsModel}
\title{Generic function for creating \code{InputsModel} object for either \strong{airGR} or \strong{airGRiwrm}}
\usage{
CreateInputsModel(x, ...)
}
\arguments{
\item{x}{First parameter determining which InputsModel object is created}
\item{...}{further arguments passed to or from other methods.}
}
\value{
InputsModel or GRiwrmInputsObject object
}
\description{
See the methods \link{CreateInputsModel.GRiwrm} for \strong{airGRiwrm} and \link{CreateInputsModel.default} for \strong{airGR}.
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CreateInputsModel.default.R
\name{CreateInputsModel.default}
\alias{CreateInputsModel.default}
\title{Wrapper for \code{\link[airGR]{CreateInputsModel}} for one sub-basin.}
\usage{
\method{CreateInputsModel}{default}(x, ...)
}
\arguments{
\item{x}{\link{function} hydrological model function (e.g. \code{\link[airGR]{RunModel_GR4J}}...)}
\item{...}{arguments passed to \code{\link[airGR]{CreateInputsModel}}}
}
\description{
Wrapper for \code{\link[airGR]{CreateInputsModel}} for one sub-basin.
}
Supports Markdown
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