hdf images hdf images

This web site is no longer maintained (but will remain online).
Please see The HDF Group's new Support Portal for the latest information.

HDF5 Tutorial:   Advanced Topics
Hyperslab Selections

Contents:


Selecting a Portion of a Dataspace

HDF5 allows you to read or write to a portion of a dataset by use of hyperslab selection. A hyperslab selection can be a logically contiguous collection of points in a dataspace, or it can be a regular pattern of points or blocks in a dataspace. You can select a hyperslab to write to or read from with the function H5Sselect_hyperslab / h5sselect_hyperslab_f.

Programming Example

Description

This example creates a 5 x 6 integer array in a file called sds.h5 (sdsf.h5 in FORTRAN). It selects a 3 x 4 hyperslab from the dataset as follows (Dimension 0 is offset by 1 and Dimension 1 is offset by 2):

5 x 6 array:

           
    X X X X
    X X X X
        X X X X
           

Then it reads the hyperslab from this file into a 2-dimensional plane (size 7 x 7) of a 3-dimensional array (size 7 x 7 x 3), as follows (with Dimension 0 offset by 3):

             
             
             
X X X X            
X X X X      
X X X X      
             

To obtain the example, download:

For details on compiling an HDF5 application, click here.

Remarks


- - Last modified: 21 December 2016