From ccbe98764b444daab491b48a5eb6bc26e6b0b48d Mon Sep 17 00:00:00 2001
From: Dorchies David <david.dorchies@inrae.fr>
Date: Sat, 8 Jan 2022 19:37:30 +0100
Subject: [PATCH] docs: complete documentation and solve package check issues

---
 .Rbuildignore                      |  1 +
 DESCRIPTION                        |  1 +
 NAMESPACE                          |  2 --
 R/Calibration.R                    | 31 +++++++++++++++---------
 R/CreateInputsModel.R              |  9 ++++---
 R/RunModel.R                       |  8 ++++---
 R/addReservoirsGRiwrm.R            |  7 +++---
 R/addReservoirsQ.R                 |  8 +++----
 R/calcQJXA.R                       |  8 +++----
 R/calcQMNA.R                       |  9 ++++---
 R/calcVCN.R                        | 10 ++++----
 R/climato_safran2bvi.R             | 11 ++++-----
 R/createBasinsObs.R                |  3 +--
 R/data.R                           |  2 +-
 R/getAprioriIds.R                  | 11 +++++----
 R/getDataPath.R                    | 10 ++------
 R/getDrias2020filenames.R          |  1 +
 R/listDataFiles.R                  |  6 +++--
 R/loadBasinsObs.R                  |  5 +++-
 R/loadCalibrationParams.R          | 12 ++++++----
 R/loadHydratecDB.R                 |  1 -
 R/loadHypsoData.R                  | 11 +++++----
 R/readDrias2020.R                  |  2 +-
 R/saveFlowDB.R                     |  7 +++---
 R/selectBasins.R                   |  9 -------
 man-roxygen/param_cfg.R            |  2 +-
 man/Calibration.BasinsObs.Rd       | 38 ++++++++++++++++++++++++++----
 man/CreateInputsModel.BasinsObs.Rd | 12 ++++++----
 man/RunModel.BasinsObs.Rd          | 23 ++++++++++--------
 man/addReservoirsGRiwrm.Rd         |  8 +++----
 man/addReservoirsQ.Rd              | 10 ++++----
 man/areaPoly.Rd                    |  4 ++--
 man/calcQJXA.Rd                    | 14 +++++------
 man/calcQJXAn.Rd                   |  6 ++---
 man/calcQLogNn.Rd                  |  4 ++--
 man/calcQMNA.Rd                    |  6 ++---
 man/calcQMNAn.Rd                   | 15 ++++++------
 man/calcVCN.Rd                     |  8 +++----
 man/calcVCNn.Rd                    | 16 ++++++-------
 man/climato_safran2bvi.Rd          | 10 ++++----
 man/createBasinsObs.Rd             | 21 +++++++++--------
 man/getAprioriIds.Rd               |  9 +++----
 man/getDataPath.Rd                 | 18 ++++----------
 man/getDrias2020filenames.Rd       |  7 +++---
 man/getGumbelParams.Rd             |  2 +-
 man/gis_bvi.Rd                     |  2 +-
 man/griwrm.Rd                      |  2 +-
 man/hello.Rd                       | 12 ----------
 man/listDataFiles.Rd               | 14 +++++++----
 man/loadBasinsObs.Rd               | 13 ++++++----
 man/loadCalibrationParams.Rd       | 13 ++++++----
 man/loadConfig.Rd                  |  2 +-
 man/loadHydratecDB.Rd              |  8 +++----
 man/loadHypsoData.Rd               |  9 +++----
 man/readDrias2020.Rd               | 28 +++++++++++++---------
 man/readQsim.Rd                    | 10 ++++----
 man/saveFlowDB.Rd                  | 10 ++++----
 man/selectBasins.Rd                | 17 -------------
 58 files changed, 291 insertions(+), 267 deletions(-)
 delete mode 100644 man/hello.Rd
 delete mode 100644 man/selectBasins.Rd

diff --git a/.Rbuildignore b/.Rbuildignore
index 1acafc0..d871a89 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -5,3 +5,4 @@
 ^\.gitlab-ci\.yml$
 ^data-raw$
 ^LICENSE\.md$
+^man-roxygen$
diff --git a/DESCRIPTION b/DESCRIPTION
index b21bb19..bc9c6d2 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -40,6 +40,7 @@ Imports:
     stats,
     utils,
     zoo
+Roxygen: list(markdown = TRUE)
 RoxygenNote: 7.1.2
 Remotes:
     url::https://gitlab.irstea.fr/in-wop/airGRiwrm/-/archive/dev/airGRiwrm-dev.zip
diff --git a/NAMESPACE b/NAMESPACE
index 4364543..7e640b9 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -27,7 +27,6 @@ export(calcQMNA)
 export(calcQMNAn)
 export(calcVCN)
 export(calcVCNn)
-export(climato_safran2bvi)
 export(createBasinsObs)
 export(getAprioriIds)
 export(getDataPath)
@@ -42,7 +41,6 @@ export(loadHypsoData)
 export(readDrias2020)
 export(readQsim)
 export(saveFlowDB)
-export(selectBasins)
 import(airGRiwrm)
 import(magrittr)
 import(stats)
diff --git a/R/Calibration.R b/R/Calibration.R
index f7f0a2f..9d42817 100644
--- a/R/Calibration.R
+++ b/R/Calibration.R
@@ -1,27 +1,36 @@
 #' Simplified Calibration for BasinsObs object
 #'
-#' @param BasinsObs
-#' @param InputsModel
-#' @param Ind_Run
-#' @param export
-#' @param AprioriIds
-#' @param path_data
+#' @description
+#' It calls automatically:
 #'
-#' @return
+#' - [CreateInputsModel.BasinsObs]
+#' - [airGRiwrm::CreateRunOptions]
+#' - [airGRiwrm::CreateInputsCrit]
+#' - [airGRiwrm::CreateCalibOptions]
+#' - [airGRiwrm::Calibration]
+#'
+#' It calculates performance indicator on the model and save parameters and performance indicators into the file (`paramFile`).
+#'
+#' @inheritParams RunModel.BasinsObs
+#' @param FUN_CRIT See [airGRiwrm::CreateInputsCrit]
+#' @param AprioriIds See [airGRiwrm::CreateInputsCrit]
+#' @param transfo See [airGR::CreateInputsCrit]
+#'
+#' @return a `GRiwrmOutputsCalib` object which is a [list] of `OutputsCalib` objects with one item per modelled sub-catchment. See [airGRiwrm::Calibration]
 #' @export
 #' @import airGRiwrm
 #' @import utils
 #'
