Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • airGRiwrm airGRiwrm
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 26
    • Issues 26
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

La forge institutionnelle d'INRAE étant en production depuis le 10 juin 2025, nous vous recommandons d'y créer tous vos nouveaux projets.

  • IN-WOP
  • airGRiwrmairGRiwrm
  • Issues
  • #192
Closed
Open
Issue created Nov 04, 2025 by Dorchies David@david.dorchiesOwner

RunModel_Lag: crash on simulation with supervisor and without warm-up period

In this particular case, the StateEnd Output will try do save the state of the upstream with delay resulting in this index calculation for picking up the data in Qupstream:

lastTS <- RunOptions$IndPeriod_Run[length(RunOptions$IndPeriod_Run)]
index_to_pick_up_in_Qupstream <- lastTS - floor(PT[x])

This is trigered as soon as the first time step because of the supervisor which run the model at each time step and unfortunately if the InputsModel time series start on the first step of simulation, we can get a negative index raising this error:

Error:
only 0's may be mixed with negative subscripts
Hide Traceback
 2. airGRiwrm::RunModel(sv, RunOptions = RO_hydro, Param = yaml::read_yaml(TalanoaHydro::getCalibrationFilePath("params/params", 
        "yml", cfgH))) %>% suppressMessages() %>% suppressWarnings() at ModeleIntegreAude/R/runModeleIntegre.R:142:3
 3. suppressWarnings(.)
 4. withCallingHandlers(expr, warning = function(w) if (inherits(w, 
        classes)) tryInvokeRestart("muffleWarning"))
 5. suppressMessages(.)
 6. withCallingHandlers(expr, message = function(c) if (inherits(c, 
        classes)) tryInvokeRestart("muffleMessage"))
 7. airGRiwrm::RunModel(sv, RunOptions = RO_hydro, Param = yaml::read_yaml(TalanoaHydro::getCalibrationFilePath("params/params", 
        "yml", cfgH)))
 8. RunModel.Supervisor(sv, RunOptions = RO_hydro, Param = yaml::read_yaml(TalanoaHydro::getCalibrationFilePath("params/params", 
        "yml", cfgH)))
 9. suppressWarnings(RunModel_Routing(x$InputsModel[[id]], RunOptions = RunOptions[[id]], 
        Param = Param[[id]], QcontribDown = QcontribDown))
10. withCallingHandlers(expr, warning = function(w) if (inherits(w, 
        classes)) tryInvokeRestart("muffleWarning"))
11. RunModel_Routing(x$InputsModel[[id]], RunOptions = RunOptions[[id]], 
        Param = Param[[id]], QcontribDown = QcontribDown)
12. RunModel_Lag_enhanced(x, RunOptions = RunOptions, Param = Param[1], 
        QcontribDown = QcontribDown)
13. lapply(seq(NbUpBasins), function(x) {
        lastTS <- RunOptions$IndPeriod_Run[length(RunOptions$IndPeriod_Run)]
        InputsModel$Qupstream[(lastTS - floor(PT[x])):lastTS, x]

The calculation of the index should be protected as it is done for the calculation of the initial state where the time series are extended with some dummy variable in order to get a code that works.

Assignee
Assign to
Time tracking