Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • CSTools CSTools
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 28
    • Issues 28
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • External
  • CSToolsCSTools
  • Issues
  • #121
Closed
Open
Issue created Apr 06, 2023 by Eva Rifà@erifarovMaintainer

Standarize coordinates in s2dv_cube

Hi @vagudets and @aho,

Now, for different cases there are different coordinates classes:

  1. If coordinates are indices they never have dimensions
  2. Using as.s2dv_cube from Start, only spatial and time coordinates have dimensions:
repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc"
repos2 <- "/esarchive/exp/ecmwf/system4_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc"

data3 <- Start(dat = list(list(name = 'system4_m1', path = repos2),
                          list(name = 'system5_m1', path = repos)),
              var = c('tas', 'sfcWind'),
              sdate = '20170101',
              ensemble = indices(1),
              time = indices(1:3),
              lat = indices(1:4),
              lon = indices(1:4),
              synonims = list(lat = c('lat', 'latitude'),
                              lon = c('lon', 'longitude')),
              return_vars =  list(time = 'sdate',
                                  longitude = 'dat',
                                  latitude = 'dat'),
              metadata_dims = c('dat', 'var'),
              retrieve = T
              )
exp_start <- as.s2dv_cube(data3)

exp_start$dims
# dat      var    sdate ensemble     time      lat      lon 
#   2        2        1        1        3        4        4 
> dim(exp_start$coords$var)
NULL
> dim(exp_start$coords$dat)
NULL
> dim(exp_start$coords$ensemble)
NULL
> dim(exp_start$coords$sdate)
NULL
> dim(exp_start$coords$lat)
lat 
  4 
> dim(exp_start$coords$time)
sdate  time 
    1     3 
  1. Using as.s2dv_cube from Load only spatial coordinates have dimensions:
> dim(lonlat_prec$coords$dataset)
NULL
> dim(lonlat_prec$coords$member)
NULL
> dim(lonlat_prec$coords$sdate)
NULL
> dim(lonlat_prec$coords$ftime)
NULL
> dim(lonlat_prec$coords$lat)
[1] 4
> dim(lonlat_prec$coords$lon)
[1] 4

To standarize the coordinates classes in s2dv_cube we can do:

  1. All coordinates to be 1D arrays
  2. Allow indices coordinates to be vectors and other coordinates to be 1D arrays
  3. Allow some coordinates (indices, dataset, var) to be vectors; and spatial and time dimensions to be 1D arrays

Also, this development could be also done in CSTooos::s2dv_cube function and CSTools::CST_InsertDim.

What do you prefer?

Assignee
Assign to
Time tracking