The S-Lang HDF5 Module Page
SLh5 is a S-Lang module for the HDF5 file format and software library. HDF5 is widely used in large scale science and engineering projects -- such as the FLASH simulator of thermonuclear explosions in stars -- because it combines data and compiler portability with very high performance, scalability to terabyte-size datasets, and support for parallel I/O. The S-Lang interpreter is part of the widely-used, open-source library of the same name, and provides a scripting environment well-suited for scientific and engineering tasks, due to the powerful, compact, fast, and robust multidimensional numerical capabilities that are native to the language.
SLh5 provides a high-level interface to HDF5, supporting the easy creation of S-Lang arrays from HDF5 files or vice versa. The entire HDF5 api is presented in terms of 6 simple functions:
h5_new - create one or more new HDF5 files h5_open - open one or more existing HDF5 files h5_close - close one or more HDF5 files h5_read - read one or more datasets or attributes h5_write - write a dataset or attribute h5_list - browse an HDF5 container (analogous to h5dump utility)although users will typically need only the latter two or three. Much of the low-level HDF5 library may also be called directly from S-Lang, though there should be little need for user-level scripts to do so. There is also no need to explicitly close files, or opened datasets, attributes, groups, etc, as SLh5 will automatically do so when the variable referencing them goes out of scope. Moreover, and with the exception of h5_write, the entire top-level SLh5 interface has been vectorized by the SLIRP code generator; this allows multiple files to be opened or created, or multiple datasets or attributes to be read, in a single call.
With SLh5 users may thus interact with HDF5 files in a scriptable analysis enviroment, e.g. ISIS, with substantially smaller and cleaner code than is possible in other analysis platforms, e.g. IDL (tm), and with potentially considerable I/O performance advantages. For example, as described in this presentation we've used SLh5 internally to read the adaptive mesh refinement output of hydrodynamics simulations generated by FLASH. Our AMR reader is markedly shorter and faster than the IDL (tm) FLASH reader, and facilitates the use of hydro simulations as source models for multi-dimensional modeling experiments in ISIS.
This page was last updated Aug 19, 2009 by Michael S. Noble. To comment on it or the material presented here, send email to email@example.com.