HDF5 Waveform File VIs


Table of Contents


Overview

HDF5 is a general purpose file system which allows the user to treat the file as a mini file system. As such, an HDF5 file may contain virtually any object. For full documentation on HDF5, go to the NCSA website. There are two basic objects in an HDF5 file - groups and data. Groups are similar to file folders in a file system. Data is similar to the files. Data is further subdivided into attributes and datasets. Attributes are usually scalar values or strings associated with a group or dataset. Datasets are of arbitrary data type.

Waveforms are stored in groups. Each waveform group may contain one or more traces (waveforms). A single file may contain several waveform groups with one or more traces per group. A trace is a data structure containing all the data necessary to reproduce a single waveform. Generally, a waveform group contains traces which are logically related.  For example, a waveform group could contain two traces that were taken at the same time with a dual channel digitizer.

A single file can contain waveform groups and other data as well.  The National Instruments Scope-SFP digitizer soft front panel has the ability to save waveforms and the configuration under which the waveforms were taken into the same file.  Due to the flexible nature of HDF5, virtually any combination of data can be placed in a single file.

Within a waveform group, the data is stored in four groups - ID, traces, axes, and vectors.  The ID group contains information identifying the particular set of waveforms.  The ID block may be empty.  The trace group contains references to the axes group.  Every trace has an X and Y axis, referenced to the axes group.  Axes can be shared between traces to save space.  A common use case is storage of the output of a multi-channel digitizer as one X axis and several Y axes.  The axes are either implicit (start, increment) or explicit (a data vector).  Explicit axes point to the vectors group for their data.  Each of these groups and the data within them has several attributes, such as name, notes, etc.  All these fields can be accessed using the VIs in this set.

[go to top]


Conventions and Default Behavior

Function Definition Convention

Function names are listed as a heading to a section.  Inputs and outputs are listed separately with bulleted lists.  They are listed as:

Default Read and Write Values

The functions in this help file have the following default behavior for variable type

2U32 Data Format

Since HDF5 is a 64-bit file system and LabVIEW is a 32-bit program, some accommodation is necessary to realize the full power of HDF5.  When 64-bit integers are needed for file pointers, they are represented by a cluster containing two U32s.  This data type is called a 2U32.

[go to top]


Requirements

The following DLLs must be installed in your system directory.  Installing one of the National Instruments Soft Front Panels which use HDF5 files will do this for you automatically

[go to top]


Copyright Information

Copyright © 2001 National Instruments
All rights reserved.

NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities
Copyright © 1998, 1999, 2000, 2001 by the Board of Trustees of the University of Illinois
All rights reserved.
See the end of this file for the full HDF5 copyright notice.

[go to top]


Examples

sfpFileEX Browse I8 Trace.vi

This example demonstrates how to extract portions of a waveform trace from a file.  This is very useful for large data files that do not easily fit in memory.

To run the example, click on the folder icon in the upper right of the File Path control.  Browse to the file you wish to open and select it.  Now click on the run button to run the VI.  The VI will query the file for the traces available and fill in the Traces Available control with the results.  It will automatically display the first trace.  You can select a different trace while the VI is running and it will change the display.

The Location (%) and Width (%) slider controls allow you to control what portion of the waveform is displayed on the screen.  Use the Location (%) control to set the start point of the data you extract from the file.  This is in percent.  Use the Width (%) control to set how many data points are extracted from the file.  Note that the units of this control are also percent of the total waveform length.  Internally, the data width is limited to the range 10 to 1 million data points.  The location is internally coerced to a maximum of 100 - data width in %.  The Width (%) control is logarithmic to allow its easy use with huge data files.  If you prefer a linear scale, while the VI is not running, pop up on the control and select Scale>Mapping>Linear.  Then reset the minimum value to whatever you wish.

The graph axes and label will be changed to match the input trace parameters.  The data is scaled and offset before being displayed.

If you wish to browse a different file with a different data type than I8, change the data type input to the H5D Open-Read.vi to the appropriate type.

[go to top]

sfpFileEX Query-Read Single Trace.vi

This example demonstrates how to determine the data type of a trace, then read the entire trace into memory.

