/** @page LBFileOrg HDF5 File Organization Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
\section secLBFileOrg HDF5 file An HDF5 file is a container for storing a variety of scientific data and is composed of two primary types of objects: groups and datasets. \li HDF5 group: a grouping structure containing zero or more HDF5 objects, together with supporting metadata \li HDF5 dataset: a multidimensional array of data elements, together with supporting metadata Any HDF5 group or dataset may have an associated attribute list. An HDF5 attribute is a user-defined HDF5 structure that provides extra information about an HDF5 object. Working with groups and datasets is similar in many ways to working with directories and files in UNIX. As with UNIX directories and files, an HDF5 object in an HDF5 file is often referred to by its full path name (also called an absolute path name). \li / signifies the root group. \li /foo signifies a member of the root group called foo. \li /foo/zoo signifies a member of the group foo, which in turn is a member of the root group. Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics @page LBAPI The HDF5 API Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
\section secLBAPI HDF5 C API The HDF5 library provides several interfaces, or APIs. These APIs provide routines for creating, accessing, and manipulating HDF5 files and objects. The library itself is implemented in C. To facilitate the work of FORTRAN 90, C++ and Java programmers, HDF5 function wrappers have been developed in each of these languages. This tutorial discusses the use of the C functions and the FORTRAN wrappers. All C routines in the HDF5 library begin with a prefix of the form H5*, where * is one or two uppercase letters indicating the type of object on which the function operates. The FORTRAN wrappers come in the form of subroutines that begin with h5 and end with _f. Java routine names begin with “H5*” and are prefixed with “H5.” as the class. Constants are in the HDF5Constants class and are prefixed with "HDF5Constants.". The APIs are listed below:
API DESCRIPTION
H5 Library Functions: general-purpose H5 functions
H5A Annotation Interface: attribute access and manipulation routines
H5D Dataset Interface: dataset access and manipulation routines
H5E Error Interface: error handling routines
H5F File Interface: file access routines
H5G Group Interface: group creation and operation routines
H5I Identifier Interface: identifier routines
H5L Link Interface: link routines
H5O Object Interface: object routines
H5P Property List Interface: object property list manipulation routines
H5R Reference Interface: reference routines
H5S Dataspace Interface: dataspace definition and access routines
H5T Datatype Interface: datatype creation and manipulation routines
H5Z Compression Interface: compression routine(s)
Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics @page LBProg Programming Issues Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
Keep the following in mind when looking at the example programs included in this tutorial: \section LBProgAPI APIs vary with different languages \li C routines begin with the prefix “H5*” where * is a single letter indicating the object on which the operation is to be performed:
File Interface: #H5Fopen
Dataset Interface: #H5Dopen
\li FORTRAN routines begin with “h5*” and end with “_f”:
File Interface: h5fopen_f
Dataset Interface: h5dopen_f
\li Java routine names begin with “H5*” and are prefixed with “H5.” as the class. Constants are in the HDF5Constants class and are prefixed with "HDF5Constants.".:
File Interface: H5.H5Fopen
Dataset Interface: H5.H5Dopen
\li APIS for languages like C++, Java, and Python use methods associated with specific objects. \section LBProgTypes HDF5 library has its own defined types \li #hid_t is used for object handles \li hsize_t is used for dimensions \li #herr_t is used for many return values \section LBProgLang Language specific files must be included in applications Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics @page LBFileCreate Creating an HDF5 File Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
An HDF5 file is a binary file containing scientific data and supporting metadata. \section secLBFileCreate HDF5 File Access To create an HDF5 file, an application must specify not only a file name, but a file access mode, a file creation property list, and a file access property list. These terms are described below: Please refer to the \ref sec_file section of the \ref UG and \ref H5F section in the \ref RM for detailed information regarding file access/creation property lists and access modes. The steps to create and close an HDF5 file are as follows:
  1. Specify the file creation and access property lists, if necessary.
  2. Create the file.
  3. Close the file, and if necessary, close the property lists.
\section secLBFileExample Programming Example \subsection subsecLBFileExampleDesc Description The following example code demonstrates how to create and close an HDF5 file. C \code #include "hdf5.h" #define FILE "file.h5" int main() { hid_t file_id; /* file identifier */ herr_t status; /* Create a new file using default properties. */ file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* Terminate access to the file. */ status = H5Fclose(file_id); } \endcode Fortran \code PROGRAM FILEEXAMPLE USE HDF5 ! This module contains all necessary modules IMPLICIT NONE CHARACTER(LEN=8), PARAMETER :: filename = "filef.h5" ! File name INTEGER(HID_T) :: file_id ! File identifier INTEGER :: error ! Error flag ! ! Initialize FORTRAN interface. ! CALL h5open_f (error) ! ! Create a new file using default properties. ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! ! Terminate access to the file. ! CALL h5fclose_f(file_id, error) ! ! Close FORTRAN interface. ! CALL h5close_f(error) END PROGRAM FILEEXAMPLE \endcode See \ref LBExamples for the examples used in the Learning the Basics tutorial. For details on compiling an HDF5 application: [ \ref LBCompiling ] \subsection subsecLBFileExampleRem Remarks \li In C: The include file hdf5.h contains definitions and declarations and must be included in any program that uses the HDF5 library.
In FORTRAN: The module HDF5 contains definitions and declarations and must be used in any program that uses the HDF5 library. Also note that #H5open MUST be called at the beginning of an HDF5 Fortran application (prior to any HDF5 calls) to initialize the library and variables. The #H5close call MUST be at the end of the HDF5 Fortran application. \li #H5Fcreate creates an HDF5 file and returns the file identifier.
For Fortran, the file creation property list and file access property list are optional. They can be omitted if the default values are to be used.
The root group is automatically created when a file is created. Every file has a root group and the path name of the root group is always /. \li #H5Fclose terminates access to an HDF5 file.
When an HDF5 file is no longer accessed by a program, #H5Fclose must be called to release the resources used by the file. This call is mandatory.
Note that if #H5Fclose is called for a file, but one or more objects within the file remain open, those objects will remain accessible until they are individually closed. This can cause access problems for other users, if objects were inadvertently left open. A File Access property controls how the file is closed. \subsection subsecLBFileExampleCont File Contents The HDF Group has developed tools for examining the contents of HDF5 files. The tool used throughout the HDF5 tutorial is the HDF5 dumper, h5dump, which displays the file contents in human-readable form. The output of h5dump is an ASCII display formatted according to the HDF5 DDL grammar. This grammar is defined, using Backus-Naur Form, in the \ref DDLBNF110. To view the HDF5 file contents, simply type: \code h5dump \endcode
Describe the file contents of file.h5 using a directed graph.
\image html imgLBFile.gif
The text description of file.h5, as generated by h5dump. The HDF5 file called file.h5 contains a group called /, or the root group. (The file called filef.h5, created by the FORTRAN version of the example, has the same output except that the filename shown is filef.h5.) \code HDF5 "file.h5" { GROUP "/" { } } \endcode \subsection subsecLBFileExampleDDL File Definition in DDL The simplified DDL file definition for creating an HDF5 file. For simplicity, a simplified DDL is used in this tutorial. A complete and more rigorous DDL can be found in the \ref DDLBNF110. The following symbol definitions are used in the DDL: \code ::= defined as a token with the name tname | one of or * zero or more occurrences of \endcode The simplified DDL for file definition is as follows: \code ::= HDF5 "" { } ::= GROUP "/" { * * } ::= ::= | \endcode Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics @page LBDsetCreate Creating a Dataset Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
A dataset is a multidimensional array of data elements, together with supporting metadata. To create a dataset, the application program must specify the location at which to create the dataset, the dataset name, the datatype and dataspace of the data array, and the property lists. \section secLBDsetCreateDtype Datatypes A datatype is a collection of properties, all of which can be stored on disk, and which, when taken as a whole, provide complete information for data conversion to or from that datatype. There are two categories of datatypes in HDF5:
  • Pre-defined: These datatypes are opened and closed by HDF5.
    Pre-defined datatypes can be atomic or composite:
    • Atomic datatypes cannot be decomposed into smaller datatype units at the API level. For example: integer, float, reference, string.
    • Composite datatypes are aggregations of one or more datatypes. For example: array, variable length, enumeration, compound.
  • Derived: These datatypes are created or derived from the pre-defined types.
    A simple example of creating a derived datatype is using the string datatype, H5T_C_S1, to create strings of more than one character:
    \code hid_t strtype; // Datatype ID herr_t status; strtype = H5Tcopy (H5T_C_S1); status = H5Tset_size (strtype, 5); // create string of length 5 \endcode
