[ HDF5 Tutorial Top ]

Hyperslab Selections


Contents:


Selecting a Portion of a Dataspace

Hyperslabs are portions of datasets. 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:

NOTE: To download a tar file of the examples, including a Makefile, please go to the References page.

Remarks


NCSA
The National Center for Supercomputing Applications

University of Illinois at Urbana-Champaign

hdfhelp@ncsa.uiuc.edu

Last Modified: June 22, 2001