To use the VI, click on the file folder icon on the upper right corner of the File Path control.  Select the file you wish to query for waveforms.  Now run the VI.  A list of available traces will appear in the Traces Available control.  The first will be automatically selected.  Select the trace you wish to view and it will be displayed.  The graph label and axes labels will be updated for each trace.

[go to top]

sfpFileEX Query-Read Single I8 Trace.vi

This example is a simpler version of sfpFileEX Query-Read Single Trace.vi.  It demonstrates how to read an entire trace into memory.  The trace must have data of type I8.  You can easily change the data type by popping up on the sfpFile Read Simple Single Trace.vi and selecting Select Type>xxx, where xxx is the VI for the particular data type you wish to read.

To use the VI, click on the file folder icon on the upper right corner of the File Path control.  Select the file you wish to query for waveforms.  Now run the VI.  A list of available traces will appear in the Traces Available control.  The first will be automatically selected.  Select the trace you wish to view and it will be displayed.  The graph label and axes labels will be updated for each trace.

[go to top]

sfpFileEX Write One I8 Trace.vi

This example demonstrates how to write a single trace waveform group into an HDF5 file.  The trace must have data of type I8.  You can easily change the data type by popping up on the sfpFile Read Simple Single Trace.vi and selecting Select Type>xxx, where xxx is the VI for the particular data type you wish to read.

To use the VI, click the run button.  A signal will be generated based on the values of signal type, frequency, amplitude, sample frequency, nPoints, and Power Spectrum.  When you have the signal you want, fill in the waveform name.  Then, click on the file folder icon on the upper right corner of the File Path control.  Select the file you wish to write to.  This can be a new or existing file.  The data will be written to the file.

If you wish to view your data, use sfpFileEX Query-Read Single I8 Trace.vi or one of the HDF5 file viewers listed on the HDF5 software page.

[go to top]


HDF5 Primitives

These functions perform basic operations used by most of the following VIs.  The first three letters of the function identify it as an HDF5 primitive and give a use identifier.  For example, H5F means the function performs file operations.  H5G means the function performs group operations.

H5Fclose.vi

This VI closes  the file specified by file_id.

Inputs

Outputs

[go to top]

H5F Open-Create-Replace File.vi

This VI opens HDF5 files.  It is analogous to the LabVIEW VI of the same name.  The file must be closed with H5Fclose.vi or resource leaks will occur.

Inputs

Outputs

[go to top]

H5Gclose.vi

This VI closes  the group specified by group_id.

Inputs

Outputs

[go to top]


Application Functions

These functions allow you to rapidly get started with the HDF5 waveform format.

sfpFile Query for Number of Traces.vi

This VI is used to determine the number of traces in an HDF5 file.  It returns identifiers so that the traces can be easily accessed.  If there are no traces in the file, it returns empty arrays.

Inputs

Outputs

[go to top]

sfpFile Read Simple Single Trace.vi

This VI is used to read the commonly used data from a trace.

Inputs

Outputs

[go to top]

sfpFile Write Simple Waveform File.vi

This VI is used to write commonly used data into a waveform file.  It does not support all the fields that a waveform file is capable of.  It is easily modified to do so, however.

Inputs

Outputs

[go to top]


Waveform Group

The waveform group is the highest level structure in a waveform file.  It may contain one or many waveforms and any measurements associated with them.

sfpFile Create Waveform Group.vi

This VI creates a new waveform group in an HDF5 file.

Inputs

Outputs

[go to top]

sfpFile Open Waveform.vi

This VI opens a waveform group.  Use sfpFile Query for Wfm_Groups.vi to determine how many waveform groups are in a file and some identifying information about them.

Inputs

Outputs

[go to top]

sfpFile Query for Wfm_Groups.vi

This VI finds all consecutively numbered waveform groups in  the file specified by file_id.

Inputs

Outputs

[go to top]


ID

The ID block contains identification data for the data in the waveform group.

sfpFile Read Wfm ID.vi

This VI reads all the information from the ID block of the waveform group specified by wfm_group_id.

Inputs

Outputs

[go to top]

