The file SDS.hdf created by the program can be inspected with a number of HDF utilities. For example you can do
gustav@blanc:../src 14:40:29 !552 $ hdfls SDS.hdf
SDS.hdf:
File library version: Major= 4, Minor=1, Release=2
String=NCSA HDF Version 4.1 Release 2, March 1998
Version Descriptor : (tag 30)
Ref nos: 1
Number type : (tag 106)
Ref nos: 5
SciData dimension record : (tag 701)
Ref nos: 5
Numeric Data Group : (tag 720)
Ref nos: 2
Vdata : (tag 1962)
Ref nos: 3
Vdata Storage : (tag 1963)
Ref nos: 3
Vgroup : (tag 1965)
Ref nos: 4 6 7
gustav@blanc:../src 14:40:36 !553 $
Program hdfls lists tags, reference numbers, and
lengths of various data elements in SDS.hdf. You can
see clearly that SDS.hdf is a structured file. It is,
in fact, a miniature, specialised data base for storing
scientific data. The HDF package provides utilities for
a non-sequential access to various records within that
data base. HDF files are completely portable across
computer architectures and operating systems. Integer and
floating point numbers are stored within HDF files
as binary streams of data, which shrinks the size of the
file very significantly and which speeds reading and writing
of such files. But that data is stored in an architecture
independent manner, while at the same time remaining fully
compliant with IEEE specifications. Furthermore HDF provides
its own facilities for data compression. So, not only
do you get full portability, annotations and structuring
of your data. The data can be automatically compressed
if so desired. And this compression is also architecture
and operating system independent.
You can zoom on a specific tag number and ask hdfls to list more information about that particular field:
gustav@blanc:../src 14:40:36 !553 $ hdfls -l -t 701 SDS.hdf
SDS.hdf:
File library version: Major= 4, Minor=1, Release=2
String=NCSA HDF Version 4.1 Release 2, March 1998
SciData dimension record : (tag 701)
Ref no 5 14 bytes
gustav@blanc:../src 14:43:13 !554 $
This time hdfls tells us that our program has written 14 bytes
of data into the scientific data dimension record.
We can have an even more detailed view at what's inside the file with the command hdfed:
gustav@blanc:../src 14:40:53 !608 $ hdfed SDS.hdf
hdfed> info -all
(1) Version Descriptor : (Tag 30) Ref 1
(2) Vdata Storage : (Tag 1963) Ref 3
(3) Vdata : (Tag 1962) Ref 3
(4) Vgroup : (Tag 1965) Ref 4
(5) Number type : (Tag 106) Ref 5
(6) SciData dimension record : (Tag 701) Ref 5
*(7) Numeric Data Group : (Tag 720) Ref 2
(8) Vgroup : (Tag 1965) Ref 6
(9) Vgroup : (Tag 1965) Ref 7
hdfed> info -long
(7) Numeric Data Group : (Tag 720)
Ref: 2, Offset: 2617, Length: 12 (bytes)
hdfed> prev tag=701
hdfed> info -long
(6) SciData dimension record : (Tag 701)
Ref: 5, Offset: 2603, Length: 14 (bytes)
hdfed> prev tag=30
hdfed> info -long
(1) Version Descriptor : (Tag 30)
Ref: 1, Offset: 2410, Length: 92 (bytes)
hdfed> dump -asci
0: NCSA HDF Version 4.1 Release
41: 2, March 1998
82:
hdfed> next tag=106
hdfed> info -long
(5) Number type : (Tag 106)
Ref: 5, Offset: 2599, Length: 4 (bytes)
hdfed> dump -byte
0: 1 24 32 1
The last command, dump -byte performed on the Number type
record shows something readable:
DFNT_INT32
DFNT_INT32 variable
DFNT_INT16 instead (treat it as an exercise), you'd get:
hdfed> dump -byte
0: 1 22 16 1
hdfed>
where
DFNT_INT16
DFNT_INT16 variable