Navigate back: Main / Getting Started with HDF5 / Learning the Basics
HDF5 File Organization
-
Name and describe the two primary objects that can be stored in an HDF5 file.
Answer | Group: A grouping structure containing zero or more HDF5 objects, together with supporting metadata.
Dataset: A multidimensional array of data elements, together with supporting metadata. |
-
What is an attribute?
Answer | An HDF5 attribute is a user-defined HDF5 structure that provides extra information about an HDF5 object. |
-
Give the path name for an object called
harry
that is a member of a group called dick
, which, in turn, is a member of the root group.
The HDF5 API
-
Describe the purpose of each of the following HDF5 APIs:
H5A, H5D, H5E, H5F, H5G, H5T, H5Z
Answer | H5A: Attribute access and manipulation routines
H5D: Dataset access and manipulation routines
H5E: Error handling routines H5F: File access routines
H5G: Routines for creating and operating on groups
H5T: Routines for creating and manipulating the datatypes of dataset elements
H5Z: Data compression routines |
Creating an HDF5 File
-
What two HDF5 routines must be called to create an HDF5 file?
-
What include file must be included in any file that uses the HDF5 library?
Answer | hdf5.h must be included because it contains definitions and declarations used by the library. |
-
An HDF5 file is never completely empty because as soon as it is created, it automatically contains a certain primary object. What is that object?
Creating a Dataset
-
Name and describe two major datatype categories.
Answer | Atomic datatype: An atomic datatype cannot be decomposed into smaller units at the API level.
Compound datatype: A compound datatype is a collection of atomic and compound datatypes, or small arrays of such types. |
-
List the HDF5 atomic datatypes. Give an example of a predefined datatype. How would you create a string dataset?
Answer | There are six HDF5 atomic datatypes: integer, floating point, date and time, character string, bit field, and opaque.
Examples of predefined datatypes include the following:
You would create a string dataset with the H5T_C_S1 datatype, and set the size of the string with the H5Tset_size call. |
-
What does the dataspace describe? What are the major characteristics of the simple dataspace?
Answer | The dataspace describes the dimensionality of the dataset. A simple dataspace is characterized by its rank and dimension sizes. |
-
What information needs to be passed to the H5Dcreate function, i.e., what information is needed to describe a dataset at creation time?
Answer | The dataset location, name, dataspace, datatype, and dataset creation property list. |
Reading From and Writing To a Dataset
-
What are six pieces of information which need to be specified for reading and writing a dataset?
Answer | The dataset identifier, the dataset's datatype and dataspace in memory, the dataspace in the file, the dataset transfer property list, and a data buffer. |
-
Why are both the memory dataspace and file dataspace needed for read/write operations, while only the memory datatype is required?
Answer | A dataset's file datatype is not required for a read/write operation because the file datatype is specified when the dataset is created and cannot be changed. Both file and memory dataspaces are required for dataset subsetting and for performing partial I/O operations. |
-
In Figure 6.1, what does this line mean?
DATASPACE { SIMPLE (4 , 6 ) / ( 4 , 6 ) }
Answer | It means that the dataset dset has a simple dataspace with the current dimensions (4,6) and the maximum size of the dimensions (4,6). |
Creating an Attribute
-
What is an attribute?
Answer | An attribute is a dataset attached to an object. It describes the nature and/or the intended usage of the object. |
-
Can partial I/O operations be performed on attributes?
Creating an Group
-
What are the two primary objects that can be included in a group?
Answer | A group and a dataset. |
Creating Groups using Absolute and Relative Names
-
Group names can be specified in two ways. What are these two types of group names?
Answer | Relative and absolute. |
-
You have a dataset named
moo
in the group boo
, which is in the group foo
, which, in turn, is in the root
group. How would you specify an absolute name to access this dataset?
Creating Datasets in Groups
-
Describe a way to access the dataset moo described in the previous section (question 2) using a relative name. Describe a way to access the same dataset using an absolute name.
Answer | Access the group /foo and get the group ID. Access the group boo using the group ID obtained in Step 1. Access the dataset moo using the group ID obtained in Step 2. gid = H5Gopen (file_id, "/foo", 0);
#define H5Dopen Definition H5version.h:903
#define H5Gopen Definition H5version.h:1008
Access the group /foo and get the group ID. Access the dataset boo/moo with the group ID just obtained. gid = H5Gopen (file_id, "/foo", 0);
Access the dataset with an absolute path. did = H5Dopen (file_id, "/foo/boo/moo");
|
Previous Chapter Learning the basics QUIZ - Next Chapter Compiling HDF5 Applications
Navigate back: Main / Getting Started with HDF5 / Learning the Basics