#' @details `db` is a [data.frame] which at least contains in its columns:
#'
#' * a node identifier (column `id`),
#' * the identifier and the hydraulic distance to the downstream node ([character] columns `down` and [numeric] columns `length` in meters). The last downstream node should have fields `down` and `length` set to `NA`,
#' * the identifier and the hydraulic distance to the downstream node ([character] columns `down` and [numeric] columns `length` in km). The last downstream node should have fields `down` and `length` set to `NA`,
#' * the area of the basin ([numeric] column `area` in km^2^)
#' * the hydrological model to use if so ([character] column `model`).
#' * the hydrological model to use if so ([character] column `model`) ([NA] for using observed flow instead of a run-off model output)
#'
#' @param db a [data.frame] containing the description of the network (See details)
#' @param cols named list or vector for matching columns of `db` parameter. By default, mandatory columns names are: `id`, `down`, `length`. But other names can be handled with a named list or vector containing items defined as `"required name" = "column name in db"`
#' @param keep_all keep all column of `db` or keep only columns defined in `cols`
#'
#' @return `GRiwrm` class object containing the description of the semi-distributed model network
#' @return An object of class `GRiwrm` describing the airGR semi-distributed model network.
#'
#' It's a [data.frame] with each line corresponding to a location on the river network and with the following columns:
#' * `id` ([character]): node identifier
#' * `down` ([character]): the identifier of the node downstream of the current node ([NA] for the most downstream node)
#' * `length` ([numeric]): the hydraulic distance to the downstream node in km ([NA] for the most downstream node)
#' * `area` ([numeric]): the total area of the basin starting from the current node location in km^2^
#' * `model` ([character]): the hydrological model to use if so ([NA] for using observed flow instead of a run-off model output)
#' Display a diagram representing the network structure of a GRiwrm object
#'
#' @param x a GRiwrm object to display (See [GRiwrm])
#' @param x a GRiwrm object to display (See [CreateGRiwrm])
#' @param display if `TRUE` displays the diagram with [DiagrammeR::mermaid], return the mermaid code otherwise
#' @param orientation a [character] describing the orientation of the graph. Possible values are "LR" (left-right), "RL" (right-left), "TB" (top-bottom), or "BT" (bottom-top). "LR" by default
#' @param width The width of the resulting graphic in pixels (See [DiagrammeR::mermaid])
\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{x}{either a \code{GRiwrm} network description (See \link{CreateGRiwrm}), 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{griwrm}{\code{GRiwrm} object describing the semi-distributive network (See \link{CreateGRiwrm})}
\item{areas}{\link{numeric} vector with the total area of the basin followed by the areas of the upstream basins in km^2^}
\item the identifier and the hydraulic distance to the downstream node (\link{character} columns \code{down} and \link{numeric} columns \code{length} in km). The last downstream node should have fields \code{down} and \code{length} set to \code{NA},
\item the area of the basin (\link{numeric} column \code{area} in km^2^)