summaryrefslogtreecommitdiffstats
path: root/doc/html/Tutor/answers.html
blob: 986b2f571b81a0085eab71d85456fd313163c320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<HTML><HEAD>
<TITLE>HDF5 Tutorial - Introductory Topics Quiz with Answers  
</TITLE> 
</HEAD>

<body bgcolor="#ffffff">

<!-- BEGIN MAIN BODY -->

<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 
src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif"
width=78 height=27 alt="NCSA"><P></A>

 [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ]
<H1>
<BIG><BIG><BIG><FONT COLOR="#c101cd">Introductory Topics Quiz 
    with Answers</FONT>
</BIG></BIG></BIG></H1>

<hr noshade size=1>


<h3>Section 2: HDF File Organization</h3>
<ol>

<li>Name and describe the two primary objects that can be stored in an HDF5
   file.

   <dl>
   <dt><b>Answers:</b> 
   <dd><em>Group:</em> A grouping structure containing zero or more 
       HDF5 objects, together with supporting metadata.
   <dd><em>Dataset:</em> A multidimensional array of data elements, 
       together with supporting metadata.
   </dl>

<p>
<li>What is an attribute?

   <dl>
   <dt><b>Answer:</b> 
   <dd>An HDF5 attribute is a user-defined HDF5 structure that provides extra
       information about an HDF5 object.
   </dl>

<p>
<li>Give the path name for an object called <code>harry</code> that is 
   a member of a group called <code>dick</code>, which, in turn, is a 
   member of the root group.

   <dl>
   <dt><b>Answer:</b>
   <dd><code>/dick/harry</code>
   </dl>


</ol>
<h3>Section 3: The HDF5 API</h3>
<ol>

<li>Describe the purpose of each of the following HDF5 APIs:

    <dir>
    H5A, H5D, H5E, H5F, H5G, H5T, H5Z
    </dir>

   <dl>
   <dt><b>Answers:</b>
   <dir>   
    H5A: Attribute access and manipulation routines     <br>
    H5D: Dataset access and manipulation routines       <br>
    H5E: Error handling routines                        <br>
    H5F: File access routines                           <br>
    H5G: Routines for creating and operating on groups  <br>
    H5T: Routines for creating and manipulating the 
         datatypes of dataset elements                  <br>
    H5Z: Data compression routines
   </dir>
   </dl>


</ol>
<h3>Section 4: Creating an HDF5 File</h3>
<ol>

<li>What two HDF5 routines must be called to create an HDF5 file?

   <dl>
   <dt><b>Answer:</b>
   <dd><code>H5Fcreate</code> and <code>H5Fclose</code>.
   </dl>

<p>
<li>What include file must be included in any file that uses the HDF5 library?

   <dl>
   <dt><b>Answer:</b>
   <dd><code>hdf5.h</code> must be included because it contains definitions 
       and declarations used by the library.
   </dl>

<p>
<li>An HDF5 file is never completely empty because as soon as it is created, 
   it automatically contains a certain primary object.  What is that object?

   <dl>
   <dt><b>Answer:</b>
   <dd>The root group.
   </dl>


</ol>
<h3>Section 5: Creating a Dataset</h3>
<ol>

<li>Name and describe two major datatype categories.

   <dl>
   <dt><b>Answers:</b>
   <dd><em>Atomic datatype:</em> 
       An atomic datatype cannot be decomposed into smaller units at the 
       API level.
       <br>
       <em>Compound datatype:</em> 
       A compound datatype is a collection of atomic and compound datatypes, 
       or small arrays of such types.
   </dl>

<p>
<li>List the HDF5 atomic datatypes. Give an example of a predefined datatype.

   <dl>
   <dt><b>Answers:</b>
   <dd>There are six HDF5 atomic datatypes: integer, floating point,
        date and time, character string, bit field, and opaque.
        Examples of predefined datatypes include the following:
        <dir>
            <code>H5T_IEEE_F32LE</code> 
                - 4-byte little-endian, IEEE floating point   <br>
            <code>H5T_NATIVE_INT</code> 
                - native integer  
        </dir>
   </dl>

<p>
<li>What does the dataspace describe? What are the major characteristics of 
   the simple dataspace? 

   <dl>
   <dt><b>Answers:</b>
   <dd>The dataspace describes the dimensionality of the dataset. 
        A simple dataspace is characterized by its rank and dimension sizes.  
   </dl>
       
<p>
<li>What information needs to be passed to the H5Dcreate function, i.e.,
   what information is needed to describe a dataset at creation time?

   <dl>
   <dt><b>Answer:</b>
   <dd>The dataset location, name, dataspace, datatype, and dataset 
       creation property list.
   </dl>


</ol>
<h3>Section 6: Reading from and Writing to a Dataset</h3>
<ol>

