Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • airGR airGR
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 60
    • Issues 60
    • List
    • Boards
    • Service Desk
    • Milestones
  • Redmine
    • Redmine
  • Merge requests 7
    • Merge requests 7
  • 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
  • HYCAR-HydroHYCAR-Hydro
  • airGRairGR
  • Issues
  • #60
Closed
Open
Issue created Jun 05, 2020 by Dorchies David@david.dorchiesDeveloper

Migrate TransfoParam functions and CreateCalibOptions to S3 methods

The main idea is to facilitate the model chaining (e.g. CemaNeige + GR4J + LAG) in order to reduce the current code complexity and facilitate extension to new models in the future. S3 class concepts are a good candidate to tackle this issue. A Proof of Concept written in Rmarkdown showing how model chaining can be operated is available here :

PoC_airGR_S3_classes.Rmd

Starting point

Currently in master and dev branches, depending on the FUN_MOD provided to CreateCalibOptions a serie of conditions assign a FUN1 variable corresponding to a TransfoParam_GR* function and a FUN2 variable corresponding to either TransfoParam_CemaNeige or TransfoParam_CemaNeigeHyst depending on isHyst parameter. If several models are involved (e.g. CemaNeige + GR4J), then a "meta" FUN_TRANSFO function is written, binding columns of the output matrix with outputs of each model. In the SD branch the complexity of the process is again complicated by adding parameters of the LAG model.

Proposition

  • Modify CreateCalibOption in order to assign classes corresponding to the models involved in the model chain to the and call a generic function TransfoParam
  • Change the name of transfoParam_* function to TransfoParam.* methods
  • Rewrite TransfoParam generic function in order to automatically bind columns of the matrix ParamT

Pitfalls

If we assume a generic form of the model chaining and put in correspondence the order of the model with the order of the parameters, the current order in SD implementation is not compliant: the current order is : param = c(GRparam, CemaneigeParam, LAGparam). If we considere Cemaneige as a pretreatment of the rain, before running a GR model and LAG a routing model applied after GR model, this order of parameter is not logical.

To solve this issue, as the order of parameter between GR and Cemaneige is already fixed on older versions and SD model is not public yet, I propose to adopt this order of parameters: param = c(LAGparam, GRparam, CemaneigeParam).

Assignee
Assign to
Time tracking