RunModel_Lag: `StateEnd` is wrong in case of more than 1 upstream basin
The code refers to the variable Qupstream
which is the flow of the last upstream flow processed in the loop of lag calculation:
OutputsModel$StateEnd$SD <- lapply(seq(NbUpBasins), function(x) {
Qupstream[(LengthTs - floor(PT[x])):LengthTs]
})
It should refer to InputsModel$Qupstream
which is the matrix of all upstream flows.