Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • 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
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • HYCAR-Hydro
  • airGRairGR
  • Issues
  • #92

Closed
Open
Created Jan 25, 2021 by Delaigue Olivier@olivier.delaigueOwner

Stop Imax when the time series is not complete

Imax() does not work if the aggregated daily time series is not complete.

In this example Ind_Run1 stops at 11 p.m and Ind_Run2 stops at 10 p.m.

library(airGR)

## loading catchment data
data(L0123003)

## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR5H, DatesR = BasinObs$DatesR,
                                 Precip = BasinObs$P, PotEvap = BasinObs$E)

## run period selection
Ind_Run1 <- seq(which(format(BasinObs$DatesR, format = "%Y-%m-%d %H:%M")=="2006-01-01 00:00"),
                which(format(BasinObs$DatesR, format = "%Y-%m-%d %H:%M")=="2006-12-31 23:00"))
Ind_Run2 <- Ind_Run1[-length(Ind_Run1)]

## Imax computation on Ind_Run1
Imax(InputsModel = InputsModel, IndPeriod_Run = Ind_Run1,
     TestedValues = seq(from = 0, to = 3, by = 0.2))
##
## 1.4
##

## Imax computation on Ind_Run1
Imax(InputsModel = InputsModel, IndPeriod_Run = Ind_Run2,
     TestedValues = seq(from = 0, to = 3, by = 0.2))
##
## numeric(0)
##

This is caused by the new behavior of SerriesAggreg() ()line 35 that returns a NA value when the time series is not complete for the aggregated time step.

          DatesR Precip PotEvap
17377 2006-12-26   0.00    0.10
17401 2006-12-27   0.00    0.20
17425 2006-12-28   0.00    0.38
17449 2006-12-29   1.87    0.38
17473 2006-12-30   6.88    0.52
17497 2006-12-31     NA      NA

So in this case, it would be better to stop the computation of Imax().

In addition, the code could be simplified using the [.InputsModel method (line 32).

Assignee
Assign to
Time tracking