Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • startR startR
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 29
    • Issues 29
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • 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
  • Earth SciencesEarth Sciences
  • startRstartR
  • Issues
  • #158
Closed
Open
Issue created Jun 27, 2022 by aho@ahoMaintainer

Start(): Error when retrieve = F and parameter is an object that is NULL

The error occurs at https://earth.bsc.es/gitlab/es/startR/-/blob/v2.2.0/R/Start.R#L3942 start_call[[i]] <- eval.parent(start_call[[i]]), which is under retrieve = F only. If Start() call has a parameter that is assigned by an object that is NULL, this object is listed in the list start_call and will disappear after being eval(). So the list will be shorter than before and the error occurs at the end of for loop. If the parameter is directly specified as NULL, the class is not 'name' or 'call', so it doesn't need to be eval(), therefore, no problem happens.

library(startR)
  regrid_params <- list(transform = NULL, grid = NULL)

  # 1. transform is an object that is NULL
  data <- Start(dat = '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc',
                var = 'tas',
                sdate = c('20170101', '20180101'),
                ensemble = indices(1),
                time = indices(1),
                latitude = indices(1:10),
                longitude = indices(1:10),
                transform = regrid_params$transform, #NULL,
                transform_params = NULL,
                transform_vars = c('latitude', 'longitude'),
                return_vars = list(latitude = NULL, longitude = NULL),
                retrieve = F)
Error in start_call[[i]] : subscript out of bounds

  # 2. transform is directly NULL
  data <- Start(dat = '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc',
                var = 'tas',
                sdate = c('20170101', '20180101'),
                ensemble = indices(1),
                time = indices(1),
                latitude = indices(1:10),
                longitude = indices(1:10),
                transform = NULL,
                transform_params = NULL,
                transform_vars = c('latitude', 'longitude'),
                return_vars = list(latitude = NULL, longitude = NULL),
                retrieve = F)
# no error
Assignee
Assign to
Time tracking