Dataspaces

HDF5.DataspaceType
HDF5.Dataspace

A dataspace defines the size and the shape of a dataset or an attribute.

A dataspace is typically constructed by calling dataspace.

The following functions have methods defined for Dataspace objects

  • ==
  • ndims
  • size
  • length
  • isempty
  • isnull
source
HDF5.dataspaceFunction
dataspace(obj::Union{Attribute, Dataset, Dataspace})

The Dataspace of obj.

source
dataspace(data)

The default Dataspace used for representing a Julia object data:

  • strings or numbers: a scalar Dataspace
  • arrays: a simple Dataspace
  • struct types: a scalar Dataspace
  • nothing or an EmptyArray: a null dataspace
source
dataspace(dims::Tuple; max_dims::Tuple=dims)
dataspace(dims::Tuple, max_dims::Tuple)

Construct a simple Dataspace for the given dimensions dims. The maximum dimensions maxdims specifies the maximum possible size: -1 can be used to indicate unlimited dimensions.

source
HDF5.isnullFunction
isnull(dspace::Union{HDF5.Dataspace, HDF5.Dataset, HDF5.Attribute})

Determines whether the given object has no size (consistent with the API.H5S_NULL dataspace).

Examples

julia> HDF5.isnull(dataspace(HDF5.EmptyArray{Float64}()))
true

julia> HDF5.isnull(dataspace((0,)))
false
source
HDF5.get_extent_dimsFunction
HDF5.get_extent_dims(obj::Union{HDF5.Dataspace, HDF5.Dataset, HDF5.Attribute}) -> dims, maxdims

Get the array dimensions from a dataspace, dataset, or attribute and return a tuple of dims and maxdims.

source
HDF5.set_extent_dimsFunction
HDF5.set_extent_dims(dset::HDF5.Dataset, new_dims::Dims)

Change the current dimensions of a dataset to new_dims, limited by max_dims = get_extent_dims(dset)[2]. Reduction is possible and leads to loss of truncated data.

source
HDF5.set_extent_dims(dspace::HDF5.Dataspace, new_dims::Dims, max_dims::Union{Dims,Nothing} = nothing)

Change the dimensions of a dataspace dspace to new_dims, optionally with the maximum possible dimensions max_dims different from the active size new_dims. If not given, max_dims is set equal to new_dims.

source

Hyperslab

HDF5.BlockRangeType
HDF5.BlockRange(;start::Integer, stride::Integer=1, count::Integer=1, block::Integer=1)

A BlockRange represents a selection along a single dimension of a HDF5 hyperslab. It is similar to a Julia range object, with some extra features for selecting multiple contiguous blocks.

  • start: the index of the first element in the first block (1-based).
  • stride: the step between the first element of each block (must be >0)
  • count: the number of blocks (can be -1 for an unlimited number of blocks)
  • block: the number of elements in each block.
HDF5.BlockRange(obj::Union{Integer, OrdinalRange})

Convert obj to a BlockRange object.

External links

source
HDF5.select_hyperslab!Function
HDF5.select_hyperslab!(dspace::Dataspace, [op, ], idxs::Tuple)

Selects a hyperslab region of the dspace. idxs should be a tuple of integers, ranges or BlockRange objects.

  • op determines how the new selection is to be combined with the already selected dataspace:
    • :select (default): replace the existing selection with the new selection.
    • :or: adds the new selection to the existing selection. Aliases: |, , union.
    • :and: retains only the overlapping portions of the new and existing selection. Aliases: &, , intersect.
    • :xor: retains only the elements that are members of the new selection or the existing selection, excluding elements that are members of both selections. Aliases: , xor
    • :notb: retains only elements of the existing selection that are not in the new selection. Alias: setdiff.
    • :nota: retains only elements of the new selection that are not in the existing selection.
source