Bytestohdf

Name

bytestohdf - convert byte stream to HDF SDS format

Synopsis


bytestohdf [-llabel] [-uunits] [-fformat] [-ccoordsys] 
	  [-shdrbytes] [-oofile] nx ny nz 

Description

bytestohdf reads a stream of bytes from the standard input, and saves the bytes as an HDF Scientific Dataset representing a single 3D grid. The X, Y, and Z dimensions of the grid are given by nx, ny, and nz.

The following options exist:

-llabel
Attach the given string to the data as a label. For example, "density" might be a typical label string.
-uunits
Attach the given string to specify the units of the data. For example, "kg/m^3" might be a typical units string.
-fformat
Attach the given string to specify the Fortran format to be used in printing the data. For example, "i3" might be a typical format string.
-ccoordsys
Attach the given string to specify the coordinate system in which the data is defined. For example, "cartesian" might be a typical coordinate system string.
-shdrbytes
Skip hdrbytes bytes at the beginning of the input data stream.
-oofile
Specify an ascii string giving the filename of the output file. If not specified, the file produced is named bytes.hdf.

Note that in HDF Datasets, the Z index varies fastest. This means that successive planes of data (defined by adjacent blocks in the input file) represent slices in planes of constant X. The X dimension is thus the number of slices present, rather than the (perhaps more intuitive) Z dimension.

Note that this program expects data in C language array order, that is, with the last array dimension varying fastest. If the input datastream was written from a Fortran language array, in which the first index varies fastest, the translation process will change the coordinate system of the data from right handed to left handed (or vice versa).

Examples

bytestohdf -ooutfile xdim ydim zdim < infile
will read xdim*ydim*zdim bytes from the filename specified as infile and output an HDF file of the given name outfile containing the data.

A dataset consisting of 100 planes of data, each plane being 200 by 300 voxels, would be arranged in the input file as a series of 100 blocks of data, each block representing a plane. Each block in turn would consist of 200 rows of data, each 300 data elements long. The appropriate bytestohdf command to convert such a dataset to HDF format would be:

bytestohdf -ooutfile.hdf 100 200 300 < infile.raw

J. Welling
Last modified: Thu Jul 11 15:31:37 EDT