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://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
encode()
This function implements the HDF5-API function H5Sencode. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
is_simple()
This function implements the HDF5-API function H5Sis_simple. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_simple_extent_ndims()
This function implements the HDF5-API function H5Sget_simple_extent_ndims. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
offset_simple(offset)
This function implements the HDF5-API function H5Soffset_simple. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_simple_extent_dims()
This function implements the HDF5-API function H5Sget_simple_extent_dims. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_simple_extent_npoints()
This function implements the HDF5-API function H5Sget_simple_extent_npoints. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_simple_extent_type()
This function implements the HDF5-API function H5Sget_simple_extent_type. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
extent_copy(h5s_source)
This function implements the HDF5-API function H5Sextent_copy. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
extent_equal(h5s_cmp)
This function implements the HDF5-API function H5Sextent_equal. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
set_extent_simple(dims, maxdims)
This function implements the HDF5-API function H5Sset_extent_simple. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
set_extent_none()
This function implements the HDF5-API function H5Sset_extent_none. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_select_type()
This function implements the HDF5-API function H5Sget_select_type. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_select_npoints()
This function implements the HDF5-API function H5Sget_select_npoints. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_select_hyper_nblocks()
This function implements the HDF5-API function H5Sget_select_hyper_nblocks. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_select_elem_npoints()
This function implements the HDF5-API function H5Sget_select_elem_npoints. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
get_select_bounds()
This function implements the HDF5-API function H5Sget_select_bounds. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
select_all()
This function implements the HDF5-API function H5Sselect_all. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
select_none()
This function implements the HDF5-API function H5Sselect_none. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
select_valid()
This function implements the HDF5-API function H5Sselect_valid. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html for details.
h5s_fixed <- H5S$new("simple", dims=c(5, 2))
h5s_fixed
#> Class: H5S
#> Type: Simple
#> Dims: 5 x 2
#> Maxdims: 5 x 2
h5s_variable <- H5S$new("simple", dims=c(5,2), maxdims=c(Inf,2))
h5s_variable
#> Class: H5S
#> Type: Simple
#> Dims: 5 x 2
#> Maxdims: Inf x 2
h5s_variable$set_extent_simple(c(10,2), c(Inf, 2))
h5s_variable
#> Class: H5S
#> Type: Simple
#> Dims: 10 x 2
#> Maxdims: Inf x 2
# now select a subset of points
# argument evaluation has a heuristic; here it chooses point selection
h5s_variable[c(1, 3, 8), 1]
#> Class: H5S
#> Type: Simple
#> Dims: 10 x 2
#> Maxdims: Inf x 2
h5s_variable$get_select_type()
#> [1] H5S_SEL_POINTS
#> 6 Levels: H5S_SEL_ERROR H5S_SEL_NONE H5S_SEL_POINTS ... H5S_SEL_N
#> 6 Values: -1 0 1 ... 4
h5s_variable$get_select_elem_pointlist()
#> [,1] [,2]
#> [1,] 1 1
#> [2,] 3 1
#> [3,] 8 1
# and a hyperslab (chosen by the argument heuristic)
h5s_variable[2:7, 1:2]
#> Class: H5S
#> Type: Simple
#> Dims: 10 x 2
#> Maxdims: Inf x 2
h5s_variable$get_select_type()
#> [1] H5S_SEL_HYPERSLABS
#> 6 Levels: H5S_SEL_ERROR H5S_SEL_NONE H5S_SEL_POINTS ... H5S_SEL_N
#> 6 Values: -1 0 1 ... 4
h5s_variable$get_select_hyper_blocklist()
#> [,1] [,2]
#> block_1_start 2 1
#> block_1_end 7 2