The H5_PARSE function recursively descends through an HDF5 file or group and creates an IDL structure containing object information and data.
| Note |
Result = H5_PARSE (File [, /READ_DATA])
or
Result = H5_PARSE (Loc_id, Name [, FILE=string] [, PATH=string] [, /READ_DATA])
The Result is an IDL structure containing the parsed file or group. The fields within each structure in Result depend upon the object type.
|
Field
|
Description
|
|---|---|
|
_NAME
|
Object name, or the filename if at the top level
|
|
_ICONTYPE
|
Name of associated icon, used by H5_BROWSER
|
|
_TYPE
|
Object type, such as GROUP, DATASET, DATATYPE, ATTRIBUTE, or LINK
|
|
Field
|
Description
|
|---|---|
|
_FILE
|
The filename to which the object belongs
|
|
_PATH
|
Full path to the group, dataset, or datatype within the file
|
Groups, datasets, datatypes, and attributes will be stored as substructures within Result. The tag names for these substructures are constructed from the actual object name by converting all non-alphanumeric characters to underscores, and converting all characters to uppercase. If a tag name already exists (for example a datatype and an attribute have the same name) then an appropriate suffix is appended on to the end of the tag name, such as "_ATTR" for attribute, and so on.
A string giving the name of the file to parse.
An integer giving the file or group identifier to access.
A string giving the name of the group, dataset, or datatype within Loc_id to parse.
Set this optional keyword to a string giving the filename associated with the Loc_id. This keyword is used for filling in the _FILE field within the returned structure, and is not required. The FILE keyword is ignored if the File argument is provided.
Set this optional keyword to a string giving the full path associated with the Loc_id. This keyword is used for filling in the _PATH field within the returned structure, and is not required. The PATH keyword is ignored if the File argument is provided.
If this keyword is set, then all data from datasets is read in and stored in the returned structure. If READ_DATA is not provided then the _DATA field for datasets will be set to the string '<unread>'.
| Note |
The following example shows how to parse a file, and then prints out the parsed structure.
File = FILEPATH('hdf5_test.h5', SUBDIR=['examples','data'])
Result = H5_PARSE(File)
help, Result, /STRUCTURE
When the above commands are entered, IDL prints:
** Structure <5f24468>, 13 tags, length=6872, data length=6664, refs=1: _NAME STRING 'D:\RSI\idl56\examples\data\hdf5_test.h5' _ICONTYPE STRING 'hdf' _TYPE STRING 'GROUP' _FILE STRING 'D:\RSI\idl56\examples\data\hdf5_test.h5' _PATH STRING '/' _COMMENT STRING '' _2D_INT_ARRAY STRUCT -> <Anonymous> Array[1] A_NOTE STRUCT -> <Anonymous> Array[1] SL_TO_3D_INT_ARRAY STRUCT -> <Anonymous> Array[1] ARRAYS STRUCT -> <Anonymous> Array[1] DATATYPES STRUCT -> <Anonymous> Array[1] IMAGES STRUCT -> <Anonymous> Array[1] LINKS STRUCT -> <Anonymous> Array[1]
Now print out the structure of a dataset within the "Images" group:
help, Result.images.eskimo, /STRUCTURE
IDL prints:
** Structure <16f1ca0>, 20 tags, length=840, data length=802,
refs=2:
_NAME STRING 'Eskimo'
_ICONTYPE STRING 'binary'
_TYPE STRING 'DATASET'
_FILE STRING
'D:\RSI\debug\examples\data\hdf5_test.h5'
_PATH STRING '/images'
_DATA STRING '<unread>'
_NDIMENSIONS LONG 2
_DIMENSIONS ULONG64 Array[2]
_NELEMENTS ULONG64 389400
_DATATYPE STRING 'H5T_INTEGER'
_STORAGESIZE ULONG 1
_PRECISION LONG 8
_SIGN STRING 'unsigned'
CLASS STRUCT -> <Anonymous> Array[1]
IMAGE_VERSION STRUCT -> <Anonymous> Array[1]
IMAGE_SUBCLASS STRUCT -> <Anonymous> Array[1]
IMAGE_COLORMODEL
STRUCT -> <Anonymous> Array[1]
IMAGE_MINMAXRANGE
STRUCT -> <Anonymous> Array[1]
IMAGE_TRANSPARENCY
STRUCT -> <Anonymous> Array[1]
PALETTE STRUCT -> <Anonymous> Array[1]
Introduced 5.6