[Top] [Prev] [Next] [Bottom]

2.4 File Format

HDF files contain a file header and at least one data descriptor block, as depicted in Figure 2c. The HDF file header occupies the first four bytes of every HDF file with a signature field containing the 32-bit hexadecimal value 0e031301. This number is considered a "magic cookie" as it identifies the file as an HDF file. Initially the data descriptor block consists of a group of empty data descriptors. As data objects are written to the file, the HDF library fills the data descriptor block by pairing one data descriptor for each data element. Refer to the following figure.

FIGURE 2c The Physical Layout of an HDF File Containing One Data Object

2.4.1 Grouping Data Objects in an HDF File

HDF files that contain more than one data element are generally easier to work with when the data objects containing related data are grouped together. These groups of data objects are called data sets. The HDF user uses the application interface to define, manipulate and dispose of data sets in a file.

As an example, an 8-bit raster image data set requires three objects: a group object identifying the members of the set, an image object containing the image data and a dimension object indicating the size of the image. It is sometimes possible to add additional data objects to the minimum set -for example, an 8-bit raster image set may include a palette.

Data objects are individually accessible even if they are included in a set, therefore data objects can belong to more than one set and sets can be included in larger groups. For example, a palette object included in one raster image set may also be a part of another raster image set if its tag and reference number are included in a data descriptor within that second set.

Several data sets may be further grouped into group objects. The contents of the group object depends on the HDF data set it supports.

2.4.2 Storing Data Objects

Data objects can be stored in HDF data files as a contiguous element, as linked-block elements or as external elements. These data storage options are illustrated below in Figure 2d.

FIGURE 2d HDF Data Storage Options

2.4.2.1 Contiguous Data Elements

This is the default method of data storage in HDF. In this case, all data objects exist in one HDF file and are stored in the manner illustrated in Figure 2c. Each data element in the file is one complete unit of raw data, and as only one unique data descriptor points to it there are no references or relationships to the other data elements in the file. As additional data elements are created and written they are appended to the end of the HDF file.

2.4.2.2 Linked-block Data Elements

Linked-block elements are a series of data elements existing in one HDF file which serve as a means of adding data to a pre-existing data element. These elements are linked to each other and to the original data element by a linked-list structure similar to the data descriptor list. They are of a uniform size with the exception of the first block after the original data element, which is the only block that can be resized.

2.4.2.3 External Data Elements

External data elements are those that exist in a file apart from the one the data descriptor list resides in. These additional HDF data files are referred to as external data files. The HDF library keeps track of the filesystem location of the external data file as well as the standard tag/reference number pair, offset and length information of the external element.



[Top] [Prev] [Next] [Bottom]

hdfhelp@ncsa.uiuc.edu
HDF User's Guide - 06/04/97, NCSA HDF Development Group.