Multidimensional HSDSDataset Vignette

Sam

9/6/2018

Access to multi-dimensional dataset:

Get result with rhdf5client

## [1] 697

Get result with reticulate and h5pyd

Special Case: subset of array (single-width slices)

The dimensionality of the http response from the server is somewhat non-intuitive, so we need to test a case in which the single-width slices are dispersed:

BR <- getData(rd, list(c(4), 1:11, c(5), 1:3))
scs <- tuple(builtins$slice(3L, 4L, 1L), builtins$slice(0L, 12L, 1L),
             builtins$slice(4L, 5L, 1L), builtins$slice(0L, 3L, 1L))
BP <- pd$`__getitem__`(scs)
print(BR)
all(BP == BR)
BR <- getData(rd, list(c(5), 1:11, 1:7, c(2)))
scs <- tuple(builtins$slice(4L, 5L, 1L), builtins$slice(0L, 12L, 1L),
             builtins$slice(0L, 7L, 1L), builtins$slice(1L, 2L, 1L))
BP <- pd$`__getitem__`(scs)
print(BR)
all(BP == BR)

Multiple-slice fetches

Check: multiple slices in two dimensions is OK

With a two-dimensional array, non-adjacent slices work:

##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
##  [1,]   54   31   60   37   20   66   25   63    0    48    44
##  [2,]   42   91    1   79   81   25   66   25   28    97     1
##  [3,]    5   73   24   54   74   53    4   39   38     8     9
##  [4,]   11   55   65    4   76   78   71   64   79    79    10
##  [5,]   66   43   18   59   44   78    6   75   19    12    63
##  [6,]   16    2   51   44   58   70   98   20   18    29     8
##  [7,]   54   10    9   21   42   45   73   93   33    83    70
##  [8,]   59   15   95   27   69   43    3   27   47     8    42
##  [9,]   68   49   36   51    7   39   66   38   74     9     4
##      [,1] [,2] [,3] [,4] [,5] [,6]
## [1,]   42   91   79   25   25   97
## [2,]    5   73   54   53   39    8
## [3,]   66   43   59   78   75   12
## [4,]   54   10   21   45   93   83

Check: single slices in multiple dimensions is OK

##      [,1] [,2] [,3]
## [1,] 4211 4212 4213
## [2,] 4311 4312 4313
## [3,] 4411 4412 4413
## [4,] 4511 4512 4513

Check: multiple slices in multiple dimensions OK

##      [,1] [,2] [,3]
## [1,] 3140 3141 3142
## [2,] 3240 3241 3242
## [3,] 3340 3341 3342
## [4,] 3440 3441 3442
## [5,] 3540 3541 3542
##      [,1] [,2] [,3]
## [1,] 3140 3141 3142
## [2,] 3240 3241 3242
## [3,] 3440 3441 3442
## [4,] 3540 3541 3542
##      [,1] [,2] [,3] [,4] [,5]
## [1,] 3140 3141 3142 3143 3144
## [2,] 3240 3241 3242 3243 3244
## [3,] 3340 3341 3342 3343 3344
## [4,] 3440 3441 3442 3443 3444
## [5,] 3540 3541 3542 3543 3544
##      [,1] [,2] [,3] [,4]
## [1,] 3140 3141 3143 3144
## [2,] 3240 3241 3243 3244
## [3,] 3440 3441 3443 3444
## [4,] 3540 3541 3543 3544

Special case: single-datum fetch

## [1] 3421