summaryrefslogtreecommitdiffstats
path: root/doc/html/Tutor/crtgrpd.html
blob: 97ae78c4d9b2ae8f73aed75141dc40487acfc11e (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
<HTML><HEAD>
<TITLE>HDF5 Tutorial - Creating Datasets in Groups
</TITLE> 
</HEAD>

<body bgcolor="#ffffff">

<!-- BEGIN MAIN BODY -->


 [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ]
<H1>
<BIG><BIG><BIG><FONT COLOR="#c101cd">Creating Datasets in Groups</FONT>
</BIG></BIG></BIG></H1>

<hr noshade size=1>

<BODY>
<H2>Contents:</H2>
<UL>
    <LI> <A HREF="#ds"> Creating datasets in groups</A>
    <LI> Programming Example 
    <UL>
      <LI> <A HREF="#desc">Description</A> 
<!--      <LI> <A HREF="#rem">Remarks</A> -->
      <LI> <A HREF="#fc">File Contents</A>
    </UL>
</UL>
<HR>
<A NAME="ds">
<H2><U>Creating datasets in groups</U></H2>      
We have shown how to create groups, datasets, and attributes. 
In this section, we show how to create datasets in groups. 
Recall that <code>H5Dcreate</code>/<code>h5dcreate_f</code> 
creates a dataset at the location specified by a location identifier and 
a name. Similar to <code>H5Gcreate</code>/<code>h5gcreate_f</code>, 
the location identifier can be a 
file identifier or a group identifier and the name can be
relative or absolute. The location identifier and the name together determine 
the location where the dataset is to be created. If the location identifier 
and name refer to a group, then the dataset is created in that group.


<H2> Programming Example</H2>
<A NAME="desc">
<H3><U>Description</U></H3>      
This example shows how to create a dataset in a particular group.
It opens the file created in the previous example and creates two datasets.<BR>
<UL>
[ <A HREF="examples/h5_crtgrpd.c">C Example</A> ] -  <code>h5_crtgrpd.c</code>
<BR>
[ <A HREF="examples/grpdsetexample.f90">FORTRAN Example</A> ] 
- <code>grpdsetexample.f90</code><BR> 
[ <A HREF="examples/java/CreateGroupDataset.java">Java Example</A> ] 
- <code>CreateGroupDataset.java</code>
</UL>
<B>NOTE:</B> To download a tar file of the examples, including a Makefile,
please go to the <A HREF="references.html">References</A> page.


<A NAME="fc">
<H3><U>File Contents</U></H3>
<P>
<B>Fig. 10.1</B> &nbsp; <I>The Contents of <code>groups.h5</code> 
   (<code>groupsf.h5</code> for FORTRAN)</I>
<PRE>
<IMG src="img005.gif"></PRE>
<!-- <IMG src="groups2.jpg" width="324" height="433"></PRE> -->

</PRE>
 <B>Fig. 10.2a</B> &nbsp; <I><code>groups.h5</code> in DDL</I>
<PRE>

HDF5 "groups.h5" {
GROUP "/" {
   GROUP "MyGroup" {
      GROUP "Group_A" {
         DATASET "dset2" {
            DATATYPE { H5T_STD_I32BE }
            DATASPACE { SIMPLE ( 2, 10 ) / ( 2, 10 ) }
            DATA {
               1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
               1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            }
         }
      }
      GROUP "Group_B" {
      }
      DATASET "dset1" {
         DATATYPE { H5T_STD_I32BE }
         DATASPACE { SIMPLE ( 3, 3 ) / ( 3, 3 ) }
         DATA {
            1, 2, 3,
            1, 2, 3,
            1, 2, 3
         }
      }
   }
}
}
</PRE>
 <B>Fig. 10.2b</B> &nbsp; <I><code>groupsf.h5</code> in DDL</I>
<PRE>

HDF5 "groupsf.h5" {
GROUP "/" {
   GROUP "MyGroup" {
      GROUP "Group_A" {
         DATASET "dset2" {
            DATATYPE { H5T_STD_I32BE }
            DATASPACE { SIMPLE ( 10, 2 ) / ( 10, 2 ) }
            DATA {
               1, 1,
               2, 2,
               3, 3,
               4, 4,
               5, 5,
               6, 6,
               7, 7,
               8, 8,
               9, 9,
               10, 10
            }
         }
      }
      GROUP "Group_B" {
      }
      DATASET "dset1" {
         DATATYPE { H5T_STD_I32BE }
         DATASPACE { SIMPLE ( 3, 3 ) / ( 3, 3 ) }
         DATA {
            1, 1, 1,
            2, 2, 2,
            3, 3, 3
         }
      }
   }
}
}
</PRE>
<!-- 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="footer-ncsalogo.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>
<!-- <A HREF="helpdesk.mail.html"> -->
<BR><A HREF="mailto:hdfhelp@ncsa.uiuc.edu">
hdfhelp@ncsa.uiuc.edu</A>
<br>
<BR> <H6>Last Modified: June 22, 2001</H6><BR>
<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu -->
</FONT>
<BR>
<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> -->

</BODY>
</HTML>