Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • s2dv s2dv
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • 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
  • Earth SciencesEarth Sciences
  • s2dvs2dv
  • Issues
  • #88
Closed
Open
Issue created Jan 10, 2023 by Eva Rifà@erifarovMaintainer

RMS() error when dat_dim is NULL and conf is FALSE

Hi @aho,

I have found an error in RMS() function related with dat_dim development. The error is the following:

exp3 <- array(rnorm(120), dim = c(sdate = 5, ftime = 2, lon = 1, lat = 4))
obs3 <- array(rnorm(80),  dim = c(sdate = 5, ftime = 2, lon = 1, lat = 4))

> RMS(exp3, obs3, dat_dim = NULL, conf = FALSE)
"Error in dim(conf.lower) <- NULL : object 'conf.lower' not found"

It is because in the atomic function values conf.lower and conf.upper are only defined when conf = TRUE.

  if (conf) {
    conflow <- (1 - conf.lev) / 2
    confhigh <- 1 - conflow
    conf.lower <- array(dim = c(nexp = nexp, nobs = nobs))
    conf.upper <- array(dim = c(nexp = nexp, nobs = nobs))
  }

But then, they are used when dat_dim = NULL even if conf = FALSE.

  ###################################
  # Remove nexp and nobs if dat_dim = NULL
  if (is.null(dat_dim)) {
    dim(rms) <- NULL
    dim(conf.lower) <- NULL
    dim(conf.upper) <- NULL
  }

I have corrected the function in this commit by adding a condition for conf. Also, I have added a test for this case in test-RMS(). The changes can be found in this merge request.

 # Remove nexp and nobs if dat_dim = NULL
  if (is.null(dat_dim)) {
    dim(rms) <- NULL
    if (conf) {
      dim(conf.lower) <- NULL
      dim(conf.upper) <- NULL
    }
  }

I am sorry because I developed this function and I didn't notice this error.

Best,
Eva

Edited Jan 10, 2023 by Eva Rifà
Assignee
Assign to
Time tracking