Shown below is the HDF5 pre-defined datatypes. \code +-- integer +-- floating point +---- atomic ----+-- date and time | +-- character string HDF5 datatypes --| +-- bitfield | +-- opaque | +---- compound \endcode Some of the HDF5 predefined atomic datatypes are listed below.
Examples of HDF5 predefined datatypes
Datatype Description
H5T_STD_I32LE Four-byte, little-endian, signed, two's complement integer
H5T_STD_U16BE Two-byte, big-endian, unsigned integer
H5T_IEEE_F32BE Four-byte, big-endian, IEEE floating point
H5T_IEEE_F64LE Eight-byte, little-endian, IEEE floating point
H5T_C_S1 One-byte, null-terminated string of eight-bit characters
Examples of HDF5 predefined native datatypes
Native Datatype Corresponding C or FORTRAN Type
C
H5T_NATIVE_INT int
H5T_NATIVE_FLOAT float
H5T_NATIVE_CHAR char
H5T_NATIVE_DOUBLE double
H5T_NATIVE_LDOUBLE long double
Fortran
H5T_NATIVE_INTEGER integer
H5T_NATIVE_REAL real
H5T_NATIVE_DOUBLE double precision
H5T_NATIVE_CHARACTER character
In this tutorial, we consider only HDF5 predefined integers. For further information on datatypes, see \ref sec_datatype in the \ref UG, in addition to the \ref LBDatatypes tutorial topic. \section secLBDsetCreateDspace Datasets and Dataspaces A dataspace describes the dimensionality of the data array. A dataspace is either a regular N-dimensional array of data points, called a simple dataspace, or a more general collection of data points organized in another manner, called a complex dataspace. In this tutorial, we only consider simple dataspaces. HDF5 dataspaces \code +-- simple HDF5 dataspaces --| +-- complex \endcode The dimensions of a dataset can be fixed (unchanging), or they may be unlimited, which means that they are extensible. A dataspace can also describe a portion of a dataset, making it possible to do partial I/O operations on selections. \section secLBDsetCreateProp Property Lists Property lists are a mechanism for modifying the default behavior when creating or accessing objects. For more information on property lists see the \ref LBPropsList tutorial topic. The following property lists can be specified when creating a dataset: \li Dataset Creation Property List
When creating a dataset, HDF5 allows the user to specify how raw data is organized and/or compressed on disk. This information is stored in a dataset creation property list and passed to the dataset interface. The raw data on disk can be stored contiguously (in the same linear way that it is organized in memory), partitioned into chunks, stored externally, etc. In this tutorial, we use the default dataset creation property list (contiguous storage layout and no compression). For more information about dataset creation property lists, see \ref sec_dataset in the \ref UG. \li Link Creation Property List
The link creation property list governs creation of the link(s) by which a new dataset is accessed and the creation of any intermediate groups that may be missing. \li Dataset Access Property List
Dataset access property lists are properties that can be specified when accessing a dataset. \section secLBDsetCreateSteps Steps to Create a Dataset To create an empty dataset (no data written) the following steps need to be taken:
  1. Obtain the location identifier where the dataset is to be created.
  2. Define or specify the dataset characteristics:
    1. Define a datatype or specify a pre-defined datatype.
    2. Define a dataspace.
    3. Specify the property list(s) or use the default.
  3. Create the dataset.
  4. Close the datatype, the dataspace, and the property list(s) if necessary.
  5. Close the dataset.
