mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
Purpose: [is this a bug fix? feature? ...] Description: [describe the bug, or describe the new feature, etc] Solution: [details about the changes, algorithm, etc...] [Please as detail as you can since your own explanation is better than others guessing it from the code.] Platforms tested: [machines you have tested the changed version. This is absolute important. Test it out on at least two or three different platforms such as Big-endian-32bit (SUN/IRIX), little-endian-32(LINUX) and 64-bit (IRIX64/UNICOS/DEC-ALPHA) would be good.]
167 lines
4.4 KiB
HTML
167 lines
4.4 KiB
HTML
<HTML><HEAD>
|
|
<TITLE>HDF5 Tutorial - Creating Datasets in Groups
|
|
</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">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> <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> <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> <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="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>
|
|
<!-- <A HREF="helpdesk.mail.html"> -->
|
|
<BR><A HREF="mailto:hdfhelp@ncsa.uiuc.edu">
|
|
hdfhelp@ncsa.uiuc.edu</A>
|
|
<br>
|
|
<BR> <H6>Last Modified: March 9, 2001</H6><BR>
|
|
<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu -->
|
|
</FONT>
|
|
<BR>
|
|
<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> -->
|
|
|
|
</BODY>
|
|
</HTML>
|
|
|
|
|
|
|