Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • ClimProjDiags ClimProjDiags
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • ClimProjDiagsClimProjDiags
  • Merge requests
  • !48

Fix dimension when drop = T and the remaining dimension is one with length > 1

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged aho requested to merge develop-Subset_dropT_dim into master Dec 21, 2023
  • Overview 2
  • Commits 1
  • Pipelines 1
  • Changes 2

Hi @vagudets

This is the fix for the bug you found. When drop = T is used and the output should have one dimension that length is > 1, error is returned. E.g.,

arr <- array(1:3, dim = c(dat = 1, var = 1, sdate = 3))
Subset(arr, "sdate", 1:2, drop = T)

Error in dim(subset) <- dim(x)[dim_names] : 
  dims [product 3] do not match the length of object [2]

It is because the output dimension is not well-defined.

Can you check if the fix works as expected? Thanks!

Cheers,
An-Chi

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: develop-Subset_dropT_dim