SD model: add an argument `unit` in CreateInputsModel and store `Qupstream` in m3/time step
The current implementation mixes units in Qupstream
depending on the fact the upstream flow is related to an area or not and this leads to on-the-fly conversion in RunModel_Lag
(See #104 (closed)).
Moreover, the presence of different units in Qupstream
can be confusing for the user.
Implementation of Qupstream
in m3/time-step in the InputsModel
object would avoid unnecessary conversions during simulation but upstream flow provided by GR models are in mm/time-step, so giving the choice of the unit to the user appears to be a good trade-off.
Here a proposition of the unit
parameter definition:
\item{unit}{(optional) [character] unit of the flow in the parameter \code{Qupstream}, available units are: "mm" for mm/time-step (default), "m3" for m3/time-step, "m3/s" and "l/s". See details}
\item{Qupstream}{(optional) [numerical matrix] time series of upstream flows (catchment average), its unit is defined by the \code{unit} parameter, required to create the SD model inputs. See details}
(...)
\details{
(...)
Users wanting to use a semi-distributed (SD) lag model should provide valid \code{Qupstream}, \code{LengthHydro}, and \code{BasinAreas} parameters. Each upstream sub-catchment is described by an upstream flow time series (one column in \code{Qupstream} matrix), a distance between the downstream outlet and the upstream inlet (one item in \code{LengthHydro}) and an area (one item in \code{BasinAreas}).
The order of the columns or of the items should be consistent for all these parameters. \code{BasinAreas} should contain one extra information (stored in the last item) which is the area of the downstream sub-catchment.
Upstream flows that are not related to a sub-catchment such as release or withdraw spots are identified by an area equal to \code{NA}, and if \code{unit="mm"} the upstream flow must be expressed in m3/time step instead of mm/time step which is not possible in absence of a related area.
Please note that the use of SD lag model require to use the \code{\link{RunModel}} function instead of \code{\link{RunModel_GR4J}} or the other \code{RunModel_*} functions.