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

La forge gitlab.irstea.fr sera définitivement arrêtée le 30 juin 2026. Nous vous invitons à migrer vos projets vers la forge INRAE. Vous trouverez plus de détails sur le blog de la forge INRAE.

  • HYCAR-HydroHYCAR-Hydro
  • airGRairGR
  • Issues
  • #167
Closed
Open
Issue created Nov 23, 2022 by Dorchies David@david.dorchiesDeveloper

CreateRunOptions: crash with RunModel_Lag

The example provided for RunModel_Lag is incoherent. Both CreateInputsModel and CreateRunOptions uses FUN_MOD = RunModelGR4J to work. If, in example, we try to change the argument to FUN_MOD = RunModel_Lag, CreateRunOptions crashes:

> InputsModelInf <- CreateInputsModel(FUN_MOD = RunModel_Lag, DatesR = BasinObs$DatesR,
+                                     Precip = BasinObs$P, PotEvap = BasinObs$E,
+                                     Qupstream = Qupstream, LengthHydro = LengthHydro,
+                                     BasinAreas = BasinAreas)
> RunOptions <- CreateRunOptions(FUN_MOD = RunModel_Lag,
+                                InputsModel = InputsModelInf, IndPeriod_Run = Ind_Run)
Error in rep(0, NState) : invalid 'times' argument

This is due to the fact that:

> class(InputsModelInf)
[1] "InputsModel" "daily"       "SD"          "SD"     

And in CreateRunOptions there is a test for defining the size of the initial state vector restricted to if ("GR" %in% ObjectClass | "CemaNeige" %in% ObjectClass) and therefore Nstate is NULL when proceeding to the creation of the initial state vector.

I see 2 solutions:

  • Define the default value of NState <- 0 instead of NULL which could be generic to any future model outside GR family assuming the lack of initial state
  • Systematically call CreateIniStates with proper parameters for the cases where the parameter IniStates is NULL (I have tested it with IniStates = CreateIniStates(RunModel_Lag, InputsModel), it works).
Edited Nov 23, 2022 by Dorchies David
Assignee
Assign to
Time tracking