Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • multiApply multiApply
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • 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
  • Computational Earth SciencesComputational Earth Sciences
  • multiApplymultiApply
  • Issues
  • #7
Closed
Open
Issue created Oct 31, 2019 by Nuria Pérez-Zanón@nperezMaintainer

Problem when arrays have dimnames

As reported by @bertvs, multiApply doesn't seem able to handle arrays with dimnames attributes.

Below is a very simple test that gives an error in multiApply:

mod <- seq(1, 2 * 3)
obs  <- seq(1, 2 * 3)
dim(mod) <- c(dataset = 2, member = 3)
dim(obs) <- c(dataset = 2, member = 3)
dimnames(mod)[[1]] <- c("MF", "UKMO")
dimnames(obs)[[1]] <- c("MF", "UKMO")

test.fun <- function(obs, mod) {return(obs == mod)}

outp <- Apply(data = list(obs = obs, mod = mod),
  target_dims = list(obs = c("member"), mod = c("member")),
  fun = test.fun
  )

Error in attributes(x) <- c(attributes(x), attr_bk) :
  length of 'dimnames' [1] not equal to array extent

The problem also occurs when dimnames are used only once, for either mod or obs but the error disappears when using no dimnames.

The use of the use_attributes (e.g. use_attributes = list(mod = c("dimnames")) argument also causes problems.

Assignee
Assign to
Time tracking