This class represents Spaces
in HDF5. These are mostly useful to define the
dimensions of a dataset as well as the maximum dimensions to which it can grow. By default, the
maximum dimension is equal to the initial dimension. If you want the array to be able to grow arbitrarily
large in one dimension, set the maximum dimension for this index to Inf
. See the examples below
for code how to do this.
Object of class H5S
.
new(type = c("simple", "scalar", "null"), dims = NULL,
maxdims = dims, decode_buf = NULL, id = NULL)
Create a new HDF5-space. This can be done by either specifying a space with appropriate dimensions or by decoding a character string that represents an encoded space
Parameters
Either a simple
space, for which dims
and maxdims
have to be given
or a scalar
or null
space. See the HDF5 user guide on spaces to explain the differences.
The dimension of the space in case it is of type simple
The maximal dimensions of the space
The character string that holds the encoded representation of a space
An existing HDF5 id; internal use only
copy()
This function implements the HDF5-API function H5Scopy. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_COPY for details.
encode()
This function implements the HDF5-API function H5Sencode. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_ENCODE for details.
is_simple()
This function implements the HDF5-API function H5Sis_simple. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_IS_SIMPLE for details.
get_simple_extent_ndims()
This function implements the HDF5-API function H5Sget_simple_extent_ndims. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SIMPLE_EXTENT_NDIMS for details.
offset_simple(offset)
This function implements the HDF5-API function H5Soffset_simple. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_OFFSET_SIMPLE for details.
get_simple_extent_dims()
This function implements the HDF5-API function H5Sget_simple_extent_dims. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SIMPLE_EXTENT_DIMS for details.
get_simple_extent_npoints()
This function implements the HDF5-API function H5Sget_simple_extent_npoints. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SIMPLE_EXTENT_NPOINTS for details.
get_simple_extent_type()
This function implements the HDF5-API function H5Sget_simple_extent_type. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SIMPLE_EXTENT_TYPE for details.
extent_copy(h5s_source)
This function implements the HDF5-API function H5Sextent_copy. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_EXTENT_COPY for details.
extent_equal(h5s_cmp)
This function implements the HDF5-API function H5Sextent_equal. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_EXTENT_EQUAL for details.
set_extent_simple(dims, maxdims)
This function implements the HDF5-API function H5Sset_extent_simple. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_SET_EXTENT_SIMPLE for details.
set_extent_none()
This function implements the HDF5-API function H5Sset_extent_none. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_SET_EXTENT_NONE for details.
get_select_type()
This function implements the HDF5-API function H5Sget_select_type. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_TYPE for details.
get_select_npoints()
This function implements the HDF5-API function H5Sget_select_npoints. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_NPOINTS for details.
get_select_hyper_nblocks()
This function implements the HDF5-API function H5Sget_select_hyper_nblocks. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_HYPER_NBLOCKS for details.
get_select_hyper_blocklist(startblock = 0,
numblocks = (self$get_select_hyper_nblocks() - startblock))
This function implements the HDF5-API function H5Sget_select_hyper_blocklist. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_HYPER_BLOCKLIST for details.
get_select_elem_npoints()
This function implements the HDF5-API function H5Sget_select_elem_npoints. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_ELEM_NPOINTS for details.
get_select_elem_pointlist(startpoint = 0,
numpoints = (self$get_select_elem_npoints() - startpoint))
This function implements the HDF5-API function H5Sget_select_elem_pointlist. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_ELEM_POINTLIST for details.
get_select_bounds()
This function implements the HDF5-API function H5Sget_select_bounds. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SELECT_BOUNDS for details.
select_all()
This function implements the HDF5-API function H5Sselect_all. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_SELECT_ALL for details.
select_none()
This function implements the HDF5-API function H5Sselect_none. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_SELECT_NONE for details.
select_valid()
This function implements the HDF5-API function H5Sselect_valid. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_SELECT_VALID for details.
select_elements(coord, op = h5const$H5S_SELECT_SET, byrow = TRUE)
This function implements the HDF5-API function H5Sselect_elements. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_SELECT_ELEMENTS for details.
select_hyperslab(start, count, stride = NULL, block = NULL,
op = h5const$H5S_SELECT_SET)
This function implements the HDF5-API function H5Sselect_hyperslab. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_SELECT_HYPERSLAB for details.
subset(args, op = h5const$H5S_SELECT_SET, envir = parent.frame())
Subsetting the space. This is mainly intended as a helper function for the '[' function, but can also be used on its own.
Parameters
The indices for each dimension to subset given as a list. This makes this easier to use as a programmatic API.
For interactive use we recommend the use of the [
operator.
The operator to use. Same as for the other HDF5 space selection functions. One of the elements shown in
h5const$H5S_seloper_t
The environment in which to evaluate args
print(...)
Prints information for the group
Parameters
ignored
dims()
Get the dimensions of the space. Return NULL if the space is not simple (i.e. NULL-space) or a length-0 integer if it is a scalar
maxdims()
Get the maximal dimensions of the space.Return NULL if the space is not simple (i.e. NULL-space) or a length-0 integer if it is a scalar
rank()
This function implements the HDF5-API function H5Sget_simple_extent_ndims. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5S_GET_SIMPLE_EXTENT_NDIMS for details.
# NOT RUN {
h5s_fixed <- H5S$new("simple", dims=c(5, 2))
h5s_fixed
h5s_variable <- H5S$new("simple", dims=c(5,2), maxdims=c(Inf,2))
h5s_variable
h5s_variable$set_extent_simple(c(10,2), c(Inf, 2))
h5s_variable
# now select a subset of points
# argument evaluation has a heuristic; here it chooses point selection
h5s_variable[c(1, 3, 8), 1]
h5s_variable$get_select_type()
h5s_variable$get_select_elem_pointlist()
# and a hyperslab (chosen by the argument heuristic)
h5s_variable[2:7, 1:2]
h5s_variable$get_select_type()
h5s_variable$get_select_hyper_blocklist()
# }
Run the code above in your browser using DataLab