sfpFile Write Wfm ID.vi

This VI writes all the information to the ID block of the waveform group specified by wfm_group_id.  This function will fail if used with a waveform group with an existing ID block.  Empty strings are not written.  The timestamp is always written and defaults to midnight, January 1, 1904.

Inputs

Outputs

[go to top]


Axes

The axes group contains the axis information for all the traces in the waveform group.  Axes can be shared between traces.  For example, two traces taken from a single digitizer will usually share an X-axis..

sfpFile Read DBL Wfm Axis.vi

This VI reads the axis information from a single axis.  The DBL refers to the format of the information, not the data associated with the axis.

Inputs

Outputs

[go to top]

sfpFile Write DBL Wfm Axis.vi

This VI writes the axis information for a single axis.  The DBL refers to the format of the information, not the data associated with the axis.  Empty strings and NaN DBLs are not written to the file.

Inputs

Outputs

[go to top]


Traces

The traces block contains the top level information for each trace in the waveform group.  It contains references to the axes and vectors groups, linking these groups together.

sfpFile Get Wfm Measurement Info.vi

This retrieves information about particular waveform measurements.  To add a measurement to the list, add your measurement to the end of the measurement enum input.  Go to the block diagram and duplicate the "Voltage RMS" case.  Rename it to your measurement.  Change the text constant and the level use variables.  Save the VI.  Copy the front panel measurement control and replace the control of the same name on sfpFile Read DBL Wfm Measurement.vi and sfpFile Write DBL Wfm Measurement.vi.

Inputs

Outputs

[go to top]

sfpFile Open Trace.vi

This VI opens a trace and returns the HDF5 group ID for it.  This is normally used to access the measurement data within a trace.  The trace must be closed with H5Gclose.vi or resource leaks will occur.

Inputs

Outputs

[go to top]

sfpFile Query for Vector Datatype.vi

This VI queries the trace to determine the datatype of the data in it.  This is used to select the correct reading VI.  For an example of use, see sfpFileEX Query-Read Single Trace.vi

Inputs

Outputs

[go to top]

sfpFile Query for Wfm Measurements.vi

This VI queries the trace to determine what measurements are available.  The result is used to create an input for sfpFile Read DBL Wfm Measurement.vi.

Inputs

Outputs

[go to top]

sfpFile Read DBL Wfm Measurement.vi

This VI reads information from a single DBL format scalar measurement associated with a trace.

Inputs

Outputs

[go to top]

sfpFile Read Wfm Trace.vi

This VI reads information in a single waveform trace.  A waveform group may contain an arbitrary number of traces.

Inputs

Outputs

[go to top]

sfpFile Write DBL Wfm Measurement.vi

This VI writes a single DBL format scalar measurement to a trace.  An arbitrary number of measurements can be stored with a single trace.

Inputs

Outputs

[go to top]

sfpFile Write Wfm Trace.vi

This VI writes all the information in a single waveform trace.  You may add as many traces as you wish to a single waveform group.  Make sure you properly add axes and vectors for any trace added with this function.  See sfpFile Write Simple Waveform File.vi for an example.

Inputs

Outputs

[go to top]


Vectors

The vectors block contains the raw data for the traces.

H5D Open-Read.vi

This VI is a lower level version of sfpFile Read Wfm Vector.vi which only reads the data in the vector.  It allows lower overhead for streaming data from disk.  See sfpFileEX Browse I8 Trace.vi for an example of use.

Inputs

Outputs

[go to top]

sfpFile Extend Vector.vi

This VI adds new data to the end of an existing vector.  It is useful for streaming data to disk.  It is also used to close datasets, when called with close? equal TRUE and an empty input dataset.

Inputs

Outputs

[go to top]

sfpFile Get NPoints in Vector.vi

This VI returns the number of points in a vector.

Inputs

Outputs

[go to top]

sfpFile Open Wfm Vector.vi

This VI opens a vector group, and, optionally, the dataset associated with it.

Inputs

Outputs

[go to top]

sfpFile Read Wfm Vector.vi

