Databases Reference
In-Depth Information
Storage: 400 logical bytes, 0 allocated bytes
Type: native float
It may seem like a small distinction, but when talking to third-party code this can be
the difference between a working program and an error message.
Finally, there's another convenience method called modify , which as the name suggests
preserves the type of the attribute:
>>> dset . attrs . modify ( 'two_byte_int' , 33 )
>>> dset . attrs [ 'two_byte_int' ]
33
Keep in mind this may have unexpected consequences when the type of the attribute
can't hold the value you provide. In this case, the value will clip:
>>> dset . attrs . modify ( 'two_byte_int' , 40000 )
>>> dset . attrs [ 'two_byte_int' ]
32767
Real-World Example: Accelerator Particle Database
Here's an example of how the groups, datasets, and attributes in HDF5 can be combined
to solve a real-world data management problem. Recently, the University of Colorado
installed a new electrostatic dust accelerator facility under a grant from NASA. This
device fires charged micrometer-sized dust grains into a target chamber at speeds rang‐
ing from 1-100 km/s, to simulate the impact of dust grains on surfaces and hardware
in space.
Application Format on Top of HDF5
The machine generates huge quantities of data. Every particle, and there can be up to
10 per second for hours on end, generates three digitized waveforms 100,000 points
long. A computer system analyzes these waveforms to figure out what the mass of the
particle is and how fast it's going. The resulting waveforms and speed/mass estimates
are recorded in an HDF5 file for use by the project scientists.
So the basic unit is a particle “event,” which has three floating-point waveforms, each of
which has some other properties like sampling rate, digitizer range, etc. Then for each
event we have metadata estimating particle mass and speed, as well as some top-level
metadata like a file timestamp.
Let's use h5ls to peek inside one of these files:
Opened "November_Run3.hdf5" with sec2 driver.
/ Group
Attribute: timestamp scalar
Type: native long long
Data: 1352843341201
Search WWH ::




Custom Search