rhdf5client Elements

Sam Pollack

9/1/2018

HSDSSource

An object of type HSDSSource is a HDFGroup server running on a machine. The constructor requires the endpoint and server type. At present, the only valie value is hsds (for the HDF Scalable Data Service). If the type is not specified, the server will be assumed to be hsds

src.hsds <- HSDSSource('http://hsdshdflab.hdfgroup.org')

The routine listDomains is provided for inspection of the server hierarchy. This is the hierarchy that maps approximately to the directory structure of the server file system. The purpose of this routine is to assist the user in locating HDF5 files.

The user needs to know the root domain of the server. The data set’s maintainer should publish this information along with the server endpoint.

listDomains(src.hsds, '/home/jreadey')
##  [1] "/home/jreadey/4DStem"                                       
##  [2] "/home/jreadey/GE"                                           
##  [3] "/home/jreadey/HDFLabTutorial"                               
##  [4] "/home/jreadey/HDFLabTutorial2"                              
##  [5] "/home/jreadey/LS5_TM_NBART_3577_-10_-10_1989_v1493705149.nc"
##  [6] "/home/jreadey/SETI"                                         
##  [7] "/home/jreadey/allotrope"                                    
##  [8] "/home/jreadey/astrojet.h5"                                  
##  [9] "/home/jreadey/bioconductor"                                 
## [10] "/home/jreadey/cmp"                                          
## [11] "/home/jreadey/cube"                                         
## [12] "/home/jreadey/foo.h5"                                       
## [13] "/home/jreadey/foobar.h5"                                    
## [14] "/home/jreadey/h5pyd_test"                                   
## [15] "/home/jreadey/mytall.h5"                                    
## [16] "/home/jreadey/ncep3.he5"                                    
## [17] "/home/jreadey/pcap"                                         
## [18] "/home/jreadey/tall.h5"                                      
## [19] "/home/jreadey/tall2.h5"                                     
## [20] "/home/jreadey/tall_copy.h5"                                 
## [21] "/home/jreadey/tenx"                                         
## [22] "/home/jreadey/tmp"
listDomains(src.hsds, '/home/jreadey/HDFLabTutorial')
## [1] "/home/jreadey/HDFLabTutorial/03.h5" 
## [2] "/home/jreadey/HDFLabTutorial/04.h5" 
## [3] "/home/jreadey/HDFLabTutorial/04a.h5"

HSDSFile

An object of class HSDSFile represents a HDF5 file. The object is constructed by providing a source and a file domain.

f0 <- HSDSFile(src.hsds, '/home/spollack/testzero.h5')
f1 <- HSDSFile(src.hsds, '/shared/bioconductor/tenx_full.h5')

The function listDatasets lists the datasets in a file.

listDatasets(f0)
## [1] "/grpA/grpAA/dsetAA1" "/grpA/grpAB/dsetX"   "/grpB/grpBA/dsetX"  
## [4] "/grpB/grpBB/dsetBB1" "/grpC/dsetCC"
listDatasets(f1)
## [1] "/newassay001"

HSDSDataset

Construct a HSDSDataset object from a HSDSFile and a dataset path.

d0 <- HSDSDataset(f0, '/grpA/grpAB/dsetX')
d1 <- HSDSDataset(f1, '/newassay001')

Data Fetch (1)

The low-level data retrieval method is getData. Its argument is a vector of slices of type character. Valid slices are : (all indices), 1:10 (indices 1 through 10 inclusive), :10 (same as 1:10), 5: (from 5 to the maximum value of the index) and 2:14:4 (from 2 to 14 inclusive in increments of 4.)

Note that the slice should be passed in R semantics: 1 signifies the first element, and the last element is included in the slice. (Internally, rhdf5client converts to Python semantics, in which the first index is 0 and the last element is excluded. But here, as everywhere in the package, all Python details should be hidden from the user.)

## [1] 4046 2087 4654 3193
## [1] 4046 2087 4654 3193

Data Fetch (2)

getData is generic. It can also be passed a list of vectors for the index argument, one vector in each dimension. At present, it only works if each of the vectors can be expressed as a single slice. Eventually, this functionality will be expanded to the general multi-dimensional case of multiple slices. In the general case, multiple array blocks will be fetched and bound back together into a single array.

## [1] 4046 2087 4654 3193
## [1] 4046 2087 4654 3193

Data Fetch (3)

The [ operator is provided for the two most typical cases (one-dimensional and two-dimensional numeric data.)

## [1] 4046 2087 4654 3193