This VI reads data and attributes from a single vector.  By default, the VI reads all the data.  Using the 2U32 start, 2U32 count, 2U32 stride, and 2U32 block inputs, you can select a subset of the data to read.  The four variable method allows easy partial extraction and decimation.

Inputs

Outputs

[go to top]

sfpFile Write Wfm Vector.vi

This VI creates a vector group and populates it.

Inputs

Outputs

[go to top]


Utility

These VIs are general purpose utilities.

H5close.vi

Flush all buffers and close the HDF5 system.  This VI is very useful during development when you have forgotten to close a resource or two.  Run it standalone to clear all HDF5 related errors and problems.  The HDF5 system is automatically opened at the first call to and HDF5 utility.

Inputs

Outputs

[go to top]

H5Fflush.vi

Flush the HDF5 buffers.

Inputs

Outputs

[go to top]

H5get_libversion.vi

Get the current version of the HDF5 DLL being used.

Inputs

Outputs

[go to top]


Data Conversion

The following VIs are used to aid in data conversion from LabVIEW to HDF5.  The DU64 VIs address the 32-bit to 64-bit LabVIEW to HDF5 problem.  The I128 VIs give support for the 128-bit timestamp.

DU64 2U32 to DBL.vi

Convert a 2U32 number to a DBL.  Some resolution is lost in this process, since the DBL only has 53 bits of resolution and the 2U32 has 64.

Inputs

Outputs

[go to top]

DU64 DBL to 2U32.vi

Convert a DBL number to a 2U32.  The DBL is truncated in the process.

Inputs

Outputs

[go to top]

I128 Convert DBL to I128.vi

Convert a DBL number to a fixed point I128.  Be aware that the fixed point number has a maximum value of about 1.8 × 1019 and a resolution of about 5.4 × 10-20.  Numbers which are too large will generate a maximum value.  Numbers which are too small will generate a zero.

Inputs

Outputs

[go to top]

I128 Convert I128 to DBL.vi

Convert an I128 fixed point number to a DBL.  Some resolution is lost, since the I128 has 128 bits of resolution and the DBL has 53.

Inputs

Outputs

[go to top]


HDF5 Copyright Notice

Copyright Notice and Statement for
NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities

NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities
Copyright 1998, 1999, 2000, 2001 by the Board of Trustees of the University of Illinois
All rights reserved.

Contributors: National Center for Supercomputing Applications (NCSA) at the University of Illinois at Urbana-Champaign (UIUC), Lawrence Livermore National Laboratory (LLNL), Sandia National Laboratories (SNL), Los Alamos National Laboratory (LANL), Jean-loup Gailly and Mark Adler (gzip library).

Redistribution and use in source and binary forms, with or without modification, are permitted for any purpose (including commercial purposes) provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or materials provided with the distribution.
  3. In addition, redistributions of modified forms of the source or binary code must carry prominent notices stating that the original code was changed and the date of the change.
  4. All publications or advertising materials mentioning features or use of this software are asked, but not required, to acknowledge that it was developed by the National Center for Supercomputing Applications at the University of Illinois at Urbana-Champaign and to credit the contributors.
  5. Neither the name of the University nor the names of the Contributors may be used to endorse or promote products derived from this software without specific prior written permission from the University or the Contributors.
  6. THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND THE CONTRIBUTORS "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no event shall the University or the Contributors be liable for any damages suffered by the users arising out of the use of this software, even if advised of the possibility of such damage.

Portions of HDF5 were developed with support from the University of California, Lawrence Livermore National Laboratory (UC LLNL). The following statement applies to those portions of the product and must be retained in any redistribution of source code, binaries, documentation, and/or accompanying materials: This work was partially produced at the University of California, Lawrence Livermore National Laboratory (UC LLNL) under contract no. W-7405-ENG-48 (Contract 48) between the U.S. Department of Energy (DOE) and The Regents of the University of California (University) for the operation of UC LLNL.

DISCLAIMER: This work was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the University of California nor any of their employees, makes any warranty, express or implied, or assumes any liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately- owned rights. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes.

Last modified: 9 February 2001
Describes HDF5 Release 1.4.2, July 2001

[go to top]