Contents:
- Creating an Extendible Dataset
- Programming Example
Creating an Extendible Dataset
An extendible dataset is one whose dimensions can grow. HDF5 allows you to define a dataset to have certain initial dimensions, then to later increase the size of any of the initial dimensions.
HDF5 requires you to use chunking to define extendible datasets. This makes it possible to extend datasets efficiently without having to excessively reorganize storage.
The following operations are required in order to write an extendible dataset:
- Declare the dataspace of the dataset to have unlimited dimensions for all dimensions that might eventually be extended.
- Set dataset creation properties to enable chunking.
- Create the dataset.
- Extend the size of the dataset.
Programming Example
Description
This example shows how to create a 3 x 3 extendible dataset, write to that dataset, extend the dataset to 10x3, and write to the dataset again.-
[C example (for HDF5 1.8) ]
-
h5_extend18.c[C example (for HDF5 1.6) ] -
h5_extend.c[FORTRAN example ] -
chunk.f90
Remarks
-
An unlimited dimension dataspace is specified with the H5Screate_simple / h5screate_simple_f call, by passing in
H5S_UNLIMITEDas an element of the maxdims array. -
The H5Pcreate / h5pcreate_f call creates a new property as an instance of a property list class. For creating an extendible array dataset, pass in H5P_DATASET_CREATE for the property list class.
-
The H5Pset_chunk / h5pset_chunk_f call modifies a Dataset Creation Property List instance to store a chunked layout dataset and sets the size of the chunks used.
-
To extend an unlimited dimension dataset use the the H5Dextend / h5dextend_f call.
-
The H5Pget_chunk / h5pget_chunk_f call retrieves the size of chunks for the raw data of a chunked layout dataset.
-
Once there is no longer a need for a Property List instance, it should be closed with the H5Pclose / h5pclose_f call.
- - Last modified:September 23rd 2009