In HDF5, datatypes and dataspaces are independent objects which are created separately from any dataset that they might be attached to. Because of this, the creation of a dataset requires the definition of the datatype and dataspace. In this tutorial, we use the HDF5 predefined datatypes (integer) and consider only simple dataspaces. Hence, only the creation of dataspace objects is needed. \section secLBDsetCreateHL High Level APIs The High Level \ref H5LT include functions that simplify and condense the steps for creating datasets in HDF5. The examples in the following section use the standard APIs. For a quick start you may prefer to look at the \ref H5LT at this time. If you plan to work with images, please look at the High Level \ref H5IM, as well. \section secLBDsetCreateProg Programming Example \subsection subsecLBDsetCreateProgDesc Description See \ref LBExamples for the examples used in the \ref LearnBasics tutorial. The example shows how to create an empty dataset. It creates a file called dset.h5 in the C version (dsetf.h5 in Fortran), defines the dataset dataspace, creates a dataset which is a 4x6 integer array, and then closes the dataspace, the dataset, and the file. For details on compiling an HDF5 application: [ \ref LBCompiling ] \subsection subsecLBDsetCreateProgRem Remarks #H5Screate_simple creates a new simple dataspace and returns a dataspace identifier. #H5Sclose releases and terminates access to a dataspace. C \code dataspace_id = H5Screate_simple (rank, dims, maxdims); status = H5Sclose (dataspace_id ); \endcode FORTRAN \code CALL h5screate_simple_f (rank, dims, dataspace_id, hdferr, maxdims=max_dims) or CALL h5screate_simple_f (rank, dims, dataspace_id, hdferr) CALL h5sclose_f (dataspace_id, hdferr) \endcode #H5Dcreate creates an empty dataset at the specified location and returns a dataset identifier. #H5Dclose closes the dataset and releases the resource used by the dataset. This call is mandatory. C \code dataset_id = H5Dcreate(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dclose (dataset_id); \endcode FORTRAN \code CALL h5dcreate_f (loc_id, name, type_id, dataspace_id, dset_id, hdferr) CALL h5dclose_f (dset_id, hdferr) \endcode Note that if using the pre-defined datatypes in FORTRAN, then a call must be made to initialize and terminate access to the pre-defined datatypes: \code CALL h5open_f (hdferr) CALL h5close_f (hdferr) \endcode H5open must be called before any HDF5 library subroutine calls are made; H5close must be called after the final HDF5 library subroutine call. See the programming example for an illustration of the use of these calls. \subsection subsecLBDsetCreateContent File Contents The contents of the file dset.h5 (dsetf.h5 for FORTRAN) are shown below:
Contents of dset.h5 (dsetf.h5)
\image html imgLBDsetCreate.gif
dset.h5 in DDL dsetf.h5 in DDL
\code HDF5 "dset.h5" { GROUP "/" { DATASET "dset" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) } DATA { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } } \endcode \code HDF5 "dsetf.h5" { GROUP "/" { DATASET "dset" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 6, 4 ) / ( 6, 4 ) } DATA { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } } \endcode
Note in above that #H5T_STD_I32BE, a 32-bit Big Endian integer, is an HDF atomic datatype. \subsection subsecLBDsetCreateProgDDL Dataset Definition in DDL The following is the simplified DDL dataset definition: \code ::= DATASET "" { * } ::= DATATYPE { } ::= DATASPACE { SIMPLE / } ::= \endcode
Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics @page LBDsetRW Reading From and Writing To a Dataset Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
\section secLBDsetRW Dataset I/O Operation During a dataset I/O operation, the library transfers raw data between memory and the file. The data in memory can have a datatype different from that of the file and can also be of a different size (i.e., the data in memory is a subset of the dataset elements, or vice versa). Therefore, to perform read or write operations, the application program must specify: \li The dataset \li The dataset's datatype in memory \li The dataset's dataspace in memory \li The dataset's dataspace in the file \li The dataset transfer property list
  • (The dataset transfer property list controls various aspects of the I/O operations, such as the number of processes participating in a collective I/O request or hints to the library to control caching of raw data. In this tutorial, we use the default dataset transfer property list.)
