Create a new HDF5 file
file_id = h5_new(name, [,access_flags])
This function attempts to create & open the named file and return a corresponding handle/file id. The access flags may be either H5F_ACC_EXCL or H5F_ACC_TRUNC: the first causes an error to be thrown if the file already exists, while the second causes any existing file of the same name to be erased first (the default).
This function is vectorized on its first parameter: if an array of file names is passed then an array of file identifiers will be returned.
Unlike with the HDF5 C library, files do not need to be explicitly closed with SLh5; instead, they will be closed automatically when the returned handle goes out of scope.
h5_open, h5_close, h5_read
Open an HDF5 file, and optionally group, dataset, or attribute
hid_t = h5_open(name, [,access_flags])
This function attempts to open the HDF5 file specified by name and return a corresponding handle/file id. The access flags may be either H5F_ACC_RDWR (read/write) or H5F_ACC_RDONLY (read-only, and the default if omitted).
The name parameter may optionally contain a path to an object with the file being opened. For example, d = h5_open("test.h5:/G/D") opens the file test.h5, the group G, and the dataset D, assigning an identifier for the latter to the variable d.
This function is vectorized on its first parameter: if an array of file names is passed then an array of file identifiers will be returned.
Unlike with the HDF5 C library, files do not need to be explicitly closed with SLh5; instead, they will be closed automatically when the returned handle goes out of scope.
h5_read, h5_close
Close an HDF5 file
h5_close(file_id)
This function will close the HDF5 file associated with the specified file id.
This function is vectorized: if an array of file ids is passed then the file associated with each element will be closed.
Unlike with the HDF5 C library, files do not need to be explicitly closed with SLh5; instead, they will be closed automatically when the returned handle goes out of scope.
h5_open
Read an HDF5 dataset into a S-Lang array
array = h5_read(from [, dataset_or_attribute_name])
This function will read an HDF5 dataset or attribute into a S-Lang array of the appropriate type. The from parameter may be any string acceptable to h5_open() or any valid HDF5 identifier (such as might be returned by h5_open, H5Dopen, or other open calls). If no dataset or attribute name is supplied the routine will attempt to open the first dataset it can find within the root group hierarchy.
This function is vectorized on either its first or second parameter: if an array is passed for either then an array (e.g. of arrays) of commensurate size will be returned. A dataset/attribute name of "*" may be used as shorthand for "everything," in which case a vectored value will be returned, containing all datasets or attributes in the given container.
Partial I/O is not yet supported.
h5_write
Create an HDF5 file, dataset, or attribute from a S-Lang object
h5_write(to, data [,name [, kind ]])
This function attempts to create a new dataset or attribute in the HDF5 file specified by the to parameter, which may either a file name or an HDF5 identifier associated with an open file. Named files will be created if they don't already exist, or overwritten if they do. The data parameter is typically an array of values. If a name is not specified then if a dataset is created it will have the same name as the file, minus any extension. If kind is not specified a dataset object will be written, otherwise H5I_DATASET or H5I_ATTR may be specified to explicitly request that either a dataset or attribute be created.
Writing compound types is currently unsupported.
h5_new
List named members of an HDF5 file, group, or dataset
StringType[] = h5_list(from [,flags])
This function may be used to browse the contents of an HDF5 container, and is loosely analogous to the h5dump utility. The from parameter may either be a file name or an identifier associated with an opened HDF5 object. The flags option may be any OR-ed combination of H5_LIST_OBJECTS, H5_LIST_ATTRIBUTES, or H5_LIST_RECURSE; a value of H5_LIST_OBJECTS | H5_LIST_ATTRIBUTES will be assigned to flags when it is omitted.
Recursive listing has not been implemented yet; only one level of the container object hierarchy may be inspected at a time.
h5_open
Load FLASH HDF5 adaptive mesh refinement simulation
(tree, params, unknowns) = read_amr(file [, variable_name])
This function attempts to read FLASH simulation data, in the form of an adaptive mesh, from the given file. If variable_name is specified only a single simulation unknown is loaded, otherwise all unknowns will be loaded. Upon success three S-Lang structures are returned.
This is a S-Lang translation of read_amr.pro contained in the FLASH IDL(tm) package (FIDLR3). Consult the FLASH documentation for details.
SLh5, h5_open, h5_read