Page tree

The license could not be verified: License Certificate has expired!

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The mapping between a VDS and the HDF5 source datasets is persistent and transparent to an application. If a source file is missing the fill value will be displayed.

See the Virtual (VDS) Documentation for complete details regarding the VDS feature.

The VDS feature was implemented using hyperslab selection (H5S_SELECT_HYPERSLAB). See the tutorial on Reading From or Writing to a Subset of a Dataset for more information on selecting hyperslabs.

Programming Model

To create a Virtual Dataset you simply follow the HDF5 programming model and add a few additional API calls to map the source code datasets to the VDS.


  1. Create the source datasets that will comprise the VDS
  2. Create the VDS: ‐ Define a datatype and dataspace (can be unlimited)
    ‐ Define the dataset creation property list (including fill value)
    ‐ (Repeat for each source dataset) Map elements from the source dataset to elements of the VDS:

    ‐ Call H5Dcreate using the properties defined above
  3. Access the VDS as a regular HDF5 dataset
  4. Close the VDS when finished

Functions for Working with a VDS

The H5P_SET_VIRTUAL API sets the mapping between virtual and source datasets. This is a dataset creation property list. Using this API will change the layout of the dataset to H5D_VIRTUAL. As with specifying any dataset creation property list, an instance of the property list is created, modified, passed into the dataset creation call and then closed:


There are several other APIs introduced with Virtual Datasets, including query functions. For details see the complete list of HDF5 library APIs that support Virtual Datasets


This feature requires HDF5-1.10.
The number of source datasets is unlimited. However, there is a limit on the size of each source dataset.

Programming Examples

Example 1

This example creates three HDF5 files, each with a one-dimensional dataset of 6 elements. The datasets in these files are the source datasets that are then used to create a 4 x 6 Virtual Dataset with a fill value of -1. The first three rows of the VDS are mapped to the data from the three source datasets as shown below:


For details on compiling an HDF5 application: [ Compiling HDF5 Applications ]

Example 2

This example shows how to use a C-style printf statement for specifying multiple source datasets as one virtual dataset. Only one mapping is required. In other words only one H5P_SET_VIRTUAL call is needed to map multiple datasets. It creates a 2-dimensional unlimited VDS. Then it re-opens the file, makes queries, and reads the virtual dataset.


For details on compiling an HDF5 application: [ Compiling HDF5 Applications ]

Using h5dump with a VDS

The h5dump utility can be used to view a VDS. The h5dump output for a VDS looks exactly like that for any other dataset. If h5dump cannot find a source dataset then the fill value will be displayed.