summaryrefslogtreecommitdiffstats
path: root/develop/_l_b_dset_create.html
blob: 7f14ab280f54376cbb978d7db8f8accb31ee1370 (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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HDF5: Creating a Dataset</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="hdf5doxy.css" rel="stylesheet" type="text/css">
<!-- <link href="hdf5doxy.css" rel="stylesheet" type="text/css"/>
 -->
<script type="text/javascript" src="hdf5_navtree_hacks.js"></script>
</head>
<body>
<div style="background:#FFDDDD;font-size:120%;text-align:center;margin:0;padding:5px">Please, help us to better serve our user community by answering the following short survey:  <a href="https://www.hdfgroup.org/website-survey/">https://www.hdfgroup.org/website-survey/</a></div>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="HDFG-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="https://www.hdfgroup.org">HDF5</a>
   &#160;<span id="projectnumber">1.15.0.a067bf7</span>
   </div>
   <div id="projectbrief">API Reference</div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_l_b_dset_create.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">Creating a Dataset </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Navigate back: <a class="el" href="index.html">Main</a> / <a class="el" href="_getting_started.html">Getting Started with HDF5</a> / <a class="el" href="_learn_basics.html">Learning the Basics</a> </p><hr  />
<p>A dataset is a multidimensional array of data elements, together with supporting metadata. To create a dataset, the application program must specify the location at which to create the dataset, the dataset name, the datatype and dataspace of the data array, and the property lists.</p>
<h1><a class="anchor" id="secLBDsetCreateDtype"></a>
Datatypes</h1>
<p>A datatype is a collection of properties, all of which can be stored on disk, and which, when taken as a whole, provide complete information for data conversion to or from that datatype.</p>
<p>There are two categories of datatypes in HDF5: </p><ul>
<li>
<b>Pre-defined</b>: These datatypes are opened and closed by HDF5.<br  />
 Pre-defined datatypes can be atomic or composite: <ul>
<li>
Atomic datatypes cannot be decomposed into smaller datatype units at the API level. For example: integer, float, reference, string. </li>
<li>
Composite datatypes are aggregations of one or more datatypes. For example: array, variable length, enumeration, compound.</li>
</ul>
</li>
<li>
<b>Derived</b>: These datatypes are created or derived from the pre-defined types.<br  />
 A simple example of creating a derived datatype is using the string datatype, H5T_C_S1, to create strings of more than one character:<br  />
 <div class="fragment"><div class="line"><a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> strtype;                     <span class="comment">// Datatype ID</span></div>
<div class="line"><a class="code" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> status;</div>
<div class="line"> </div>
<div class="line">strtype = <a class="code" href="group___h5_t.html#gaec07efbab84f4e5b4ed22f010786be8e">H5Tcopy</a> (<a class="code" href="group___p_d_t_s.html#ga7f6b6959fefe56d2e871659110936d2d">H5T_C_S1</a>);</div>
<div class="line">status = <a class="code" href="group___h5_t.html#gae5f38bfd4a4c557496b3194b5180212c">H5Tset_size</a> (strtype, 5); <span class="comment">// create string of length 5</span></div>
<div class="ttc" id="a_h5_ipublic_8h_html_a0045db7ff9c22ad35db6ae91662e1943"><div class="ttname"><a href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a></div><div class="ttdeci">int64_t hid_t</div><div class="ttdef"><b>Definition:</b> H5Ipublic.h:60</div></div>
<div class="ttc" id="a_h5public_8h_html_a3b079ecf932a5c599499cf7e298af160"><div class="ttname"><a href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a></div><div class="ttdeci">int herr_t</div><div class="ttdef"><b>Definition:</b> H5public.h:235</div></div>
<div class="ttc" id="agroup___h5_t_html_gae5f38bfd4a4c557496b3194b5180212c"><div class="ttname"><a href="group___h5_t.html#gae5f38bfd4a4c557496b3194b5180212c">H5Tset_size</a></div><div class="ttdeci">herr_t H5Tset_size(hid_t type_id, size_t size)</div><div class="ttdoc">Sets size for a datatype.</div></div>
<div class="ttc" id="agroup___h5_t_html_gaec07efbab84f4e5b4ed22f010786be8e"><div class="ttname"><a href="group___h5_t.html#gaec07efbab84f4e5b4ed22f010786be8e">H5Tcopy</a></div><div class="ttdeci">hid_t H5Tcopy(hid_t type_id)</div><div class="ttdoc">Copies an existing datatype.</div></div>
<div class="ttc" id="agroup___p_d_t_s_html_ga7f6b6959fefe56d2e871659110936d2d"><div class="ttname"><a href="group___p_d_t_s.html#ga7f6b6959fefe56d2e871659110936d2d">H5T_C_S1</a></div><div class="ttdeci">#define H5T_C_S1</div><div class="ttdef"><b>Definition:</b> H5Tpublic.h:476</div></div>
</div><!-- fragment -->  </li>
</ul>
<p>Shown below is the HDF5 pre-defined datatypes. </p><div class="fragment"><div class="line">                                   +--  integer</div>
<div class="line">                                   +--  floating point</div>
<div class="line">                 +---- atomic  ----+--  date and time</div>
<div class="line">                 |                 +--  character <span class="keywordtype">string</span></div>
<div class="line">HDF5 datatypes --|                 +--  bitfield</div>
<div class="line">                 |                 +--  opaque</div>
<div class="line">                 |</div>
<div class="line">                 +---- compound</div>
</div><!-- fragment --><p>Some of the HDF5 predefined atomic datatypes are listed below.</p>
<table class="doxtable">
<caption>Examples of HDF5 predefined datatypes</caption>
<tr>
<th><b>Datatype</b> </th><th><b>Description</b>  </th></tr>
<tr>
<th><b>H5T_STD_I32LE</b> </th><td>Four-byte, little-endian, signed, two's complement integer  </td></tr>
<tr>
<th><b>H5T_STD_U16BE</b> </th><td>Two-byte, big-endian, unsigned integer  </td></tr>
<tr>
<th><b>H5T_IEEE_F32BE</b> </th><td>Four-byte, big-endian, IEEE floating point  </td></tr>
<tr>
<th><b>H5T_IEEE_F64LE</b> </th><td>Eight-byte, little-endian, IEEE floating point  </td></tr>
<tr>
<th><b>H5T_C_S1</b> </th><td>One-byte, null-terminated string of eight-bit characters  </td></tr>
</table>
<table class="doxtable">
<caption>Examples of HDF5 predefined native datatypes</caption>
<tr>
<th><b>Native Datatype</b> </th><th><b>Corresponding C or FORTRAN Type</b>  </th></tr>
<tr>
<th span="2"><b>C</b>  </th></tr>
<tr>
<th><b>H5T_NATIVE_INT</b> </th><td>int  </td></tr>
<tr>
<th><b>H5T_NATIVE_FLOAT</b> </th><td>float  </td></tr>
<tr>
<th><b>H5T_NATIVE_CHAR</b> </th><td>char  </td></tr>
<tr>
<th><b>H5T_NATIVE_DOUBLE</b> </th><td>double  </td></tr>
<tr>
<th><b>H5T_NATIVE_LDOUBLE</b> </th><td>long double  </td></tr>
<tr>
<th span="2"><b>Fortran</b>  </th></tr>
<tr>
<th><b>H5T_NATIVE_INTEGER</b> </th><td>integer  </td></tr>
<tr>
<th><b>H5T_NATIVE_REAL</b> </th><td>real  </td></tr>
<tr>
<th><b>H5T_NATIVE_DOUBLE</b> </th><td>double precision  </td></tr>
<tr>
<th><b>H5T_NATIVE_CHARACTER</b> </th><td>character  </td></tr>
</table>
<p>In this tutorial, we consider only HDF5 predefined integers.</p>
<p>For further information on datatypes, see <a class="el" href="_h5_t__u_g.html#sec_datatype">HDF5 Datatypes</a> in the <a class="el" href="_u_g.html">HDF5 User Guide</a>, in addition to the <a class="el" href="_l_b_datatypes.html">Datatype Basics</a> tutorial topic.</p>
<h1><a class="anchor" id="secLBDsetCreateDspace"></a>
Datasets and Dataspaces</h1>
<p>A dataspace describes the dimensionality of the data array. A dataspace is either a regular N-dimensional array of data points, called a simple dataspace, or a more general collection of data points organized in another manner, called a complex dataspace. In this tutorial, we only consider simple dataspaces.</p>
<p><em>HDF5 dataspaces</em> </p><div class="fragment"><div class="line">                  +-- simple</div>
<div class="line">HDF5 dataspaces --|</div>
<div class="line">                  +-- complex</div>
</div><!-- fragment --><p> The dimensions of a dataset can be fixed (unchanging), or they may be unlimited, which means that they are extensible. A dataspace can also describe a portion of a dataset, making it possible to do partial I/O operations on selections.</p>
<h1><a class="anchor" id="secLBDsetCreateProp"></a>
Property Lists</h1>
<p>Property lists are a mechanism for modifying the default behavior when creating or accessing objects. For more information on property lists see the <a class="el" href="_l_b_props_list.html">Property Lists Basics</a> tutorial topic.</p>
<p>The following property lists can be specified when creating a dataset: </p><ul>
<li>Dataset Creation Property List<br  />
 When creating a dataset, HDF5 allows the user to specify how raw data is organized and/or compressed on disk. This information is stored in a dataset creation property list and passed to the dataset interface. The raw data on disk can be stored contiguously (in the same linear way that it is organized in memory), partitioned into chunks, stored externally, etc. In this tutorial, we use the default dataset creation property list (contiguous storage layout and no compression). For more information about dataset creation property lists, see <a class="el" href="_h5_d__u_g.html#sec_dataset">HDF5 Datasets</a> in the <a class="el" href="_u_g.html">HDF5 User Guide</a>. </li>
<li>Link Creation Property List<br  />
 The link creation property list governs creation of the link(s) by which a new dataset is accessed and the creation of any intermediate groups that may be missing. </li>
<li>Dataset Access Property List<br  />
 Dataset access property lists are properties that can be specified when accessing a dataset.</li>
</ul>
<h1><a class="anchor" id="secLBDsetCreateSteps"></a>
Steps to Create a Dataset</h1>
<p>To create an empty dataset (no data written) the following steps need to be taken: </p><ol>
<li>
Obtain the location identifier where the dataset is to be created. </li>
<li>
Define or specify the dataset characteristics: <ol>
<li>
Define a datatype or specify a pre-defined datatype. </li>
<li>
Define a dataspace. </li>
<li>
Specify the property list(s) or use the default. </li>
</ol>
</li>
<li>
Create the dataset. </li>
<li>
Close the datatype, the dataspace, and the property list(s) if necessary. </li>
<li>
Close the dataset. </li>
</ol>
<p>In HDF5, datatypes and dataspaces are independent objects which are created separately from any dataset that they might be attached to. Because of this, the creation of a dataset requires the definition of the datatype and dataspace. In this tutorial, we use the HDF5 predefined datatypes (integer) and consider only simple dataspaces. Hence, only the creation of dataspace objects is needed.</p>
<h1><a class="anchor" id="secLBDsetCreateHL"></a>
High Level APIs</h1>
<p>The High Level <a class="el" href="group___h5_l_t.html">HDF5 Lite APIs (H5LT,H5LD)</a> include functions that simplify and condense the steps for creating datasets in HDF5. The examples in the following section use the standard APIs. For a quick start you may prefer to look at the <a class="el" href="group___h5_l_t.html">HDF5 Lite APIs (H5LT,H5LD)</a> at this time.</p>
<p>If you plan to work with images, please look at the High Level <a class="el" href="group___h5_i_m.html">HDF5 Images API (H5IM)</a>, as well.</p>
<h1><a class="anchor" id="secLBDsetCreateProg"></a>
Programming Example</h1>
<h2><a class="anchor" id="subsecLBDsetCreateProgDesc"></a>
Description</h2>
<p>See <a class="el" href="_l_b_examples.html">Examples from Learning the Basics</a> for the examples used in the <a class="el" href="_learn_basics.html">Learning the Basics</a> tutorial.</p>
<p>The example shows how to create an empty dataset. It creates a file called <code style="background-color:whitesmoke;">dset.h5</code> in the C version (<code style="background-color:whitesmoke;">dsetf.h5</code> in Fortran), defines the dataset dataspace, creates a dataset which is a 4x6 integer array, and then closes the dataspace, the dataset, and the file.</p>
<p>For details on compiling an HDF5 application: [ <a class="el" href="_l_b_compiling.html">Compiling HDF5 Applications</a> ]</p>
<h2><a class="anchor" id="subsecLBDsetCreateProgRem"></a>
Remarks</h2>
<p><a class="el" href="group___h5_s.html#ga8e35eea5738b4805856eac7d595254ae" title="Creates a new simple dataspace and opens it for access.">H5Screate_simple</a> creates a new simple dataspace and returns a dataspace identifier. <a class="el" href="group___h5_s.html#ga2b53128a39c8f104c1c9c2a91590fcc1" title="Releases and terminates access to a dataspace.">H5Sclose</a> releases and terminates access to a dataspace.</p>
<p><em>C</em> </p><div class="fragment"><div class="line">dataspace_id = <a class="code" href="group___h5_s.html#ga8e35eea5738b4805856eac7d595254ae">H5Screate_simple</a> (rank, dims, maxdims);</div>
<div class="line">status = <a class="code" href="group___h5_s.html#ga2b53128a39c8f104c1c9c2a91590fcc1">H5Sclose</a> (dataspace_id );</div>
<div class="ttc" id="agroup___h5_s_html_ga2b53128a39c8f104c1c9c2a91590fcc1"><div class="ttname"><a href="group___h5_s.html#ga2b53128a39c8f104c1c9c2a91590fcc1">H5Sclose</a></div><div class="ttdeci">herr_t H5Sclose(hid_t space_id)</div><div class="ttdoc">Releases and terminates access to a dataspace.</div></div>
<div class="ttc" id="agroup___h5_s_html_ga8e35eea5738b4805856eac7d595254ae"><div class="ttname"><a href="group___h5_s.html#ga8e35eea5738b4805856eac7d595254ae">H5Screate_simple</a></div><div class="ttdeci">hid_t H5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxdims[])</div><div class="ttdoc">Creates a new simple dataspace and opens it for access.</div></div>
</div><!-- fragment --><p><em>FORTRAN</em> </p><div class="fragment"><div class="line">CALL <a class="code" href="group___f_h5_s.html#ga54083c84fd4be392ac770cf223cd6cf4">h5screate_simple_f</a> (rank, dims, dataspace_id, hdferr, maxdims=max_dims)</div>
<div class="line">     or</div>
<div class="line">CALL <a class="code" href="group___f_h5_s.html#ga54083c84fd4be392ac770cf223cd6cf4">h5screate_simple_f</a> (rank, dims, dataspace_id, hdferr)</div>
<div class="line"> </div>
<div class="line">CALL <a class="code" href="group___f_h5_s.html#gaf06283f60395d8fa6806b6c1136ad700">h5sclose_f</a> (dataspace_id, hdferr)</div>
<div class="ttc" id="agroup___f_h5_s_html_ga54083c84fd4be392ac770cf223cd6cf4"><div class="ttname"><a href="group___f_h5_s.html#ga54083c84fd4be392ac770cf223cd6cf4">h5s::h5screate_simple_f</a></div><div class="ttdeci">subroutine h5screate_simple_f(rank, dims, space_id, hdferr, maxdims)</div><div class="ttdoc">Creates a new simple data space and opens it for access.</div><div class="ttdef"><b>Definition:</b> H5Sff.F90:59</div></div>
<div class="ttc" id="agroup___f_h5_s_html_gaf06283f60395d8fa6806b6c1136ad700"><div class="ttname"><a href="group___f_h5_s.html#gaf06283f60395d8fa6806b6c1136ad700">h5s::h5sclose_f</a></div><div class="ttdeci">subroutine h5sclose_f(space_id, hdferr)</div><div class="ttdoc">Releases and terminates access to a dataspace.</div><div class="ttdef"><b>Definition:</b> H5Sff.F90:105</div></div>
</div><!-- fragment --><p><a class="el" href="group___h5_d.html#ga0647ba4bbd26d5230cc07f3a5685b2cf">H5Dcreate</a> creates an empty dataset at the specified location and returns a dataset identifier. <a class="el" href="group___h5_d.html#gae47c3f38db49db127faf221624c30609" title="Closes the specified dataset.">H5Dclose</a> closes the dataset and releases the resource used by the dataset. This call is mandatory.</p>
<p><em>C</em> </p><div class="fragment"><div class="line">dataset_id = <a class="code" href="group___h5_d.html#ga0647ba4bbd26d5230cc07f3a5685b2cf">H5Dcreate</a>(file_id, <span class="stringliteral">&quot;/dset&quot;</span>, <a class="code" href="group___p_d_t_s_t_d.html#ga37e8a6be7ee64587c2a282b965019bb8">H5T_STD_I32BE</a>, dataspace_id, <a class="code" href="_h5_ppublic_8h.html#afa85e97bfbf9bf1c58e39263846c568f">H5P_DEFAULT</a>, <a class="code" href="_h5_ppublic_8h.html#afa85e97bfbf9bf1c58e39263846c568f">H5P_DEFAULT</a>, <a class="code" href="_h5_ppublic_8h.html#afa85e97bfbf9bf1c58e39263846c568f">H5P_DEFAULT</a>);</div>
<div class="line">status = <a class="code" href="group___h5_d.html#gae47c3f38db49db127faf221624c30609">H5Dclose</a> (dataset_id);</div>
<div class="ttc" id="a_h5_ppublic_8h_html_afa85e97bfbf9bf1c58e39263846c568f"><div class="ttname"><a href="_h5_ppublic_8h.html#afa85e97bfbf9bf1c58e39263846c568f">H5P_DEFAULT</a></div><div class="ttdeci">#define H5P_DEFAULT</div><div class="ttdef"><b>Definition:</b> H5Ppublic.h:102</div></div>
<div class="ttc" id="agroup___h5_d_html_ga0647ba4bbd26d5230cc07f3a5685b2cf"><div class="ttname"><a href="group___h5_d.html#ga0647ba4bbd26d5230cc07f3a5685b2cf">H5Dcreate</a></div><div class="ttdeci">#define H5Dcreate</div><div class="ttdef"><b>Definition:</b> H5version.h:892</div></div>
<div class="ttc" id="agroup___h5_d_html_gae47c3f38db49db127faf221624c30609"><div class="ttname"><a href="group___h5_d.html#gae47c3f38db49db127faf221624c30609">H5Dclose</a></div><div class="ttdeci">herr_t H5Dclose(hid_t dset_id)</div><div class="ttdoc">Closes the specified dataset.</div></div>
<div class="ttc" id="agroup___p_d_t_s_t_d_html_ga37e8a6be7ee64587c2a282b965019bb8"><div class="ttname"><a href="group___p_d_t_s_t_d.html#ga37e8a6be7ee64587c2a282b965019bb8">H5T_STD_I32BE</a></div><div class="ttdeci">#define H5T_STD_I32BE</div><div class="ttdef"><b>Definition:</b> H5Tpublic.h:305</div></div>
</div><!-- fragment --><p><em>FORTRAN</em> </p><div class="fragment"><div class="line">CALL <a class="code" href="group___f_h5_d.html#ga5cb1ac0f28ebc68918e37b282c40f302">h5dcreate_f</a> (loc_id, name, type_id, dataspace_id, dset_id, hdferr)</div>
<div class="line">CALL <a class="code" href="group___f_h5_d.html#ga2ffabd12a26d5afcafba44240df62f33">h5dclose_f</a> (dset_id, hdferr)</div>
<div class="ttc" id="agroup___f_h5_d_html_ga2ffabd12a26d5afcafba44240df62f33"><div class="ttname"><a href="group___f_h5_d.html#ga2ffabd12a26d5afcafba44240df62f33">h5d::h5dclose_f</a></div><div class="ttdeci">subroutine h5dclose_f(dset_id, hdferr)</div><div class="ttdoc">Closes a dataset.</div><div class="ttdef"><b>Definition:</b> H5Dff.F90:495</div></div>
<div class="ttc" id="agroup___f_h5_d_html_ga5cb1ac0f28ebc68918e37b282c40f302"><div class="ttname"><a href="group___f_h5_d.html#ga5cb1ac0f28ebc68918e37b282c40f302">h5d::h5dcreate_f</a></div><div class="ttdeci">subroutine h5dcreate_f(loc_id, name, type_id, space_id, dset_id, hdferr, dcpl_id, lcpl_id, dapl_id)</div><div class="ttdoc">Creates a dataset at the specified location.</div><div class="ttdef"><b>Definition:</b> H5Dff.F90:229</div></div>
</div><!-- fragment --><p>Note that if using the pre-defined datatypes in FORTRAN, then a call must be made to initialize and terminate access to the pre-defined datatypes: </p><div class="fragment"><div class="line">CALL <a class="code" href="group___f_h5.html#ga041e8ea7a216ab58ddc59bf6751393d6">h5open_f</a> (hdferr)</div>
<div class="line">CALL <a class="code" href="group___f_h5.html#ga44774afab361ee25be7eda5b6fc86374">h5close_f</a> (hdferr)</div>
<div class="ttc" id="agroup___f_h5_html_ga041e8ea7a216ab58ddc59bf6751393d6"><div class="ttname"><a href="group___f_h5.html#ga041e8ea7a216ab58ddc59bf6751393d6">h5lib::h5open_f</a></div><div class="ttdeci">subroutine, public h5open_f(error)</div><div class="ttdoc">Initializes HDF5 Fortran interface.</div><div class="ttdef"><b>Definition:</b> H5_ff.F90:180</div></div>
<div class="ttc" id="agroup___f_h5_html_ga44774afab361ee25be7eda5b6fc86374"><div class="ttname"><a href="group___f_h5.html#ga44774afab361ee25be7eda5b6fc86374">h5lib::h5close_f</a></div><div class="ttdeci">subroutine, public h5close_f(error)</div><div class="ttdoc">Closes HDF5 Fortran interface.</div><div class="ttdef"><b>Definition:</b> H5_ff.F90:795</div></div>
</div><!-- fragment --><p>H5open must be called before any HDF5 library subroutine calls are made; H5close must be called after the final HDF5 library subroutine call.</p>
<p>See the programming example for an illustration of the use of these calls.</p>
<h2><a class="anchor" id="subsecLBDsetCreateContent"></a>
File Contents</h2>
<p>The contents of the file dset.h5 (dsetf.h5 for FORTRAN) are shown below: </p><table class="doxtable">
<caption>Contents of dset.h5 (dsetf.h5)</caption>
<tr>
<td><div class="image">
<img src="imgLBDsetCreate.gif" alt=""/>
</div>
   </td></tr>