<li>What are six pieces of information which need to be specified for
   reading and writing a dataset?

   <dl>
   <dt><b>Answer:</b>
   <dd>The dataset identifier, the dataset's datatype and dataspace in 
       memory, the dataspace in the file, the dataset transfer property
       list, and a data buffer.
   </dl>

<p>
<li>Why are both the memory dataspace and file dataspace needed for 
   read/write operations, while only the memory datatype is required?

   <dl>
   <dt><b>Answer:</b>
   <dd>A dataset's file datatype is not required for a read/write operation
       because the file datatype is specified when the dataset is created 
       and cannot be changed. Both file and memory dataspaces are required 
       for dataset subsetting and for performing partial I/O operations.  
   </dl>

<p>
<li>What does the line 
    <br>&nbsp;&nbsp;&nbsp;
    <code>DATASPACE { SIMPLE (4 , 6 ) / ( 4 , 6 ) } </code> 
    <br>in Figure 6.1 mean?

   <dl>
   <dt><b>Answer:</b>
   <dd>It means that the dataset <code>dset</code> has a simple dataspace 
      with the current dimensions (4,6) and the maximum size of the 
      dimensions (4,6).
   </dl>


</ol>
<h3>Section 7: Creating an Attribute</h3>
<ol>

<li>What is an attribute?

   <dl>
   <dt><b>Answer:</b>
   <dd>An attribute is a dataset attached to an object. It describes the 
       nature and/or the intended usage of the object.
   </dl>

<p>
<li>Can partial I/O operations be performed on attributes?

   <dl>
   <dt><b>Answer:</b>
   <dd>No.
   </dl>


</ol>
<h3>Section 8: Creating a Group</h3>
<ol>

<li>What are the two primary objects that can be included in a group?

   <dl>
   <dt><b>Answer:</b>
   <dd>A group and a dataset.
   </dl>


</ol>
<h3>Section 9: Creating Groups Using Absolute and Relative Names</h3>
<ol>

<li>Group names can be specified in two ways.  What are these two types 
   of group names?

   <dl>
   <dt><b>Answer:</b>
   <dd>Relative and absolute.
   </dl>

<p>
<li>You have a dataset named <code>moo</code> in the group 
   <code>boo</code>, which is in the group <code>foo</code>, 
   which, in turn, is in the root group.  
   How would you specify an absolute name to access this dataset?

   <dl>
   <dt><b>Answer:</b>
   <dd><code>/foo/boo/moo</code>
   </dl>


</ol>
<h3>Section 10: Creating Datasets in Groups</h3>
<ol>

<li>Describe a way to access the dataset <code>moo</code> described in 
   the previous section (Section&nbsp;9, question&nbsp;2) using a 
   relative name.
   Describe a way to access the same dataset using an absolute name.

   <dl>
   <dt><b>Answers:</b>
       <ol>
        <li>Access the group <code>/foo</code> and get the group ID.
            Access the group <code>boo</code> using the group ID obtained 
            in Step&nbsp;1.
            Access the dataset <code>moo</code> using the group ID obtained 
            in Step&nbsp;2.
            <pre>
gid = H5Gopen (file_id, "/foo", 0);       /* absolute path */
gid1 = H5Gopen (gid, "boo", 0);           /* relative path */
did = H5Dopen (gid1, "moo");              /* relative path */  </pre>
  
        <li>Access the group <code>/foo</code> and get the group ID.
            Access the dataset <code>boo/moo</code> with the group ID 
            just obtained.
            <pre>
gid = H5Gopen (file_id, "/foo", 0);       /* absolute path */
did = H5Dopen (gid, "boo/moo");           /* relative path */  </pre>
             
        <li>Access the dataset with an absolute path.
            <pre>
did = H5Dopen (file_id, "/foo/boo/moo");  /* absolute path */  </pre>
       </ol>
   </dl>

</ol>

<!-- BEGIN FOOTER INFO -->

<P><hr noshade size=1>
<font face="arial,helvetica" size="-1">
  <a href="http://www.ncsa.uiuc.edu/"><img border=0
     src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif"
     width=78 height=27 alt="NCSA"><br>
  The National Center for Supercomputing Applications</A><br>
  <a href="http://www.uiuc.edu/">University of Illinois
    at Urbana-Champaign</a><br>
  <br>
<!-- <A HREF="helpdesk.mail.html"> -->
<A HREF="mailto:hdfhelp@ncsa.uiuc.edu">
hdfhelp@ncsa.uiuc.edu</A>
<br>
Describes HDF5 Release 1.2.2, June 2000
<BR> <H6>Last Modified: January 13, 2000</H6><BR>
<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu -->
</FONT>
<BR>
<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> -->

</BODY>
</HTML>