2.7.37 impHDF5

Menu Information

Data: Import from File: HDF5 (H5, HE5, HDF5)


If you do not see this file type, choose Data: Import from File: Add/Remove File Types...

File Import Add Menu.png

To add drag & drop support for a file type, see Import Filter Manager.

This X-Function supports file re-import. See this topic for details.

Brief Information

Import HDF5 file up to version 1.8.2

Additional Information

Minimum Origin Version Required: 8.1 SR0, updated in 2016 SR0

Command Line Usage

1. impHDF5 fname:=C:\hdf5_test.h5;

2. impHDF5 fname:=C:\hdf5_test.h5 options.bStructureOnly:=1;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
File Name fname

Input

string

fname$
Filename(s) of the file(s) to be imported. Click the browse button near the list box to open one or more files. Filenames will be listed in the box.
Import as Folder Structure impMode

Input

int

1
As of Origin 8.6, this variable is no longer used.
File Info and Data Selection trfiles

Input

TreeNode

<unassigned>
This is used to select the desired data channels. See more details in Description section.
Import Options options

Input

TreeNode

<unassigned>
When importing an HDF5 file, you can import just the file structure, import into Hierarchical Structure or you can save the file information in a workbook to allow for re-importing. If you select the Import Structure Only and Save File Info. in Workbook check boxes, the reimport X-Function can be used to re-import part of the desired data after importing the file structure.

Options:

  • bStructureOnly:Import Structure Only
    If checked, only the structure of the file will be imported.
  • bHierarchical:Import into Hierarchical Structure
    When you select this, only the variable list is imported into a worksheet, and the individual variable names are displayed as linked text in the 1st column. Clicking on variable names will import the desired variables one-by-one in the new worksheets.
Note: Only supports import to workbooks/worksheets.
  • bSaveFileInfo:Save File Info. in Workbook
    If not selected, the file information will not be saved in Organizer and the reimport will not work, but the import speed can be improved.
Output orng

Output

Range

<active>
Specify the range for the imported data.

See the syntax of Output Notations.

Header Info trheader

Output

TreeNode

<unassigned>
For outputting header information. This is hidden from the GUI. Use of this variable is not advised.
Repeat Import reimp

Input

int

0
This is used for repeat import. Use of this variable is not advised.

Description

The Hierarchical Data Format (HDF) is a set of file formats and libraries designed for storing and organizing large amounts of numerical data. HDF4 is the older version of this format, and HDF5 is designed to address some of the limitations of the HDF4 library. HDF5 simplifies the file structures of datasets and groups. Datasets are multidimensinal arrays of a homogenous type and groups are container structures which can hold datasets and other groups.

This X-Function is used for importing HDF5 data files whose version is lower than 1.8.2. This X-Function supports multi-file import. When an HDF5 file is imported, the workbook is used to store data such as notes, one-dimensional datasets, arrays of structures, and vector data with mixed types.

Two- or more-dimensional datasets and image data are stored in a matrix book. In a matrix book, the channel number of each matrix sheet is decided by the dataset. This allows the import of the HDF5 file's structure, as well as the separate re-import of desired data using the reimport X-Function.

Details on Some Dialog Options

  • File Info And Data Selection (trfiles)
This variable is a treenode. It shows file information and allows you to choose the channels to import. The name of each sub-treenode is the name of the corresponding file. Under each sub-treenode, the file size and any available data are listed.

Examples

Example 1

The following example shows how to import the structure of an HDF5 data file (c:\hdf5_test.h5), and then use the reimport sel:=1; to import the desired data into a workbook.

  1. Create a new project. Select Data: Import from File: HDF5 (H5, HE5, HDF5)... from the Origin menu. This opens the HDF5 file browser.
  2. Select C:\hdf5_test.h5' and then click the Add File(s) button. Make sure that the Show Options Dialog check-box is selected.
  3. Click the OK button to close the file browser. The impHDF5 dialog should now open.
  4. In the File Info And Data Selection: hdf5_test: Data Selection branch, select all the check boxes.
  5. In the Import Options branch, check the Import Structure Only check box and keep the Save File Info. in Workbook check box selected.
  6. Change Output to <new>.
    ImpHDF5 1.png
  7. Click the OK button to import only the structure of this HDF5 file.
  8. To import a selected data range, activate the corresponding empty worksheet, and then run:
    reimport sel:=1;

Example 2

This example will show you how to import a HDF5 file(C:\hdf5dada.h5) with structure data into hierarchical structure.

  1. Create a new workbook and activate it. From the Origin main menu, select Data: Import from File: HDF5 (H5, HE5, HDF5).... This opens the HDF5 file browser.
  2. Select C:\hdf5dada.h5 and then click the Add File(s) button. Make sure that the Show Options Dialog check-box is selected.
  3. Click the OK button to close the file browser. The impHDF5 dialog should now open.
  4. Check the Import into Hierarchical Structure box under the Import Options branch. Note that the Import Structure Only and Save File Info. in Workbook checkboxes are now grayed out.
    ImpHDF5 2.png
  5. Click the OK button. The file will be imported. Next, click on the variable names to further import just the desired variables one-by-one, into new worksheets.
    ImpHDF5 3.png

Related X-Functions

cd, impinfo, findFiles, impFile