\li The data buffer The steps to read from or write to a dataset are as follows:
  1. Obtain the dataset identifier.
  2. Specify the memory datatype.
  3. Specify the memory dataspace.
  4. Specify the file dataspace.
  5. Specify the transfer properties.
  6. Perform the desired operation on the dataset.
  7. Close the dataset.
  8. Close the dataspace, datatype, and property list if necessary.
To read from or write to a dataset, the #H5Dread and #H5Dwrite routines are used. C \code status = H5Dread (set_id, mem_type_id, mem_space_id, file_space_id, xfer_prp, buf ); status = H5Dwrite (set_id, mem_type_id, mem_space_id, file_space_id, xfer_prp, buf); \endcode Fortran \code CALL h5dread_f(dset_id, mem_type_id, buf, dims, error, & mem_space_id=mspace_id, file_space_id=fspace_id, & xfer_prp=xfer_plist_id) or CALL h5dread_f(dset_id, mem_type_id, buf, dims, error) CALL h5dwrite_f(dset_id, mem_type_id, buf, dims, error, & mem_space_id=mspace_id, file_space_id=fspace_id, & xfer_prp=xfer_plist_id) or CALL h5dwrite_f(dset_id, mem_type_id, buf, dims, error) \endcode \section secLBDsetRWHL High Level APIs The High Level \ref H5LT include functions that simplify and condense the steps for creating and reading datasets. Please be sure to review them, in addition to this tutorial. \section secLBDsetRWEx Programming Example \subsection secLBDsetRWExDesc Description See \ref LBExamples for the examples used in the \ref LearnBasics tutorial. The example shows how to read and write an existing dataset. It opens the file created in the previous example, obtains the dataset identifier for the dataset /dset, writes the dataset to the file, then reads the dataset back. It then closes the dataset and file. Note that #H5S_ALL is passed in for both the memory and file dataspace parameters in the read and write calls. This indicates that the entire dataspace of the dataset will be read or written to. #H5S_ALL by itself does not necessarily have this meaning. See the \ref RM entry for #H5Dread or #H5Dwrite for more information on using #H5S_ALL. For details on compiling an HDF5 application: [ \ref LBCompiling ] \subsection secLBDsetRWExRem Remarks #H5Fopen opens an existing file and returns a file identifier. #H5Dopen opens an existing dataset with the specified name and location. #H5Dwrite writes raw data from an application buffer to the specified dataset, converting from the datatype and dataspace of the dataset in memory to the datatype and dataspace of the dataset in the file. Specifying #H5S_ALL for both the memory and file dataspaces indicates that the entire dataspace of the dataset is to be written to. #H5S_ALL by itself does not necessarily have this meaning. See the \ref RM entry for #H5Dwrite for more information on using #H5S_ALL. #H5Dread reads raw data from the specified dataset to an application buffer, converting from the file datatype and dataspace to the memory datatype and dataspace. Specifying #H5S_ALL for both the memory and file dataspaces indicates that the entire dataspace of the dataset is to be read. #H5S_ALL by itself does not necessarily have this meaning. See the \ref RM entry for #H5Dread for more information on using #H5S_ALL. \subsection secLBDsetRWExCont File Contents Shown below is the contents of dset.h5 (created by the C program). dset.h5 in DDL \code HDF5 "dset.h5" { GROUP "/" { DATASET "dset" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) } DATA { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 } } } } \endcode Shown below is the contents of dsetf.h5 (created by the FORTRAN program). dsetf.h5 in DDL \code HDF5 "dsetf.h5" { GROUP "/" { DATASET "dset" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 6, 4 ) / ( 6, 4 ) } DATA { 1, 7, 13, 19, 2, 8, 14, 20, 3, 9, 15, 21, 4, 10, 16, 22, 5, 11, 17, 23, 6, 12, 18, 24 } } } } \endcode
Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics @page LBAttrCreate Creating an Attribute Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
Attributes are small datasets that can be used to describe the nature and/or the intended usage of the object they are attached to. In this section, we show how to create, read, and write an attribute. \section secLBAttrCreate Creating an attribute Creating an attribute is similar to creating a dataset. To create an attribute, the application must specify the object which the attribute is attached to, the datatype and dataspace of the attribute data, and the attribute creation property list. The steps to create an attribute are as follows:
  1. Obtain the object identifier that the attribute is to be attached to.
  2. Define the characteristics of the attribute and specify the attribute creation property list.
    • Define the datatype.
    • Define the dataspace.
    • Specify the attribute creation property list.
  3. Create the attribute.
  4. Close the attribute and datatype, dataspace, and attribute creation property list, if necessary.