</table>
<table class="doxtable">
<tr>
<th>dset.h5 in DDL </th><th>dsetf.h5 in DDL </th></tr>
<tr>
<td><div class="fragment"><div class="line">HDF5 <span class="stringliteral">&quot;dset.h5&quot;</span> {</div>
<div class="line">GROUP <span class="stringliteral">&quot;/&quot;</span> {</div>
<div class="line">   DATASET <span class="stringliteral">&quot;dset&quot;</span> {</div>
<div class="line">      DATATYPE { <a class="code" href="group___p_d_t_s_t_d.html#ga37e8a6be7ee64587c2a282b965019bb8">H5T_STD_I32BE</a> }</div>
<div class="line">      DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) }</div>
<div class="line">      DATA {</div>
<div class="line">         0, 0, 0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0, 0, 0</div>
<div class="line">      }</div>
<div class="line">   }</div>
<div class="line">}</div>
<div class="line">}</div>
</div><!-- fragment -->  </td><td><div class="fragment"><div class="line">HDF5 <span class="stringliteral">&quot;dsetf.h5&quot;</span> {</div>
<div class="line">GROUP <span class="stringliteral">&quot;/&quot;</span> {</div>
<div class="line">   DATASET <span class="stringliteral">&quot;dset&quot;</span> {</div>
<div class="line">      DATATYPE { <a class="code" href="group___p_d_t_s_t_d.html#ga37e8a6be7ee64587c2a282b965019bb8">H5T_STD_I32BE</a> }</div>
<div class="line">      DATASPACE { SIMPLE ( 6, 4 ) / ( 6, 4 ) }</div>
<div class="line">      DATA {</div>
<div class="line">         0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0,</div>
<div class="line">         0, 0, 0, 0</div>
<div class="line">      }</div>
<div class="line">   }</div>
<div class="line">}</div>
<div class="line">}</div>
</div><!-- fragment -->   </td></tr>
</table>
<p>Note in above that <a class="el" href="group___p_d_t_s_t_d.html#ga37e8a6be7ee64587c2a282b965019bb8">H5T_STD_I32BE</a>, a 32-bit Big Endian integer, is an HDF atomic datatype.</p>
<h2><a class="anchor" id="subsecLBDsetCreateProgDDL"></a>
Dataset Definition in DDL</h2>
<p>The following is the simplified DDL dataset definition: </p><div class="fragment"><div class="line">&lt;dataset&gt; ::= DATASET <span class="stringliteral">&quot;&lt;dataset_name&gt;&quot;</span> { &lt;datatype&gt;</div>
<div class="line">                                         &lt;dataspace&gt;</div>
<div class="line">                                         &lt;data&gt;</div>
<div class="line">                                         &lt;dataset_attribute&gt;* }</div>
<div class="line"> </div>
<div class="line">&lt;datatype&gt; ::= DATATYPE { &lt;atomic_type&gt; }</div>
<div class="line"> </div>
<div class="line">&lt;dataspace&gt; ::= DATASPACE { SIMPLE &lt;current_dims&gt; / &lt;max_dims&gt; }</div>
<div class="line"> </div>
<div class="line">&lt;dataset_attribute&gt; ::= &lt;attribute&gt;</div>
</div><!-- fragment --><hr  />
<p> Navigate back: <a class="el" href="index.html">Main</a> / <a class="el" href="_getting_started.html">Getting Started with HDF5</a> / <a class="el" href="_learn_basics.html">Learning the Basics</a> </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>