Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • airGRteaching airGRteaching
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 7
    • Issues 7
    • List
    • Boards
    • Service Desk
    • Milestones
  • Redmine
    • Redmine
  • Merge requests 0
    • Merge requests 0
  • 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 institutionnelle d'INRAE étant en production depuis le 10 juin 2025, nous vous invitons à y créer vos nouveaux projets.

  • HYCAR-HydroHYCAR-Hydro
  • airGRteachingairGRteaching
  • Issues
  • #43
Closed
Open
Issue created Aug 03, 2021 by Delaigue Olivier@olivier.delaigueOwner

Allow to simulate a subperiod without discharge in SimGR

Current behaviour

It is possible to run SimGR() using a PrepGR() output whthout anny Qobs, but it is not possible when it is only a sub-period.

On the whole periode without Obs:

## data.frame of observed data
data(L0123001, package = "airGR")
BasinObs2 <- BasinObs[, c("DatesR", "P", "E", "Qmm", "T")]
BasinObs2$Qmm <- NA

### Preparation of observed data for modelling
PREP <- PrepGR(ObsDF = BasinObs2, HydroModel = "GR4J", CemaNeige = FALSE)

## Simulation step using model parameters set by the user
SIM <- SimGR(PrepGR = PREP, Param = c(270.426, 0.984, 108.853, 2.149), EffCrit = "KGE2",
             WupPer = NULL, SimPer = c("1994-01-01", "1998-12-31"))
Warning messages:
1: In SimGR(PrepGR = PREP, Param = c(270.426, 0.984, 108.853, 2.149),  :
  "PrepGR" does not contain any Qobs values. The efficiency criterion is not computed
2: In CreateRunOptions(FUN_MOD = get(PrepGR$TypeModel), InputsModel = PrepGR$InputsModel,  :
  model warm up period not defined: default configuration used
  the year preceding the run period is used 

On a subperiod without Obs:

## data.frame of observed data
data(L0123001, package = "airGR")
BasinObs2 <- BasinObs[, c("DatesR", "P", "E", "Qmm", "T")]
BasinObs2$Qmm[3654:length(BasinObs2$Qmm)] <- NA

## Preparation of observed data for modelling
PREP <- PrepGR(ObsDF = BasinObs2, HydroModel = "GR4J", CemaNeige = FALSE)

## Simulation step using model parameters set by the user
SIM <- SimGR(PrepGR = PREP, Param = c(270.426, 0.984, 108.853, 2.149), EffCrit = "KGE2",
             WupPer = NULL, SimPer = c("1994-01-01", "1998-12-31"))
Erreur : 'Obs' contains only missing values
De plus : Warning message:
In CreateRunOptions(FUN_MOD = get(PrepGR$TypeModel), InputsModel = PrepGR$InputsModel,  :
  model warm up period not defined: default configuration used
  the year preceding the run period is used 

Expected behaviour

Allow to run SimGR() on a subperiod whitout discharge and return a warning message.

Current code

Lines 19 to 22

  isQobs <- !all(is.na(PrepGR$Qobs))
  if (!isQobs) {
    warning("\"PrepGR\" does not contain any Qobs values. The efficiency criterion is not computed")
  }

Lines 82 to 98

  if (isQobs) {
    MOD_crt <- CreateInputsCrit(FUN_CRIT = FUN_CRIT, InputsModel = PrepGR$InputsModel, 
      RunOptions = MOD_opt, Obs = PrepGR$Qobs[SimInd], 
      transfo = transfo)
  }
  else {
    MOD_crt <- NULL
  }
  SIM <- RunModel(InputsModel = PrepGR$InputsModel, RunOptions = MOD_opt, 
    Param = Param, FUN_MOD = get(PrepGR$TypeModel))
  if (isQobs) {
    CRT <- ErrorCrit(InputsCrit = MOD_crt, OutputsModel = SIM, 
      verbose = verbose)
  }
  else {
    CRT <- NULL
  }

Proposed solution

Remove ines 19 to 22.

Add the following code just before the line 82:

  isQobs <- !all(is.na(PrepGR$Qobs[SimInd]))
  if (!isQobs) {
    warning("\"PrepGR\" does not contain any Qobs values on \"SimPer\". The efficiency criterion is not computed")
  }
Edited Aug 03, 2021 by Delaigue Olivier
Assignee
Assign to
Time tracking