-#' @examples
 Calibration.BasinsObs <- function(BasinsObs,
-                                  ParamFile,
+                                  paramFile,
                                   InputsModel = CreateInputsModel(BasinsObs),
                                   IndPeriod_WarmUp = seq(1, 365),
                                   IndPeriod_Run = seq(366, length(BasinsObs$DatesR)),
                                   FUN_CRIT = airGR::ErrorCrit_KGE2,
                                   AprioriIds = getAprioriIds(InputsModel),
                                   transfo = "sqrt",
-                                  cfg = loadConfig()) {
+                                  cfg = loadConfig(),
+                                  ...) {
 
     RO <- CreateRunOptions(
         InputsModel,
@@ -77,7 +86,7 @@ Calibration.BasinsObs <- function(BasinsObs,
     colnames(parametres) <- c("Id", "c", "X1", "X2", "X3", "X4", "Crit_Final", "KGE")
     if (cfg$data$write_results) {
         write.csv(x = parametres,
-                  file = file.path(cfg$calibration$path, ParamFile),
+                  file = file.path(cfg$calibration$path, paramFile),
                   row.names = FALSE)
     }
 }
diff --git a/R/CreateInputsModel.R b/R/CreateInputsModel.R
index eb82271..4cec8bd 100644
--- a/R/CreateInputsModel.R
+++ b/R/CreateInputsModel.R
@@ -1,12 +1,11 @@
-#' Title
+#' Create Inputs for *airGRiwrm* model with `BasinsObs` object
 #'
-#' @param BasinsObs
+#' @inheritParams RunModel.BasinsObs
 #'
-#' @return
+#' @return See return value of [airGRiwrm::CreateInputsModel]
 #' @export
 #'
-#' @examples
-CreateInputsModel.BasinsObs <- function(BasinsObs) {
+CreateInputsModel.BasinsObs <- function(BasinsObs, ...) {
 
     # Remove Q for hydrological modeled nodes
     Q <- NULL
diff --git a/R/RunModel.R b/R/RunModel.R
index 09a4cbd..02f666c 100644
--- a/R/RunModel.R
+++ b/R/RunModel.R
@@ -1,15 +1,16 @@
 #' RunModel function for *BasinsObs* object
 #'
-#' This function simplifies the run of an airGRiwrm model by chaining all the steps ([airGRiwrm::CreateInputsModel.GRiwrm], [airGRiwrm::CreateRunOptions.GRiwrmInputsModel] and [airGriwrm::RunModel.GRiwrmInputsModel]) into one single step.
+#' This function simplifies the run of an airGRiwrm model by chaining all the steps ([airGRiwrm::CreateInputsModel.GRiwrm], [airGRiwrm::CreateRunOptions.GRiwrmInputsModel] and [airGRiwrm::RunModel.GRiwrmInputsModel]) into one single step.
 #'
 #' @param BasinsObs an object of class *BasinsObs*, see [loadBasinsObs] and [createBasinsObs]
 #' @param paramFile [character] the path of the file containing the model parameters (use to call [loadCalibrationParams])
 #' @param InputsModel an object of class *GRiwrmInputsModel*, see [CreateInputsModel.BasinsObs]
 #' @param IndPeriod_WarmUp (optional) [numeric] index of period to be used for the model warm-up [-]. See [airGR::CreateRunOptions] for details
 #' @param IndPeriod_Run (optional) [numeric] index of period to be used for the model run [-]. See [airGR::CreateRunOptions] for details
+#' @param ... not used (compatibility with others S3 methods)
 #' @template param_cfg
 #'
-#' @return An object of class *GriwrmOutputsModel* produced by [airGriwrm::RunModel.GRiwrmInputsModel]
+#' @return An object of class *GriwrmOutputsModel* produced by [airGRiwrm::RunModel.GRiwrmInputsModel]
 #' @export
 #'
 RunModel.BasinsObs <- function(BasinsObs,
@@ -17,7 +18,8 @@ RunModel.BasinsObs <- function(BasinsObs,
                      InputsModel = suppressMessages(CreateInputsModel(BasinsObs)),
                      IndPeriod_WarmUp = seq(1, 365),
                      IndPeriod_Run = seq(366, length(BasinsObs$DatesR)),
-                     cfg = loadConfig()) {
+                     cfg = loadConfig(),
+                     ...) {
 
     RunOptions <- suppressWarnings(
         airGRiwrm::CreateRunOptions(
diff --git a/R/addReservoirsGRiwrm.R b/R/addReservoirsGRiwrm.R
index 5b5174f..b6bb9b9 100644
--- a/R/addReservoirsGRiwrm.R
+++ b/R/addReservoirsGRiwrm.R
@@ -1,11 +1,10 @@
-#' Title
+#' Add Seine lakes-reservoirs to the `GRiwrm` object
 #'
-#' @param griwrm
+#' @param griwrm Network description (See [CreateGRiwrm])
 #'
-#' @return
+#' @return `GRiwrm` object with connections of the reservoirs to the Seine network
 #' @export
 #'
-#' @examples
 addReservoirsGRiwrm <- function(griwrm) {
 
     dfConnect <- data.frame(
diff --git a/R/addReservoirsQ.R b/R/addReservoirsQ.R
index fa6f52a..3321b53 100644
--- a/R/addReservoirsQ.R
+++ b/R/addReservoirsQ.R
@@ -1,12 +1,10 @@
-#' Title
+#' Add recorded flows on Seine Grands Lacs reservoir connections to a `BasinsObs` database
 #'
-#' @param BasinsObs
-#' @param path_data
+#' @inheritParams RunModel.BasinsObs
 #'
-#' @return
+#' @return a `BasinsObs` object completed with recorded flows at reservoir connections
 #' @export
 #'
-#' @examples
 addReservoirsQ <- function(BasinsObs, cfg = loadConfig()) {
     P <- BasinsObs$P
     E <- BasinsObs$E
diff --git a/R/calcQJXA.R b/R/calcQJXA.R
index ff9e855..b05b5ec 100644
--- a/R/calcQJXA.R
+++ b/R/calcQJXA.R
@@ -4,7 +4,7 @@
 #'
 #' @param x [POSIXt] dates, or [data.frame] with a first column with dates, or \code{OutputsModel} produced by [airGR::RunModel]
 #' @param flows [numeric] flows in l/s for use with x as a [POSIXt]
-#' @param pRet [numeric] return period in years
+#' @param ... for S3 method compability
 #'
 #' @return A [vector] of [numeric] for x [POSIXt] or \code{OutputsModel} and a [data.frame] for x [data.frame]
 #'
@@ -61,7 +61,7 @@ calcQJXA <- function(x, ...) {
 
 #' @export
 #' @rdname calcQJXA
-calcQJXA.data.frame <- function(x) {
+calcQJXA.data.frame <- function(x, ...) {
   if(ncol(x)<2) stop("x should have at least 2 columns")
   apply(x[,-1, drop=F], 2, function(y) {
     calcQJXA(x[,1], y)
@@ -72,7 +72,7 @@ calcQJXA.data.frame <- function(x) {
 #' @rdname calcQJXA
 #' @export
 calcQJXA.OutputsModel <-
-  function(x) {
+  function(x, ...) {
     calcQJXA(
       x = x$DatesR,
       flows = x$Qsim
@@ -83,7 +83,7 @@ calcQJXA.OutputsModel <-
 #' @rdname calcQJXA
 #' @export
 calcQJXA.POSIXt <-
-  function(x, flows) {
+  function(x, flows, ...) {
     dates <- x
 
     ##_____Arguments_check________________________________________________________
diff --git a/R/calcQMNA.R b/R/calcQMNA.R
index 46efeaf..445d362 100644
--- a/R/calcQMNA.R
+++ b/R/calcQMNA.R
@@ -152,12 +152,11 @@ calcQMNA.POSIXt <- function(x, flows) {
 #' @export
 #'
 #' @examples
-#' # First calculation of QMNAs (Minimum monthly flow for each year)
-#' example("calcQMNA")
+#' #! load data
+#' data(L0123001, package = "airGR")
 #'
-#' # Second calculation of QMNA for a given return period
-#' calcQMNAn(QMNA_Obs, 5)
-#' calcQMNAn(QMNA_GR4J, 5)
+#' dfQ <- data.frame(DatesR = BasinObs$DatesR, Q = BasinObs$Qls / 1000)
+#' calcQMNAn(dfQ, 5)
 #'
 calcQMNAn <- function(x, return_period) {
     UseMethod("calcQMNAn", x)
diff --git a/R/calcVCN.R b/R/calcVCN.R
index de0124d..bd6854c 100644
--- a/R/calcVCN.R
+++ b/R/calcVCN.R
@@ -41,12 +41,12 @@ calcVCN.numeric <- function(x, k, ...) {
 #' @export
 #'
 #' @examples
-#' # First calculation of QMNAs (Minimum monthly flow for each year)
-#' example("calcQMNA")
+#' #! load data
+#' data(L0123001, package = "airGR")
+#' dfQ <- data.frame(DatesR = BasinObs$DatesR, Q = BasinObs$Qls / 1000)
 #'
-#' # Second calculation of QMNA for a given return period
-#' calcQMNAn(QMNA_Obs, 5)
-#' calcQMNAn(QMNA_GR4J, 5)
+#' # VCN10 return period of 2 years
+#' calcVCNn(dfQ, 10, 5)
 #'
 calcVCNn <- function(x, k, return_period, ...) {
     UseMethod("calcVCNn", x)
diff --git a/R/climato_safran2bvi.R b/R/climato_safran2bvi.R
index 2bc7aed..b730e3b 100644
--- a/R/climato_safran2bvi.R
+++ b/R/climato_safran2bvi.R
@@ -1,13 +1,10 @@
-#' Title
+#' Convert a data from a SAFRAn grid to BVI scale
 #'
-#' @param safran
-#' @param dfMailles
-#' @param cfg
+#' @param safran data in SAFRAn format
+#' @param dfMailles correspondence between SAFRAN grid and BVIs
 #'
-#' @return
-#' @export
+#' @return [matrix]
 #'
-#' @examples
 climato_safran2bvi <- function(safran, dfMailles) {
     dfMailles$id_safran <- paste(dfMailles$x, dfMailles$y, sep = "x")
     bvi_ids <- unique(dfMailles$CODE)
diff --git a/R/createBasinsObs.R b/R/createBasinsObs.R
index 6d1881d..46690eb 100644
--- a/R/createBasinsObs.R
+++ b/R/createBasinsObs.R
@@ -1,4 +1,4 @@
-#' Create an object `BasinsObs`
+#' Create an object `BasinsObs` from SAFRAN grid
 #'
 #' @param files [character] containing list of NetCFD DRIAS2020 files to read for precipitation and evaporation and for both historical and RCP periods for a given climatic scenario
 #' @param dfMailles [data.frame] with correspondence between SAFRAN cells and intermediate basins
@@ -13,7 +13,6 @@
 #' @export
 #' @import magrittr
 #'
-#' @examples
 createBasinsObs <- function(files, dfMailles, cfg = loadConfig()) {
 
     # Precipitations
diff --git a/R/data.R b/R/data.R
index fd8ad53..630c76e 100644
--- a/R/data.R
+++ b/R/data.R
@@ -13,6 +13,6 @@
 
 #' Description of the semi-distributed network of the Seine basin gauging stations
 #'
-#' @format A GRiwrm object created by [airGRiwrm:CreateGRiwrm]
+#' @format A GRiwrm object created by [airGRiwrm::CreateGRiwrm]
 #' @references Laura Nunez Torres. Simulation d'un bassin versant anthropisé à l'aide d'un modèle hydrologique semi-distribué : Le bassin de la Seine et ses réservoirs Rapport de stage ST5 -Polytech Sorbonne -1er septembre 2021. Milieux et Changements globaux. 2021. ⟨https://hal.inrae.fr/hal-033596177⟩
 "griwrm"
diff --git a/R/getAprioriIds.R b/R/getAprioriIds.R
index f194f53..ea9d0ae 100644
--- a/R/getAprioriIds.R
+++ b/R/getAprioriIds.R
@@ -1,11 +1,14 @@
-#' Title
+#' Selection of upstream gauging stations as a priori for Lavenne regularisation
 #'
-#' @param InputsModel
+#' @description
+#' This function selects, for each gauging station, which direct upstream gauging station bring the maximum mean flow.
+#' The calibration parameters of this station will be used as "a priori" parameter for the current gauging station (See [airGR::CreateInputsCrit_Lavenne])
 #'
-#' @return
+#' @inheritParams RunModel.BasinsObs
+#'
+#' @return [character] named [vector] with each item defined as follow: station ID as key and upstream a priori station ID as value.
 #' @export
 #'
-#' @examples
 getAprioriIds <- function(InputsModel) {
     unlist(sapply(InputsModel, FUN = function(x) {
         if (!is.null(x$Qupstream)){
diff --git a/R/getDataPath.R b/R/getDataPath.R
index caba716..1106838 100644
--- a/R/getDataPath.R
+++ b/R/getDataPath.R
@@ -1,21 +1,15 @@
 #' Give the complete path of the data
 #'
+#' @description
 #' If the database is a URL, this function can download the file in a temporary folder and returns the path of the downloaded file. This functionality is useful for [readxl::read_excel] (See: https://stackoverflow.com/a/41368947/5300212).
 #'
 #' @param path [character] representing the path of the data in the database
-#' @param download download a URL in a temporary file? (Default `FALSE`)
+#' @param download download a URL in a temporary file? (Default `TRUE`)
 #' @template param_cfg
 #'
 #' @return [character] with the path of the file to read
 #' @export
 #'
-#' @examples
-#' com_france <- readxl::read_excel(
-#'   getDataPath("usages/territoire/table-appartenance-geo-communes-16.xls", download = TRUE),
-#'   sheet = "COM",
-#'   skip = 5
-#' )
-#' str(com_france)
 getDataPath <- function(path, ..., download = TRUE, cfg = loadConfig(), root = cfg$data$path) {
   path <- file.path(path, ...)
 
diff --git a/R/getDrias2020filenames.R b/R/getDrias2020filenames.R
index c33b98b..319decc 100644
--- a/R/getDrias2020filenames.R
+++ b/R/getDrias2020filenames.R
@@ -7,6 +7,7 @@
 #' @export
 #'
 #' @examples
+#' cfg <- loadConfig()
 #' driasFiles <- listDataFiles(file.path(cfg$hydroclim$path, "drias"))
 #' getDrias2020filenames("HadGEM2-ES/CCLM4-8-17", driasFiles)
 #'
diff --git a/R/listDataFiles.R b/R/listDataFiles.R
index cfee71c..d040f51 100644
--- a/R/listDataFiles.R
+++ b/R/listDataFiles.R
@@ -3,13 +3,15 @@
 #'
 #' @param path a character vector of full path names; the default corresponds to the working
 #'             directory, getwd().
-#' @param cfg
+#' @template param_cfg
 #' @param ... Further parameters pass to [base::list.files]
 #'
-#' @return
+#' @return [character] [vector] with the file names
 #' @export
 #'
 #' @examples
+#' cfg <- loadConfig()
+#' listDataFiles(cfg$hydroclim$path)
 listDataFiles <- function(path, cfg = loadConfig(), ...) {
     if (cfg$data$cloud) {
         readLines(getDataPath(path, "list.files.txt"))
diff --git a/R/loadBasinsObs.R b/R/loadBasinsObs.R
index 19c8155..4fc1ceb 100644
--- a/R/loadBasinsObs.R
+++ b/R/loadBasinsObs.R
@@ -4,10 +4,13 @@
 #' @param griwrm GRiwrm object describing the semi-distributed network (default `data("griwrm")`, see [griwrm])
 #' @template param_cfg
 #'
-#' @return
+#' @return A `BasinsObs` object (See [createBasinsObs])
 #' @export
 #'
 #' @examples
+#' BasinsObs <- loadBasinsObs("BasinsObs_observations_day_1958-2019.RDS")
+#' str(BasinsObs)
+#'
 loadBasinsObs <- function(RDataFile, griwrm = NULL, cfg = loadConfig()) {
 
     file <- getDataPath(cfg$hydroclim$path, RDataFile, cfg = cfg)
diff --git a/R/loadCalibrationParams.R b/R/loadCalibrationParams.R
index 111be94..fb7d61b 100644
--- a/R/loadCalibrationParams.R
+++ b/R/loadCalibrationParams.R
@@ -1,12 +1,14 @@
-#' Title
+#' Load model calibration parameter
 #'
-#' @param fileName
-#' @param cfg
+#' @details
+#' This function is essentially called by [RunModel.BasinsObs].
 #'
-#' @return
+#' @param fileName name of the file containing the calibration parameters (See [Calibration.BasinsObs])
+#' @template param_cfg
+#'
+#' @return [list] with one item by gauging station containing a [numeric] [vector] of parameters
 #' @export
 #'
-#' @examples
 loadCalibrationParams <- function(fileName, cfg = loadConfig()) {
     file <- getDataPath(cfg$calibration$path, fileName)
     df <- read.csv(file)
diff --git a/R/loadHydratecDB.R b/R/loadHydratecDB.R
index 7d0b0b5..a147bdd 100644
--- a/R/loadHydratecDB.R
+++ b/R/loadHydratecDB.R
@@ -9,7 +9,6 @@
 #'         - `Q`: the times series of daily flows
 #' @export
 #'
-#' @examples
 loadHydratecDB <- function(cfg = loadConfig()) {
     # Load time series
     file <- getDataPath(cfg$hydroclim$path, "EPTB_SGL/Qnat/Hydratec/Q_NAT_1900-2009.txt", cfg = cfg)
diff --git a/R/loadHypsoData.R b/R/loadHypsoData.R
index 1254b65..bcd8e7e 100644
--- a/R/loadHypsoData.R
+++ b/R/loadHypsoData.R
@@ -1,11 +1,14 @@
-#' Title
+#' Load hypsometric data for Cemaneige snow module
 #'
-#' @param data_path
+#' @description
+#' Read all the files contained in the folder `cfg$hydroclim$path`/courbes_hypsometriques
+#' and merge them into a matrix
 #'
-#' @return
+#' @template param_cfg
+#'
+#' @return [matrix] with one column by gauging station
 #' @export
 #'
-#' @examples
 loadHypsoData <- function(cfg = loadConfig()) {
     path_hypso <- file.path(cfg$hydroclim$path, "courbes_hypsometriques")
     hypso <- listDataFiles(path_hypso)
diff --git a/R/readDrias2020.R b/R/readDrias2020.R
index 7a6c83f..9d9d07a 100644
--- a/R/readDrias2020.R
+++ b/R/readDrias2020.R
@@ -4,7 +4,7 @@
 #' `files` could be a vector with the "Historical" and the "rcpn.n" files, the two times series are then merged into a continuous one.
 #'
 #' @param files [character] One or more file names to read without the path
-#' @param cfg
+#' @template param_cfg
 #' @param path the path of the files
 #'
 #' @return A [list] containing items:
diff --git a/R/saveFlowDB.R b/R/saveFlowDB.R
index 7fbd0d7..3514cea 100644
--- a/R/saveFlowDB.R
+++ b/R/saveFlowDB.R
@@ -1,14 +1,13 @@
 #' Save database of one simulation
 #'
 #' @param path [character] the location used to save the database
-#' @param InputsModel [GRiwrmInputsModel] see [CreateInputsModel.BasinsObs]
-#' @param OutputsModel [GriwrmOutputsModel] see [RunModel.BasinsObs]
+#' @param InputsModel `GRiwrmInputsModel` object. See [CreateInputsModel.BasinsObs]
+#' @param OutputsModel `GriwrmOutputsModel` object. See [RunModel.BasinsObs]
 #' @template param_cfg
 #'
-#' @return
+#' @return `TRUE` if the last copy successed
 #' @export
 #'
-#' @examples
 saveFlowDB <- function(path, InputsModel, OutputsModel, cfg = loadConfig()) {
     if (cfg$data$write_results) {
 
diff --git a/R/selectBasins.R b/R/selectBasins.R
index 1fea80f..9cf0929 100644
--- a/R/selectBasins.R
+++ b/R/selectBasins.R
@@ -1,12 +1,3 @@
-#' Title
-#'
-#' @param BasinsObs
-#' @param ids
-#'
-#' @return
-#' @export
-#'
-#' @examples
 selectBasins <- function(BasinsObs, ids) {
     items <- names(BasinsObs)
     names(items) <- items
diff --git a/man-roxygen/param_cfg.R b/man-roxygen/param_cfg.R
index ec1c60e..e13b7e7 100644
--- a/man-roxygen/param_cfg.R
+++ b/man-roxygen/param_cfg.R
@@ -1 +1 @@
-#' @param cfg a [config] object. Configuration to use. See [LoadConfig] for details
+#' @param cfg a config object. Configuration to use. See [loadConfig] for details
diff --git a/man/Calibration.BasinsObs.Rd b/man/Calibration.BasinsObs.Rd
index 9b67282..4be7a35 100644
--- a/man/Calibration.BasinsObs.Rd
+++ b/man/Calibration.BasinsObs.Rd
@@ -6,22 +6,50 @@
 \usage{
 \method{Calibration}{BasinsObs}(
   BasinsObs,
-  ParamFile,
+  paramFile,
   InputsModel = CreateInputsModel(BasinsObs),
   IndPeriod_WarmUp = seq(1, 365),
   IndPeriod_Run = seq(366, length(BasinsObs$DatesR)),
   FUN_CRIT = airGR::ErrorCrit_KGE2,
   AprioriIds = getAprioriIds(InputsModel),
   transfo = "sqrt",
-  cfg = loadConfig()
+  cfg = loadConfig(),
+  ...
 )
 }
 \arguments{
-\item{path_data}{}
+\item{BasinsObs}{an object of class \emph{BasinsObs}, see \link{loadBasinsObs} and \link{createBasinsObs}}
+
+\item{paramFile}{\link{character} the path of the file containing the model parameters (use to call \link{loadCalibrationParams})}
+
+\item{InputsModel}{an object of class \emph{GRiwrmInputsModel}, see \link{CreateInputsModel.BasinsObs}}
+
+\item{IndPeriod_WarmUp}{(optional) \link{numeric} index of period to be used for the model warm-up \link{-}. See \link[airGR:CreateRunOptions]{airGR::CreateRunOptions} for details}
+
+\item{IndPeriod_Run}{(optional) \link{numeric} index of period to be used for the model run \link{-}. See \link[airGR:CreateRunOptions]{airGR::CreateRunOptions} for details}
+
+\item{FUN_CRIT}{See \link[airGRiwrm:CreateInputsCrit]{airGRiwrm::CreateInputsCrit}}
+
+\item{AprioriIds}{See \link[airGRiwrm:CreateInputsCrit]{airGRiwrm::CreateInputsCrit}}
+
+\item{transfo}{See \link[airGR:CreateInputsCrit]{airGR::CreateInputsCrit}}
+
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
+
+\item{...}{not used (compatibility with others S3 methods)}
 }
 \value{
-
+a \code{GRiwrmOutputsCalib} object which is a \link{list} of \code{OutputsCalib} objects with one item per modelled sub-catchment. See \link[airGRiwrm:Calibration]{airGRiwrm::Calibration}
 }
 \description{
-Simplified Calibration for BasinsObs object
+It calls automatically:
+\itemize{
+\item \link{CreateInputsModel.BasinsObs}
+\item \link[airGRiwrm:CreateRunOptions]{airGRiwrm::CreateRunOptions}
+\item \link[airGRiwrm:CreateInputsCrit]{airGRiwrm::CreateInputsCrit}
+\item \link[airGRiwrm:CreateCalibOptions]{airGRiwrm::CreateCalibOptions}
+\item \link[airGRiwrm:Calibration]{airGRiwrm::Calibration}
+}
+
+It calculates performance indicator on the model and save parameters and performance indicators into the file (\code{paramFile}).
 }
diff --git a/man/CreateInputsModel.BasinsObs.Rd b/man/CreateInputsModel.BasinsObs.Rd
index 27f8c1c..affff6f 100644
--- a/man/CreateInputsModel.BasinsObs.Rd
+++ b/man/CreateInputsModel.BasinsObs.Rd
@@ -2,16 +2,18 @@
 % Please edit documentation in R/CreateInputsModel.R
 \name{CreateInputsModel.BasinsObs}
 \alias{CreateInputsModel.BasinsObs}
-\title{Title}
+\title{Create Inputs for \emph{airGRiwrm} model with \code{BasinsObs} object}
 \usage{
-\method{CreateInputsModel}{BasinsObs}(BasinsObs)
+\method{CreateInputsModel}{BasinsObs}(BasinsObs, ...)
 }
 \arguments{
-\item{BasinsObs}{}
+\item{BasinsObs}{an object of class \emph{BasinsObs}, see \link{loadBasinsObs} and \link{createBasinsObs}}
+
+\item{...}{not used (compatibility with others S3 methods)}
 }
 \value{
-
+See return value of \link[airGRiwrm:CreateInputsModel]{airGRiwrm::CreateInputsModel}
 }
 \description{
-Title
+Create Inputs for \emph{airGRiwrm} model with \code{BasinsObs} object
 }
diff --git a/man/RunModel.BasinsObs.Rd b/man/RunModel.BasinsObs.Rd
index ff31793..386e7fe 100644
--- a/man/RunModel.BasinsObs.Rd
+++ b/man/RunModel.BasinsObs.Rd
@@ -2,7 +2,7 @@
 % Please edit documentation in R/RunModel.R
 \name{RunModel.BasinsObs}
 \alias{RunModel.BasinsObs}
-\title{RunModel function for *BasinsObs* object}
+\title{RunModel function for \emph{BasinsObs} object}
 \usage{
 \method{RunModel}{BasinsObs}(
   BasinsObs,
@@ -10,25 +10,28 @@
   InputsModel = suppressMessages(CreateInputsModel(BasinsObs)),
   IndPeriod_WarmUp = seq(1, 365),
   IndPeriod_Run = seq(366, length(BasinsObs$DatesR)),
-  cfg = loadConfig()
+  cfg = loadConfig(),
+  ...
 )
 }
 \arguments{
-\item{BasinsObs}{an object of class *BasinsObs*, see [loadBasinsObs] and [createBasinsObs]}
+\item{BasinsObs}{an object of class \emph{BasinsObs}, see \link{loadBasinsObs} and \link{createBasinsObs}}
 
-\item{paramFile}{[character] the path of the file containing the model parameters (use to call [loadCalibrationParams])}
+\item{paramFile}{\link{character} the path of the file containing the model parameters (use to call \link{loadCalibrationParams})}
 
-\item{InputsModel}{an object of class *GRiwrmInputsModel*, see [CreateInputsModel.BasinsObs]}
+\item{InputsModel}{an object of class \emph{GRiwrmInputsModel}, see \link{CreateInputsModel.BasinsObs}}
 
-\item{IndPeriod_WarmUp}{(optional) [numeric] index of period to be used for the model warm-up [-]. See [airGR::CreateRunOptions] for details}
+\item{IndPeriod_WarmUp}{(optional) \link{numeric} index of period to be used for the model warm-up \link{-}. See \link[airGR:CreateRunOptions]{airGR::CreateRunOptions} for details}
 
-\item{IndPeriod_Run}{(optional) [numeric] index of period to be used for the model run [-]. See [airGR::CreateRunOptions] for details}
+\item{IndPeriod_Run}{(optional) \link{numeric} index of period to be used for the model run \link{-}. See \link[airGR:CreateRunOptions]{airGR::CreateRunOptions} for details}
 
-\item{cfg}{a [config] object. Configuration to use. See [LoadConfig] for details}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
+
+\item{...}{not used (compatibility with others S3 methods)}
 }
 \value{
-An object of class *GriwrmOutputsModel* produced by [airGriwrm::RunModel.GRiwrmInputsModel]
+An object of class \emph{GriwrmOutputsModel} produced by \link[airGRiwrm:RunModel.GRiwrmInputsModel]{airGRiwrm::RunModel.GRiwrmInputsModel}
 }
 \description{
-This function simplifies the run of an airGRiwrm model by chaining all the steps ([airGRiwrm::CreateInputsModel.GRiwrm], [airGRiwrm::CreateRunOptions.GRiwrmInputsModel] and [airGriwrm::RunModel.GRiwrmInputsModel]) into one single step.
+This function simplifies the run of an airGRiwrm model by chaining all the steps (\link[airGRiwrm:CreateInputsModel.GRiwrm]{airGRiwrm::CreateInputsModel.GRiwrm}, \link[airGRiwrm:CreateRunOptions]{airGRiwrm::CreateRunOptions.GRiwrmInputsModel} and \link[airGRiwrm:RunModel.GRiwrmInputsModel]{airGRiwrm::RunModel.GRiwrmInputsModel}) into one single step.
 }
diff --git a/man/addReservoirsGRiwrm.Rd b/man/addReservoirsGRiwrm.Rd
index 0aa06b9..2a45193 100644
--- a/man/addReservoirsGRiwrm.Rd
+++ b/man/addReservoirsGRiwrm.Rd
@@ -2,16 +2,16 @@
 % Please edit documentation in R/addReservoirsGRiwrm.R
 \name{addReservoirsGRiwrm}
 \alias{addReservoirsGRiwrm}
-\title{Title}
+\title{Add Seine lakes-reservoirs to the \code{GRiwrm} object}
 \usage{
 addReservoirsGRiwrm(griwrm)
 }
 \arguments{
-\item{griwrm}{}
+\item{griwrm}{Network description (See \link{CreateGRiwrm})}
 }
 \value{
-
+\code{GRiwrm} object with connections of the reservoirs to the Seine network
 }
 \description{
-Title
+Add Seine lakes-reservoirs to the \code{GRiwrm} object
 }
diff --git a/man/addReservoirsQ.Rd b/man/addReservoirsQ.Rd
index c72cbf6..6c8b807 100644
--- a/man/addReservoirsQ.Rd
+++ b/man/addReservoirsQ.Rd
@@ -2,16 +2,18 @@
 % Please edit documentation in R/addReservoirsQ.R
 \name{addReservoirsQ}
 \alias{addReservoirsQ}
-\title{Title}
+\title{Add recorded flows on Seine Grands Lacs reservoir connections to a \code{BasinsObs} database}
 \usage{
 addReservoirsQ(BasinsObs, cfg = loadConfig())
 }
 \arguments{
-\item{path_data}{}
+\item{BasinsObs}{an object of class \emph{BasinsObs}, see \link{loadBasinsObs} and \link{createBasinsObs}}
+
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-
+a \code{BasinsObs} object completed with recorded flows at reservoir connections
 }
 \description{
-Title
+Add recorded flows on Seine Grands Lacs reservoir connections to a \code{BasinsObs} database
 }
diff --git a/man/areaPoly.Rd b/man/areaPoly.Rd
index 3c548e4..3926a3f 100644
--- a/man/areaPoly.Rd
+++ b/man/areaPoly.Rd
@@ -7,13 +7,13 @@
 areaPoly(sp.object = NULL)
 }
 \arguments{
-\item{sp.object}{`SpatialPolygonsDataFrame`, must be a `SpatialPolygonsDataFrame` object}
+\item{sp.object}{\code{SpatialPolygonsDataFrame}, must be a \code{SpatialPolygonsDataFrame} object}
 }
 \value{
 a numeric vector
 }
 \description{
-Calculates the area of each polygon in [sp::SpatialPolygonsDataFrame].
+Calculates the area of each polygon in \link[sp:SpatialPolygons]{sp::SpatialPolygonsDataFrame}.
 }
 \note{
 Copied from the UScensus2010 package
diff --git a/man/calcQJXA.Rd b/man/calcQJXA.Rd
index cf3e6eb..d93415f 100644
--- a/man/calcQJXA.Rd
+++ b/man/calcQJXA.Rd
@@ -9,21 +9,21 @@
 \usage{
 calcQJXA(x, ...)
 
-\method{calcQJXA}{data.frame}(x)
+\method{calcQJXA}{data.frame}(x, ...)
 
-\method{calcQJXA}{OutputsModel}(x)
+\method{calcQJXA}{OutputsModel}(x, ...)
 
-\method{calcQJXA}{POSIXt}(x, flows)
+\method{calcQJXA}{POSIXt}(x, flows, ...)
 }
 \arguments{
-\item{x}{[POSIXt] dates, or [data.frame] with a first column with dates, or \code{OutputsModel} produced by [airGR::RunModel]}
+\item{x}{\link{POSIXt} dates, or \link{data.frame} with a first column with dates, or \code{OutputsModel} produced by \link[airGR:RunModel]{airGR::RunModel}}
 
-\item{flows}{[numeric] flows in l/s for use with x as a [POSIXt]}
+\item{...}{for S3 method compability}
 
-\item{pRet}{[numeric] return period in years}
+\item{flows}{\link{numeric} flows in l/s for use with x as a \link{POSIXt}}
 }
 \value{
-A [vector] of [numeric] for x [POSIXt] or \code{OutputsModel} and a [data.frame] for x [data.frame]
+A \link{vector} of \link{numeric} for x \link{POSIXt} or \code{OutputsModel} and a \link{data.frame} for x \link{data.frame}
 }
 \description{
 Calculation of Maximum daily flow per year.
diff --git a/man/calcQJXAn.Rd b/man/calcQJXAn.Rd
index 16268e1..627379b 100644
--- a/man/calcQJXAn.Rd
+++ b/man/calcQJXAn.Rd
@@ -16,12 +16,12 @@ calcQJXAn(x, return_period)
 \method{calcQJXAn}{GumbelParams}(x, return_period)
 }
 \arguments{
-\item{return_period}{[numeric] Return period. Its unit is given by the aggregation time step used for the Gumbel law.}
+\item{return_period}{\link{numeric} Return period. Its unit is given by the aggregation time step used for the Gumbel law.}
 
-\item{gumbel}{A [list] with `a` the location parameter and `b` the scale parameter}
+\item{gumbel}{A \link{list} with \code{a} the location parameter and \code{b} the scale parameter}
 }
 \value{
-A [numeric] with the calculated flow
+A \link{numeric} with the calculated flow
 }
 \description{
 Compute the flow for a given Gumbel law
diff --git a/man/calcQLogNn.Rd b/man/calcQLogNn.Rd
index 6c22ebf..bc6cd0c 100644
--- a/man/calcQLogNn.Rd
+++ b/man/calcQLogNn.Rd
@@ -7,9 +7,9 @@
 calcQLogNn(x, return_period)
 }
 \arguments{
-\item{x}{[numeric] vector of annual data to process}
+\item{x}{\link{numeric} vector of annual data to process}
 
-\item{return_period}{[numeric] Return period in years}
+\item{return_period}{\link{numeric} Return period in years}
 }
 \value{
 The value for the return period according to Galton distribution
diff --git a/man/calcQMNA.Rd b/man/calcQMNA.Rd
index 100dfed..f467553 100644
--- a/man/calcQMNA.Rd
+++ b/man/calcQMNA.Rd
@@ -16,12 +16,12 @@ calcQMNA(x, ...)
 \method{calcQMNA}{POSIXt}(x, flows)
 }
 \arguments{
-\item{x}{either [POSIXt] dates, or a [data.frame] with a first column of [POSIXt] dates and flows in the other columns, or a \code{airGR::OutputsModel} which is an output of [airGR::RunModel()]}
+\item{x}{either \link{POSIXt} dates, or a \link{data.frame} with a first column of \link{POSIXt} dates and flows in the other columns, or a \code{airGR::OutputsModel} which is an output of \code{\link[airGR:RunModel]{airGR::RunModel()}}}
 
-\item{flows}{[numeric] flows in l/s}
+\item{flows}{\link{numeric} flows in l/s}
 }
 \value{
-[numeric] a numeric value of QMNA
+\link{numeric} a numeric value of QMNA
 }
 \description{
 Calculation of QMNAs (annual minimum of mean monthly flows)
diff --git a/man/calcQMNAn.Rd b/man/calcQMNAn.Rd
index ad84825..65eaf9c 100644
--- a/man/calcQMNAn.Rd
+++ b/man/calcQMNAn.Rd
@@ -13,22 +13,21 @@ calcQMNAn(x, return_period)
 \method{calcQMNAn}{data.frame}(x, return_period)
 }
 \arguments{
-\item{x}{[numeric] vector of mean monthly flows}
+\item{x}{\link{numeric} vector of mean monthly flows}
 
-\item{return_period}{[numeric] number of years}
+\item{return_period}{\link{numeric} number of years}
 }
 \value{
-[numeric] QMNA for the given return period
+\link{numeric} QMNA for the given return period
 }
 \description{
 Calculation of QMNA according to a return period. An adjustment to a Galton distribution (log-normal distribution) is realised.
 }
 \examples{
-# First calculation of QMNAs (Minimum monthly flow for each year)
-example("calcQMNA")
+#! load data
+data(L0123001, package = "airGR")
 
-# Second calculation of QMNA for a given return period
-calcQMNAn(QMNA_Obs, 5)
-calcQMNAn(QMNA_GR4J, 5)
+dfQ <- data.frame(DatesR = BasinObs$DatesR, Q = BasinObs$Qls / 1000)
+calcQMNAn(dfQ, 5)
 
 }
diff --git a/man/calcVCN.Rd b/man/calcVCN.Rd
index 5e33181..8e95c2d 100644
--- a/man/calcVCN.Rd
+++ b/man/calcVCN.Rd
@@ -13,14 +13,14 @@ calcVCN(x, k, ...)
 \method{calcVCN}{numeric}(x, k, ...)
 }
 \arguments{
-\item{x}{[numeric] or [matrix] for respectively a time series and several times series}
+\item{x}{\link{numeric} or \link{matrix} for respectively a time series and several times series}
 
-\item{k}{[numeric] period in days}
+\item{k}{\link{numeric} period in days}
 
-\item{...}{further parameters to send to [zoo::rollmean]}
+\item{...}{further parameters to send to \link[zoo:rollmean]{zoo::rollmean}}
 }
 \value{
-A 1-length [numeric] for a single time series, a [numeric] otherwise.
+A 1-length \link{numeric} for a single time series, a \link{numeric} otherwise.
 }
 \description{
 VCN means "Volume Consécutif Minimal" in French :)
diff --git a/man/calcVCNn.Rd b/man/calcVCNn.Rd
index e2f0016..6bcb1e3 100644
--- a/man/calcVCNn.Rd
+++ b/man/calcVCNn.Rd
@@ -10,22 +10,22 @@ calcVCNn(x, k, return_period, ...)
 \method{calcVCNn}{data.frame}(x, k, return_period, ...)
 }
 \arguments{
-\item{x}{[numeric] vector of VCN of one year}
+\item{x}{\link{numeric} vector of VCN of one year}
 
-\item{return_period}{[numeric] number of years}
+\item{return_period}{\link{numeric} number of years}
 }
 \value{
-[numeric] VCN for the given return period
+\link{numeric} VCN for the given return period
 }
 \description{
 Calculation of VCN according to a return period. An adjustment to a Galton distribution (log-normal distribution) is realised.
 }
 \examples{
-# First calculation of QMNAs (Minimum monthly flow for each year)
-example("calcQMNA")
+#! load data
+data(L0123001, package = "airGR")
+dfQ <- data.frame(DatesR = BasinObs$DatesR, Q = BasinObs$Qls / 1000)
 
-# Second calculation of QMNA for a given return period
-calcQMNAn(QMNA_Obs, 5)
-calcQMNAn(QMNA_GR4J, 5)
+# VCN10 return period of 2 years
+calcVCNn(dfQ, 10, 5)
 
 }
diff --git a/man/climato_safran2bvi.Rd b/man/climato_safran2bvi.Rd
index f8be0c7..9a80572 100644
--- a/man/climato_safran2bvi.Rd
+++ b/man/climato_safran2bvi.Rd
@@ -2,16 +2,18 @@
 % Please edit documentation in R/climato_safran2bvi.R
 \name{climato_safran2bvi}
 \alias{climato_safran2bvi}
-\title{Title}
+\title{Convert a data from a SAFRAn grid to BVI scale}
 \usage{
 climato_safran2bvi(safran, dfMailles)
 }
 \arguments{
-\item{cfg}{}
+\item{safran}{data in SAFRAn format}
+
+\item{dfMailles}{correspondence between SAFRAN grid and BVIs}
 }
 \value{
-
+\link{matrix}
 }
 \description{
-Title
+Convert a data from a SAFRAn grid to BVI scale
 }
diff --git a/man/createBasinsObs.Rd b/man/createBasinsObs.Rd
index 50c1941..ba822f0 100644
--- a/man/createBasinsObs.Rd
+++ b/man/createBasinsObs.Rd
@@ -2,23 +2,24 @@
 % Please edit documentation in R/createBasinsObs.R
 \name{createBasinsObs}
 \alias{createBasinsObs}
-\title{Create an object `BasinsObs`}
+\title{Create an object \code{BasinsObs} from SAFRAN grid}
 \usage{
 createBasinsObs(files, dfMailles, cfg = loadConfig())
 }
 \arguments{
-\item{files}{[character] containing list of NetCFD DRIAS2020 files to read for precipitation and evaporation and for both historical and RCP periods for a given climatic scenario}
+\item{files}{\link{character} containing list of NetCFD DRIAS2020 files to read for precipitation and evaporation and for both historical and RCP periods for a given climatic scenario}
 
-\item{dfMailles}{[data.frame] with correspondence between SAFRAN cells and intermediate basins}
+\item{dfMailles}{\link{data.frame} with correspondence between SAFRAN cells and intermediate basins}
 }
 \value{
-A [list] of class `BasinsObs` containing:
-
-- `DatesR`: [POSIXt] vector of dates required to create the GR model and CemaNeige module inputs
-- `P`: [matrix] containing precipitation in \[mm per time step\]. Column names correspond to node IDs
-- `Temp`: [matrix] containing mean temperature in \[°C\]. Column names correspond to node IDs
-- `E`: [matrix] containing potential evaporation in \[mm per time step\]. Column names correspond to node IDs
+A \link{list} of class \code{BasinsObs} containing:
+\itemize{
+\item \code{DatesR}: \link{POSIXt} vector of dates required to create the GR model and CemaNeige module inputs
+\item \code{P}: \link{matrix} containing precipitation in [mm per time step]. Column names correspond to node IDs
+\item \code{Temp}: \link{matrix} containing mean temperature in [°C]. Column names correspond to node IDs
+\item \code{E}: \link{matrix} containing potential evaporation in [mm per time step]. Column names correspond to node IDs
+}
 }
 \description{
-Create an object `BasinsObs`
+Create an object \code{BasinsObs} from SAFRAN grid
 }
diff --git a/man/getAprioriIds.Rd b/man/getAprioriIds.Rd
index 09ffa94..97cb87d 100644
--- a/man/getAprioriIds.Rd
+++ b/man/getAprioriIds.Rd
@@ -2,16 +2,17 @@
 % Please edit documentation in R/getAprioriIds.R
 \name{getAprioriIds}
 \alias{getAprioriIds}
-\title{Title}
+\title{Selection of upstream gauging stations as a priori for Lavenne regularisation}
 \usage{
 getAprioriIds(InputsModel)
 }
 \arguments{
-\item{InputsModel}{}
+\item{InputsModel}{an object of class \emph{GRiwrmInputsModel}, see \link{CreateInputsModel.BasinsObs}}
 }
 \value{
-
+\link{character} named \link{vector} with each item defined as follow: station ID as key and upstream a priori station ID as value.
 }
 \description{
-Title
+This function selects, for each gauging station, which direct upstream gauging station bring the maximum mean flow.
+The calibration parameters of this station will be used as "a priori" parameter for the current gauging station (See \link[airGR:CreateInputsCrit_Lavenne]{airGR::CreateInputsCrit_Lavenne})
 }
diff --git a/man/getDataPath.Rd b/man/getDataPath.Rd
index 4183b33..d04b5a6 100644
--- a/man/getDataPath.Rd
+++ b/man/getDataPath.Rd
@@ -13,23 +13,15 @@ getDataPath(
 )
 }
 \arguments{
-\item{path}{[character] representing the path of the data in the database}
+\item{path}{\link{character} representing the path of the data in the database}
 
-\item{download}{download a URL in a temporary file? (Default `FALSE`)}
+\item{download}{download a URL in a temporary file? (Default \code{TRUE})}
 
-\item{cfg}{a [config] object. Configuration to use. See [LoadConfig] for details}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-[character] with the path of the file to read
+\link{character} with the path of the file to read
 }
 \description{
-If the database is a URL, this function can download the file in a temporary folder and returns the path of the downloaded file. This functionality is useful for [readxl::read_excel] (See: https://stackoverflow.com/a/41368947/5300212).
-}
-\examples{
-com_france <- readxl::read_excel(
-  getDataPath("usages/territoire/table-appartenance-geo-communes-16.xls", download = TRUE),
-  sheet = "COM",
-  skip = 5
-)
-str(com_france)
+If the database is a URL, this function can download the file in a temporary folder and returns the path of the downloaded file. This functionality is useful for \link[readxl:read_excel]{readxl::read_excel} (See: https://stackoverflow.com/a/41368947/5300212).
 }
diff --git a/man/getDrias2020filenames.Rd b/man/getDrias2020filenames.Rd
index fd1b4ef..11bc9ac 100644
--- a/man/getDrias2020filenames.Rd
+++ b/man/getDrias2020filenames.Rd
@@ -7,17 +7,18 @@
 getDrias2020filenames(scenario, scenario_data_files)
 }
 \arguments{
-\item{scenario}{[character] Scenario name in format "GCM/RCM"}
+\item{scenario}{\link{character} Scenario name in format "GCM/RCM"}
 
-\item{scenario_data_files}{[character] Names of DRIAS 2020 netCDF files}
+\item{scenario_data_files}{\link{character} Names of DRIAS 2020 netCDF files}
 }
 \value{
-A [character] vector of selected DRIAS 2020 files
+A \link{character} vector of selected DRIAS 2020 files
 }
 \description{
 Extract the names of the files concerned by a GCM/RCM scenario
 }
 \examples{
+cfg <- loadConfig()
 driasFiles <- listDataFiles(file.path(cfg$hydroclim$path, "drias"))
 getDrias2020filenames("HadGEM2-ES/CCLM4-8-17", driasFiles)
 
diff --git a/man/getGumbelParams.Rd b/man/getGumbelParams.Rd
index ddc3f76..021bec3 100644
--- a/man/getGumbelParams.Rd
+++ b/man/getGumbelParams.Rd
@@ -10,7 +10,7 @@ getGumbelParams(x)
 \item{x}{Maximum flow at a given time step (usually the maximum daily flow per year)}
 }
 \value{
-A [list] with `a` the location parameter and `b` the scale parameter
+A \link{list} with \code{a} the location parameter and \code{b} the scale parameter
 }
 \description{
 Compute Gumbel's laws parameters
diff --git a/man/gis_bvi.Rd b/man/gis_bvi.Rd
index 061c55a..c0bc097 100644
--- a/man/gis_bvi.Rd
+++ b/man/gis_bvi.Rd
@@ -5,7 +5,7 @@
 \alias{gis_bvi}
 \title{GIS layer of intermediate water basins of the Seine basin.}
 \format{
-A [sp::SpatialPolygonsDataFrame] object with the intermediate water basins
+A \link[sp:SpatialPolygons]{sp::SpatialPolygonsDataFrame} object with the intermediate water basins
 }
 \usage{
 gis_bvi
diff --git a/man/griwrm.Rd b/man/griwrm.Rd
index 95e6ad9..d5c6fd5 100644
--- a/man/griwrm.Rd
+++ b/man/griwrm.Rd
@@ -5,7 +5,7 @@
 \alias{griwrm}
 \title{Description of the semi-distributed network of the Seine basin gauging stations}
 \format{
-A GRiwrm object created by [airGRiwrm:CreateGRiwrm]
+A GRiwrm object created by \link[airGRiwrm:CreateGRiwrm]{airGRiwrm::CreateGRiwrm}
 }
 \usage{
 griwrm
diff --git a/man/hello.Rd b/man/hello.Rd
deleted file mode 100644
index 0fa7c4b..0000000
--- a/man/hello.Rd
+++ /dev/null
@@ -1,12 +0,0 @@
-\name{hello}
-\alias{hello}
-\title{Hello, World!}
-\usage{
-hello()
-}
-\description{
-Prints 'Hello, world!'.
-}
-\examples{
-hello()
-}
diff --git a/man/listDataFiles.Rd b/man/listDataFiles.Rd
index 28f5ebf..745356a 100644
--- a/man/listDataFiles.Rd
+++ b/man/listDataFiles.Rd
@@ -2,7 +2,7 @@
 % Please edit documentation in R/listDataFiles.R
 \name{listDataFiles}
 \alias{listDataFiles}
-\title{Wrapper of [base::list.files] for handling cloud storage}
+\title{Wrapper of \link[base:list.files]{base::list.files} for handling cloud storage}
 \usage{
 listDataFiles(path, cfg = loadConfig(), ...)
 }
@@ -10,11 +10,17 @@ listDataFiles(path, cfg = loadConfig(), ...)
 \item{path}{a character vector of full path names; the default corresponds to the working
 directory, getwd().}
 
-\item{...}{Further parameters pass to [base::list.files]}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
+
+\item{...}{Further parameters pass to \link[base:list.files]{base::list.files}}
 }
 \value{
-
+\link{character} \link{vector} with the file names
 }
 \description{
-Wrapper of [base::list.files] for handling cloud storage
+Wrapper of \link[base:list.files]{base::list.files} for handling cloud storage
+}
+\examples{
+cfg <- loadConfig()
+listDataFiles(cfg$hydroclim$path)
 }
diff --git a/man/loadBasinsObs.Rd b/man/loadBasinsObs.Rd
index 4de8218..c1eb39d 100644
--- a/man/loadBasinsObs.Rd
+++ b/man/loadBasinsObs.Rd
@@ -7,15 +7,20 @@
 loadBasinsObs(RDataFile, griwrm = NULL, cfg = loadConfig())
 }
 \arguments{
-\item{RDataFile}{path of the file inside `cfg$hydroclim$path`}
+\item{RDataFile}{path of the file inside \code{cfg$hydroclim$path}}
 
-\item{griwrm}{GRiwrm object describing the semi-distributed network (default `data("griwrm")`, see [griwrm])}
+\item{griwrm}{GRiwrm object describing the semi-distributed network (default \code{data("griwrm")}, see \link{griwrm})}
 
-\item{cfg}{a [config] object. Configuration to use. See [LoadConfig] for details}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-
+A \code{BasinsObs} object (See \link{createBasinsObs})
 }
 \description{
 Load observations for the semi-distributed model
 }
+\examples{
+BasinsObs <- loadBasinsObs("BasinsObs_observations_day_1958-2019.RDS")
+str(BasinsObs)
+
+}
diff --git a/man/loadCalibrationParams.Rd b/man/loadCalibrationParams.Rd
index 1825d70..d8f1d6d 100644
--- a/man/loadCalibrationParams.Rd
+++ b/man/loadCalibrationParams.Rd
@@ -2,16 +2,21 @@
 % Please edit documentation in R/loadCalibrationParams.R
 \name{loadCalibrationParams}
 \alias{loadCalibrationParams}
-\title{Title}
+\title{Load model calibration parameter}
 \usage{
 loadCalibrationParams(fileName, cfg = loadConfig())
 }
 \arguments{
-\item{cfg}{}
+\item{fileName}{name of the file containing the calibration parameters (See \link{Calibration.BasinsObs})}
+
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-
+\link{list} with one item by gauging station containing a \link{numeric} \link{vector} of parameters
 }
 \description{
-Title
+Load model calibration parameter
+}
+\details{
+This function is essentially called by \link{RunModel.BasinsObs}.
 }
diff --git a/man/loadConfig.Rd b/man/loadConfig.Rd
index 242d89a..705e863 100644
--- a/man/loadConfig.Rd
+++ b/man/loadConfig.Rd
@@ -15,7 +15,7 @@ loadConfig(
 \item{pathDefaultCfg}{The location of the default configuration (located in "inst/config.yml" of the package by default)}
 }
 \value{
-A configuration as it is returned by [config::get]
+A configuration as it is returned by \link[config:get]{config::get}
 }
 \description{
 Read default configuration of the package and complete it with eventual user config
diff --git a/man/loadHydratecDB.Rd b/man/loadHydratecDB.Rd
index 3a7461e..237c512 100644
--- a/man/loadHydratecDB.Rd
+++ b/man/loadHydratecDB.Rd
@@ -10,12 +10,12 @@ Hydratec. 2011. Actualisation de la base de données des débits journaliers ‘
 loadHydratecDB(cfg = loadConfig())
 }
 \arguments{
-\item{cfg}{a [config] object. Configuration to use. See [LoadConfig] for details}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-A [list] with 2 items:
-        - `stations`: a [data.frame] with the description of gauging stations
-        - `Q`: the times series of daily flows
+A \link{list} with 2 items:
+- \code{stations}: a \link{data.frame} with the description of gauging stations
+- \code{Q}: the times series of daily flows
 }
 \description{
 Load Hydratec naturalised flow database
diff --git a/man/loadHypsoData.Rd b/man/loadHypsoData.Rd
index 60491c3..a22e013 100644
--- a/man/loadHypsoData.Rd
+++ b/man/loadHypsoData.Rd
@@ -2,16 +2,17 @@
 % Please edit documentation in R/loadHypsoData.R
 \name{loadHypsoData}
 \alias{loadHypsoData}
-\title{Title}
+\title{Load hypsometric data for Cemaneige snow module}
 \usage{
 loadHypsoData(cfg = loadConfig())
 }
 \arguments{
-\item{data_path}{}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-
+\link{matrix} with one column by gauging station
 }
 \description{
-Title
+Read all the files contained in the folder \code{cfg$hydroclim$path}/courbes_hypsometriques
+and merge them into a matrix
 }
diff --git a/man/readDrias2020.Rd b/man/readDrias2020.Rd
index 0c324b8..307e78d 100644
--- a/man/readDrias2020.Rd
+++ b/man/readDrias2020.Rd
@@ -2,7 +2,7 @@
 % Please edit documentation in R/readDrias2020.R
 \name{readDrias2020}
 \alias{readDrias2020}
-\title{Read "Simulations 'DRIAS-2020': données quotidiennes corrigées \[format Netcdf\]" files}
+\title{Read "Simulations 'DRIAS-2020': données quotidiennes corrigées [format Netcdf]" files}
 \usage{
 readDrias2020(
   files,
@@ -11,23 +11,29 @@ readDrias2020(
 )
 }
 \arguments{
-\item{files}{[character] One or more file names to read without the path}
+\item{files}{\link{character} One or more file names to read without the path}
+
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 
 \item{path}{the path of the files}
 }
 \value{
-A [list] containing items:
-  - `var` [character] the name of the variable
-  - `DatesR` a [POSIXct] with the dates of data
-  - `cells` a [list] containing one item by cell
+A \link{list} containing items:
+\itemize{
+\item \code{var} \link{character} the name of the variable
+\item \code{DatesR} a \link{POSIXct} with the dates of data
+\item \code{cells} a \link{list} containing one item by cell
+}
 
-Each cell is then a [list] with 2 items:
-  - `xy`: a [vector] of lenght 2 : coordinates of the cell-centroid in Lambert II projection
-  - `data`: a [vector] of the same lenght as `DatesR` with the meteorological time series
+Each cell is then a \link{list} with 2 items:
+\itemize{
+\item \code{xy}: a \link{vector} of lenght 2 : coordinates of the cell-centroid in Lambert II projection
+\item \code{data}: a \link{vector} of the same lenght as \code{DatesR} with the meteorological time series
+}
 }
 \description{
-Read "Simulations 'DRIAS-2020': données quotidiennes corrigées \[format Netcdf\]" files
+Read "Simulations 'DRIAS-2020': données quotidiennes corrigées [format Netcdf]" files
 }
 \details{
-`files` could be a vector with the "Historical" and the "rcpn.n" files, the two times series are then merged into a continuous one.
+\code{files} could be a vector with the "Historical" and the "rcpn.n" files, the two times series are then merged into a continuous one.
 }
diff --git a/man/readQsim.Rd b/man/readQsim.Rd
index 3ed0350..6f2951b 100644
--- a/man/readQsim.Rd
+++ b/man/readQsim.Rd
@@ -2,20 +2,20 @@
 % Please edit documentation in R/loadQsim.R
 \name{readQsim}
 \alias{readQsim}
-\title{Load simulated flows recorded with [saveFlowDB]}
+\title{Load simulated flows recorded with \link{saveFlowDB}}
 \usage{
 readQsim(..., cfg = loadConfig())
 }
 \arguments{
-\item{...}{[character] the relative path where the database is recorded in the cloud}
+\item{...}{\link{character} the relative path where the database is recorded in the cloud}
 
-\item{cfg}{a [config] object. Configuration to use. See [LoadConfig] for details}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-A [data.frame] with a first column with the date and following columns the daily mean simulated flows for each station.
+A \link{data.frame} with a first column with the date and following columns the daily mean simulated flows for each station.
 }
 \description{
-Load simulated flows recorded with [saveFlowDB]
+Load simulated flows recorded with \link{saveFlowDB}
 }
 \examples{
 cfg <- loadConfig()
diff --git a/man/saveFlowDB.Rd b/man/saveFlowDB.Rd
index 27f951f..82753ab 100644
--- a/man/saveFlowDB.Rd
+++ b/man/saveFlowDB.Rd
@@ -7,16 +7,16 @@
 saveFlowDB(path, InputsModel, OutputsModel, cfg = loadConfig())
 }
 \arguments{
-\item{path}{[character] the location used to save the database}
+\item{path}{\link{character} the location used to save the database}
 
-\item{InputsModel}{[GRiwrmInputsModel] see [CreateInputsModel.BasinsObs]}
+\item{InputsModel}{\code{GRiwrmInputsModel} object. See \link{CreateInputsModel.BasinsObs}}
 
-\item{OutputsModel}{[GriwrmOutputsModel] see [RunModel.BasinsObs]}
+\item{OutputsModel}{\code{GriwrmOutputsModel} object. See \link{RunModel.BasinsObs}}
 
-\item{cfg}{a [config] object. Configuration to use. See [LoadConfig] for details}
+\item{cfg}{a config object. Configuration to use. See \link{loadConfig} for details}
 }
 \value{
-
+\code{TRUE} if the last copy successed
 }
 \description{
 Save database of one simulation
diff --git a/man/selectBasins.Rd b/man/selectBasins.Rd
deleted file mode 100644
index a36bacf..0000000
--- a/man/selectBasins.Rd
+++ /dev/null
@@ -1,17 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/selectBasins.R
-\name{selectBasins}
-\alias{selectBasins}
-\title{Title}
-\usage{
-selectBasins(BasinsObs, ids)
-}
-\arguments{
-\item{ids}{}
-}
-\value{
-
-}
-\description{
-Title
-}
-- 
GitLab