The HDF5 source code provides many example programs:
C
Feature | Example |
---|---|
Introductory examples | Examples from Learning the Basics |
Creates / Reads / Writes Attributes | h5_attribute.c |
Reads / Writes from a Chunked Dataset (reads file created by h5_extend_write.c) | h5_chunk_read.c |
Creates a compound datatype, writes array of compound and reads back fields' subsets | h5_compound.c |
Shows how to use virtual file drivers | h5_drivers.c |
Demonstrates how the data transform features in HDF5 work | h5_dtransform.c |
Windows to Unix traversal function for external links | h5_elink_unix2win.c |
Create and appends to an extendible dataset | h5_extend_write.c |
Create and uses external links in HDF5 | h5_extlink.c |
Creates a group with two datasets, creates hard link to group and uses iterator functions | h5_group.c |
Checks if group exists and creates intermediate groups | h5_interm_group.c |
Shows concept of mounting files | h5_mount.c |
Reads hyperslabs from file created with h5_write.c | h5_read.c |
Creates, stores, and dereferences references to dataset regions | h5_ref2reg.c |
Creates and reads object references | h5_reference.c |
Selects hyperslabs and elements to write selected data from memory to file | h5_select.c |
Creates a file using property lists to control which messages are shared (to save space) | h5_shared_mesg.c |
Creates a dataset using default properties | h5_write.c |
VDS example that illustrates the Eiger use case (see VDS Example Description) | h5_vds-eiger.c |
h5_vds-exc.c | |
VDS Example illustrating Excalibur use case (see VDS Example Description) | h5_vds-exclim.c |
h5_vds-percival-unlim-maxmin.c | |
h5_vds-percival-unlim.c | |
VDS Example that illustrates Percival use case (see VDS Example Description) | h5_vds-percival.c |
h5_vds-simpleIO.c | |
VDS Example that illustrates usage of H5Pset(get)_virtual_* functions (see VDS Example Description) | h5_vds.c |
Example of using parallel HDF5 | ph5example.c |
FORTRAN
Feature | Example |
---|---|
Introductory examples | Examples from Learning the Basics |
More advanced example of using hyperslabs | hyperslab.f90 |
Shows concept of mounting files | mountexample.f90 |
Shows nested derived type | nested_derived_type.f90 |
Creates and reads a dataset with a compound datatype | compound.f90 |
Creates and reads a dataset with a complex compound datatype (F2003) | compound_complex_fortran2003.f90 |
Creates and reads a dataset with a compound datatype (F2003) | compound_fortran2003.f90 |
Shows how to use Parallel HDF5 | ph5example.f90 |
Creates, stores, and dereferences object references | refobjexample.f90 |
Creates, stores, and dereferences references to dataset regions | refregexample.f90 |
Reads, writes a dataset with F2003 features | rwdset_fortran2003.f90 |
Shows how to select elements in a dataset | selectele.f90 |
Java
Feature | Example |
---|---|
Introductory Examples | Examples from Learning the Basics |
Examples by API |
C++
Feature | Example |
---|---|
Reads / Writes from a Chunked Dataset (from file created by extend_ds.cpp) | chunks.cpp |
Creates a compound datatype, writes array of compound and reads back fields' subsets | compound.cpp |
Writes a dataset to a new HDF5 file | create.cpp |
Shows how to work with extendible dataset | extend_ds.cpp |
Creates a group with two datasets, creates hard link to group and uses iterator functions | h5group.cpp |
Reads hyperslabs from file created with create.cpp | readdata.cpp |
Creates a file and dataset and shows how to use hyperslab and element selection | writedata.cpp |
High Level
Feature | Example | Additional Files |
---|---|---|
H5DS: HDF5 Dimension Scale | ||
Attach a dimension scale | ex_ds1.c | |
Attach a dimension scale and add a label | ex_ds1.f90 | |
H5IM: HDF5 Image | ||
Create 8-bit image and attach a palette | ex_image1.c | |
Create 8-bit and 24-bit image, attach palette and read back | ex_image2.c | |
H5LT: HDF5 Lite | ||
Write a dataset | ex_lite1.c | |
Read a dataset | ex_lite2.c | |
Write an attribute | ex_lite3.c | |
Create and read a dataset | exlite.f90 | |
H5TB: HDF5 Table | ||
Creating and reading a table | ex_table_01.c | |
Appending and reading records | ex_table_02.c | |
Overwriting records | ex_table_03.c | |
Writing and reading fields by name | ex_table_04.c | |
Writing and reading fields by index | ex_table_05.c | |
Querying | ex_table_06.c | |
Deleting records | ex_table_07.c | |
Inserting records | ex_table_08.c | |
Adding records from one table to another | ex_table_09.c | |
Combining tables | ex_table_10.c | |
Inserting a new field into a table | ex_table_11.c | |
Deleting a field from a table | ex_table_12.c | |
H5PT: HDF5 Packet Table | ||
Create, write, and read a packet table | ptExampleFL.c | |
Create, write and read a packet table | ptExampleFL.cpp |
VDS Example Description
A description of what some of the VDS examples in the source code do is included below. For information on using the VDS feature see Virtual Dataset in the New Features in HDF5 Release 1.10. Also see the tutorial Introduction to the Virtual Dataset - VDS which uses the h5_vds.c example described below.
Example | Description |
---|---|
C example that illustrates usage of H5Pset(get)_virtual_* functions (also see Introduction to the Virtual Dataset - VDS) | |
h5_vds-eiger.c | C example that illustrates Eiger use case (fixed size VDS) |
h5_vds-exclim.c | C example that illustrates Excalibur use case (fixed size VDS) |
h5_vds-percival.c | C example that illustrates Percival use case (fixed size VDS) |
--- Last Modified: October 22, 2020 | 11:56 AM