To create and close an attribute, the calling program must use #H5Acreate and #H5Aclose. For example: C \code attr_id = H5Acreate (dataset_id, "Units", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT) status = H5Aclose (attr_id); \endcode Fortran \code CALL h5acreate_f (dset_id, attr_nam, type_id, space_id, attr_id, & hdferr, creation_prp=creat_plist_id) or CALL h5acreate_f (dset_id, attr_nam, type_id, space_id, attr_id, hdferr) CALL h5aclose_f (attr_id, hdferr) \endcode \section secLBAttrCreateRW Reading/Writing an attribute Attributes may only be read or written as an entire object; no partial I/O is supported. Therefore, to perform I/O operations on an attribute, the application needs only to specify the attribute and the attribute's memory datatype. The steps to read or write an attribute are as follows.
  1. Obtain the attribute identifier.
  2. Specify the attribute's memory datatype.
  3. Perform the desired operation.
  4. Close the memory datatype if necessary.
To read and/or write an attribute, the calling program must contain the #H5Aread and/or #H5Awrite routines. For example: C \code status = H5Aread (attr_id, mem_type_id, buf); status = H5Awrite (attr_id, mem_type_id, buf); \endcode Fortran \code CALL h5awrite_f (attr_id, mem_type_id, buf, dims, hdferr) CALL h5aread_f (attr_id, mem_type_id, buf, dims, hdferr) \endcode \section secLBAttrCreateHL High Level APIs The High Level \ref H5LT include functions that simplify and condense the steps for creating and reading datasets. Please be sure to review them, in addition to this tutorial. \section secLBAttrCreateRWEx Programming Example \subsection secLBAttrCreateRWExDesc Description See \ref LBExamples for the examples used in the \ref LearnBasics tutorial. The example shows how to create and write a dataset attribute. It opens an existing file dset.h5 in C (dsetf.h5 in FORTRAN), obtains the identifier of the dataset /dset, defines the attribute's dataspace, creates the dataset attribute, writes the attribute, and then closes the attribute's dataspace, attribute, dataset, and file. For details on compiling an HDF5 application: [ \ref LBCompiling ] \subsection secLBAttrCreateRWExRem Remarks #H5Acreate creates an attribute which is attached to the object specified by the first parameter, and returns an identifier. #H5Awrite writes the entire attribute, and returns the status of the write. When an attribute is no longer accessed by a program, #H5Aclose must be called to release the attribute from use. An #H5Aclose/h5aclose_f call is mandatory. \subsection secLBAttrCreateRWExCont File Contents Shown below is the contents and the attribute definition of dset.h5 (created by the C program). dset.h5 in DDL \code HDF5 "dset.h5" { GROUP "/" { DATASET "dset" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) } DATA { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 } ATTRIBUTE "attr" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 2 ) / ( 2 ) } DATA { 100, 200 } } } } } \endcode Shown below is the contents and the attribute definition of dsetf.h5 (created by the FORTRAN program). dsetf.h5 in DDL \code HDF5 "dsetf.h5" { GROUP "/" { DATASET "dset" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 6, 4 ) / ( 6, 4 ) } DATA { 1, 7, 13, 19, 2, 8, 14, 20, 3, 9, 15, 21, 4, 10, 16, 22, 5, 11, 17, 23, 6, 12, 18, 24 } ATTRIBUTE "attr" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 2 ) / ( 2 ) } DATA { 100, 200 } } } } } \endcode \subsection secLBAttrCreateRWExDDL Attribute Definition in DDL HDF5 Attribute Definition \code ::= ATTRIBUTE "" { } \endcode
Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics */