11/6/07HDF and HDF-EOS Workshop XI, Landover, MD1 Introduction to HDF5 HDF and HDF-EOS Workshop XI November 6-8, 2007.

Slides:



Advertisements
Similar presentations
A PLFS Plugin for HDF5 for Improved I/O Performance and Analysis Kshitij Mehta 1, John Bent 2, Aaron Torres 3, Gary Grider 3, Edgar Gabriel 1 1 University.
Advertisements

The HDF Group November 3-5, 2009HDF/HDF-EOS Workshop XIII1 HDF-Java Products Peter Cao The HDF Group The 13 th HDF and HDF-EOS Workshop.
The HDF Group November 3-5, 2009HDF/HDF-EOS Workshop XIII1 HDF5 Advanced Topics Elena Pourmal The HDF Group The 13 th HDF and HDF-EOS.
10/15/08HDF & HDF-EOS Workshop XII11 Introduction to HDF5 HDF & HDF-EOS Workshop XII October 15, 2008.
The HDF Group Introduction to HDF5 Barbara Jones The HDF Group The 13 th HDF & HDF-EOS Workshop November 3-5, HDF/HDF-EOS Workshop.
© 2008The MathWorks, Inc. ® ® The MATLAB Low-Level HDF5 Interface John Evans.
Ensuring Long Term Access to Remotely Sensed HDF4 Data with Layout Maps Mike Folks, The HDF Group Ruth Duerr, NSIDC 1.
Euratom – ENEA Association Commonalities and differences between MDSplus and HDF5 data systems G. Manduchi Consorzio RFX, Euratom-ENEA Association, corso.
1 of 14 Substituting HDF5 tools with Python/H5py scripts Daniel Kahn Science Systems and Applications Inc. HDF HDF-EOS Workshop XIV, 28 Sep
HDF5 Tools Update Peter Cao - The HDF Group November 6, 2007 This report is based upon work supported in part by a Cooperative Agreement.
Parallel HDF5 Introductory Tutorial May 19, 2008 Kent Yang The HDF Group 5/19/20081SCICOMP 14 Tutorial.
HDF 1 HDF5 Advanced Topics Object’s Properties Storage Methods and Filters Datatypes HDF and HDF-EOS Workshop VIII October 26, 2004.
The HDF Group April 17-19, 2012HDF/HDF-EOS Workshop XV1 Introduction to HDF5 Barbara Jones The HDF Group The 15 th HDF and HDF-EOS Workshop.
1 High level view of HDF5 Data structures and library HDF Summit Boeing Seattle September 19, 2006.
HDF5 A new file format & software for high performance scientific data management.
Sep , 2010HDF/HDF-EOS Workshop XIV1 HDF5 Advanced Topics Neil Fortner The HDF Group The 14 th HDF and HDF-EOS Workshop September 28-30, 2010.
The HDF Group Parallel HDF5 Design and Programming Model May 30-31, 2012HDF5 Workshop at PSI 1.
A Metadata Based Approach For Supporting Subsetting Queries Over Parallel HDF5 Datasets Vignesh Santhanagopalan Graduate Student Department Of CSE.
February 2-3, 2006SRB Workshop, San Diego P eter Cao, NCSA Mike Wan, SDSC Sponsored by NLADR, NFS PACI Project in Support of NCSA-SDSC Collaboration Object-level.
1 Introduction to HDF5 Data Model, Programming Model and Library APIs HDF and HDF-EOS Workshop VIII October 26, 2004.
April 28, 2008LCI Tutorial1 HDF5 Tutorial LCI April 28, 2008.
May 30-31, 2012HDF5 Workshop at PSI1 HDF5 at Glance Quick overview of known topics.
The HDF Group HDF5 Datasets and I/O Dataset storage and its effect on performance May 30-31, 2012HDF5 Workshop at PSI 1.
The netCDF-4 data model and format Russ Rew, UCAR Unidata NetCDF Workshop 25 October 2012.
HDF Dimension Scales in HDF5 HDF-EOS Workshop IX San Francisco, CA November 30 - December 2, 2005 Pedro Vicente Nunes THG/NCSA Champaign-Urbana, IL HDF.
The HDF Group October 28, 2010NetcDF Workshop1 Introduction to HDF5 Quincey Koziol The HDF Group Unidata netCDF Workshop October 28-29,
Support for NPP/NPOESS by The HDF Group Mike Folk The HDF Group HDF and HDF-EOS Workshop XII October 17, 2008 Oct HDF and HDF-EOS Workshop XII1.
Using HDF5 for Scientific Data Analysis NERSC Visualization Group.
Ensuring Long Term Access to Remotely Sensed HDF4 Data with Layout Maps Ruth Duerr, NSIDC Christopher Lynnes, GES DISC The HDF Group Oct HDF and.
October 15, 2008HDF and HDF-EOS Workshop XII1 What will be new in HDF5?
Array in C++ / review. An array contains multiple objects of identical types stored sequentially in memory. The individual objects in an array, referred.
1 N-bit and ScaleOffset filters MuQun Yang National Center for Supercomputing Applications University of Illinois at Urbana-Champaign Urbana, IL
1 HDF5 Life cycle of data Boeing September 19, 2006.
HDF 1 Introduction to HDF5 NCSA/University of Illinois at Urbana-Champaign May 2000
1 Introduction to HDF5 Data Model, Programming Model and Library APIs HDF and HDF-EOS Workshop IX November 30, 2005.
HDF Hierarchical Data Format Nancy Yeager Mike Folk NCSA University of Illinois at Urbana-Champaign, USA
The HDF Group November 3-5, 2009HDF/HDF-EOS Workshop XIII1 HDF5 Advanced Topics Elena Pourmal The HDF Group The 13 th HDF and HDF-EOS.
1 Error Handling Interface HDF-EOS Workshop IX Quincey Koziol and Ray Lu 30 Nov 2005.
September 9, 2008SPEEDUP Workshop - HDF5 Tutorial1 Introduction to HDF5 Command-line Tools.
The HDF Group Introduction to netCDF-4 Elena Pourmal The HDF Group 110/17/2015.
March 9, th International LCI Conference - HDF5 Tutorial1 HDF5 Advanced Topics.
The HDF Group 10/17/15 1 HDF5 vs. Other Binary File Formats Introduction to the HDF5’s most powerful features ICALEPCS 2015.
11/8/2007HDF and HDF-EOS Workshop XI, Landover, MD1 Software to access HDF5 Datasets via OPeNDAP MuQun Yang, Hyo-Kyung Lee The HDF Group.
Intro to Parallel HDF5 10/17/151ICALEPCS /17/152 Outline Overview of Parallel HDF5 design Parallel Environment Requirements Performance Analysis.
October 15-17, 2008HDF and HDF-EOS Workshop XII1 HDF-Java Products Peter Cao The HDF Group HDF and HDF-EOS Workshop XII October 15, 2008.
April 28, 2008LCI Tutorial1 Parallel HDF5 Tutorial Tutorial Part IV.
September 9, 2008SPEEDUP Workshop - HDF5 Tutorial1 HDF5 Tutorial 37 th SPEEDUP Workshop on HPC Albert Cheng, Elena Pourmal The HDF Group.
Support for NPP/NPOESS by The HDF Group Mike Folk, Elena Pourmal The HDF Group Annual HDF Briefing to ESDIS March 31, 2009 March Annual HDF Briefing.
The HDF Group 10/17/151 Introduction to HDF5 ICALEPCS 2015.
1 Introduction to HDF5 Programming and Tools Boeing September 19, 2006.
The HDF Group Introduction to HDF5 Session 7 Datatypes 1 Copyright © 2010 The HDF Group. All Rights Reserved.
NetCDF Data Model Details Russ Rew, UCAR Unidata NetCDF 2009 Workshop
Copyright © 2010 The HDF Group. All Rights Reserved1 Data Storage and I/O in HDF5.
- 1 - Overview of Parallel HDF Overview of Parallel HDF5 and Performance Tuning in HDF5 Library NCSA/University of Illinois at Urbana- Champaign.
The HDF Group Introduction to HDF5 Session Three HDF5 Software Overview 1 Copyright © 2010 The HDF Group. All Rights Reserved.
1 January 11-13, 2010ESRF Workshop – Introduction to HDF5 Introduction to HDF5 Francesc Alted Consultant and PyTables creator.
HDF and HDF-EOS Workshop XII
Adding CF Attributes to an HDF5 File
Moving from HDF4 to HDF5/netCDF-4
Parallel HDF5 Introductory Tutorial
Introduction to HDF5 Session Five Reading & Writing Raw Data Values
HDF5 Metadata and Page Buffering
Introduction to HDF5 Tutorial.
HDF and HDF-EOS Workshop XII
Introduction to HDF5 for HDF4 users
HDF5 Virtual Dataset Elena Pourmal Copyright 2017, The HDF Group.
Peter Cao The HDF Group November 28, 2006
Introduction to HDF5 Mike McGreevy The HDF Group
Moving applications to HDF
Application Application CLAMR (Cell-Based Adaptive Mesh Refinement)
Presentation transcript:

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD1 Introduction to HDF5 HDF and HDF-EOS Workshop XI November 6-8, 2007

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD2 Goals Introduce HDF5 Explain how data can be organized and used in an application Provide example code

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD3 For More Information… All workshop slides will be available from: See the Resources handout for where to get software, Docs, FAQs, etc..

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD4 What is HDF5? HDF = Hierarchical Data Format File format for managing any kind of data Software (library and tools) for accessing data in that format

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD5 HDF5 Features Especially suited for large and/or complex data collections. Platform independent C, F90, C++, Java APIs

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD6 Diagram Definitions = Group = Dataset

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD7 Example HDF5 file “/” (root) “/foo” Raster image palette 3-D array 2-D array Raster image lat | lon | temp ----|-----| | 23 | | 24 | | 21 | 3.6 Table

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD8 Viewing an HDF5 File with HDFView

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD9

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD10 Example HDF5 Application #include #include "H5IM.h" #define WIDTH 57 /* dataset dimensions */ #define HEIGHT 57 #define RANK 2 int main (void) { hid_t file; /* file handle */ herr_t status; unsigned char data[WIDTH][HEIGHT]; /* data to write */ int i, j, num, val; FILE *fp; fp = fopen ("storm110.txt", "r"); /* Open ASCII file */ for (i=0; i<WIDTH; i++) /* Read Values into ‘data’ buffer */ for (j=0; j<HEIGHT; j++) { num = fscanf (fp, "%d ", &val); data[i][j] = val; } file = H5Fcreate ("storm.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* Create file */ status = H5IMmake_image_8bit (file, "Storm_Image", WIDTH, HEIGHT, /* Create Image */ (const unsigned char *)data); status = H5Fclose (file);/* Close file */ }

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD11 HDF5 Data Model

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD12 HDF5 File Container for Storing Scientific Data Primary Objects - Datasets - Groups Others Objects - Attributes - Property Lists - Dataspaces

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD13 HDF5 Dataset Data array -Ordered collection of identically typed data items distinguished by their indices Metadata - Dataspace: Rank, dimensions; spatial info about dataset - Datatype: Information to interpret your data - Storage Properties: How array is organized - Attributes: User-defined metadata (optional)

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD14 Dataset Components 3 Rank Dim_2 = 5 Dim_1 = 4 Dimensions Time = 32.4 Pressure = 987 Temp = 56 Attributes Chunked Compressed Dim_3 = 7 Properties IEEE 32-bit float Datatype MetadataData Dataspace

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD15 HDF5 Dataset: Dataspace Rank and dimensions - Permanent part of dataset definition Subset of points, for partial I/O - Needed only during I/O operations Apply to datasets in memory or in the file Rank = 2 Dimensions = 4x6 Spatial Information about a dataset

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD16 Each Element int8int4int16 2x3x2 array of float32 Datatype: HDF5 Dataset: Compound Datatype Dimensionality: 5 x 3 3 5

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD17 HDF5 Dataset: Datatype Information on how to interpret a data element Permanent part of the dataset definition HDF5 atomic types - normal integer & float - user-definable (e.g. 13-bit integer) - variable length types (e.g. strings) - pointers - references to objects/dataset regions - enumeration - names mapped to integers - array HDF5 compound types - Comparable to C structs - Members can be atomic or compound types

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD18 HDF5 Dataset: Property List A collection of values that can be passed to HDF5 functions at lower layers of library There are property lists that you can use when: - creating a file - accessing a file - creating a dataset - reading/writing to a dataset. To use the HDF5 library defaults: H5Pdefault

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD19 HDF5 Dataset: Storage Layout Properties Contiguous: Dataset stored in continuous array of bytes (Default) Chunked: Dataset stored as fixed sized chunks. Each chunk is read/written with a single I/O operation. Required for: - compression - unlimited dimension dataset (extendible)

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD20 HDF5 Dataset: Properties Better subsetting access time; extend, compression Chunked Improves storage efficiency, transmission speed Compressed Arrays can be extended in any direction Extendible Metadata for Fred Dataset “Fred” File A File B Data for Fred Metadata in one file, raw data in another. External file

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD21 HDF5 Dataset: Attributes Data of form “name = value” attached to an object Scaled­down versions of dataset operations - Not extendible - No compression - No partial I/O Optional

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD22 HDF5 Dataset (again) Data array -Ordered collection of identically typed data items distinguished by their indices Metadata - Dataspace: Rank, dimensions; spatial info about dataset - Datatype: Information to interpret your data - Properties: How array is organized - Attributes: User-defined metadata (optional)

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD23 HDF5 File: Groups A mechanism for describing collections of related objects Every file starts with a root group Can have attributes Similar to UNIX directories “/”

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD24 “/” x temp / (root) /x /foo /foo/temp /foo/bar/temp HDF5 objects are identified and located by their pathnames foo bar temp

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD25 HDF5 I/O Library

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD26 File or other “storage” Virtual file I/O Library internals Structure of HDF5 Library Object API (C, F90, C++, Java) Applications

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD27 Virtual File I/O Layer Allows HDF5 format address space to map to disk, the network, memory, or a user-defined device Network File FamilyMPI I/OMemory Virtual file I/O drivers Memory Stdio File Family File “Storage” … …

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD28 Introduction to HDF5 API Programming model for sequential access

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD29 General API Topics General info about HDF5 programming (C ) Walk through example program

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD30 The General HDF5 API Currently has C, Fortran 90, Java, C++ bindings. C routines begin with prefix H5X, where X is a single letter indicating the object on which the operation is to be performed. Example APIs: H5F: File Interface: H5Fopen H5D: Dataset Interface: H5Dread H5S: DataSpace Interface: H5Screate_simple H5P: Property List Interface: H5Pset_chunk H5G: Group Interface:H5Gcreate H5A: Attribute Interface: H5Acreate

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD31 The General Paradigm Properties of objects are defined (optional) Objects are opened or created Objects then accessed Objects finally closed

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD32 Order of Operations The library imposes an order on the operations by argument dependencies Example: A file must be opened before a dataset because the dataset open call requires a file identifier as an argument

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD33 HDF5 C Programming Issues For portability, HDF5 library has its own defined types. For example: hid_t: Object identifiers hsize_t: Size used for dimensions herr_t: Function return value For C, include #include hdf5.h at the top of your HDF5 application.

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD34 H5dump Command-line Utility To View HDF5 File h5dump [--header] [-a ] [-d ] [-g ] [-l ] [-t ] --header Display header only; no data is displayed. -a Display the specified attribute(s). -d Display the specified dataset(s). -g Display the specified group(s) and all the members. -l Displays the value(s) of the specified soft link(s). -t Display the specified named datatype(s). -p Display properties. is one or more appropriate object names.

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD35 HDF5 "dset.h5" { GROUP "/" { DATASET "dset" { DATATYPE { H5T_STD_I32BE } DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) } DATA { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 } “/” ‘dset’ Example of h5dump Output

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD36 Example HDF5 Application 1 #include "hdf5.h" 2 #define FILE "dset.h5" 3 int main () { 4 hid_t file_id, dataset_id, dataspace_id; 5 hsize_t dims[2]; 6 herr_t status; 7 int i, j, dset_data[4][6]; 8 for (i = 0; i < 4; i++) 9 for (j = 0; j < 6; j++) 10 dset_data[i][j] = i * 6 + j + 1; 11 file_id = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); 12 dims[0] = 4; 13 dims[1] = 6; 14 dataspace_id = H5Screate_simple (2, dims, NULL); 15 dataset_id = H5Dcreate (file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); 16 status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); 17 status = H5Sclose (dataspace_id); 18 status = H5Dclose (dataset_id); 19 status = H5Fclose (file_id); 20 } Steps: 11 Create (or use default) file creation/access properties 11 Create file w/ above properties Create (or use default) dataset characteristics: [ dataspace, datatype, storage properties] 15 Create dataset using above characteristics 16 Write data to dataset Close all interfaces

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD37 Example Code - Dataspace 12 dims[0] = 4; 13 dims[1] = 6; 14 dataspace_id = H5Screate_simple (2, dims, NULL); 15dataset_id = H5Dcreate (file_id, “/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); Rank Array of Dimension Sizes (4x6) NOT used here.

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD38 Example Code - Datatype 12 dims[0] = 4; 13 dims[1] = 6; 14 dataspace_id = H5Screate_simple (2, dims, NULL); 15dataset_id = H5Dcreate (file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); Where do you get the datatype?

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD39 HDF5 Pre-defined Datatype Identifiers HDF5 opens set of Pre-Defined Datatype identifiers. For example: C Type HDF5 File TypeHDF5 Memory Type intH5T_STD_I32BE H5T_NATIVE_INT H5T_STD_I32LE floatH5T_IEEE_F32BE H5T_NATIVE_FLOAT H5T_IEEE_F32LE doubleH5T_IEEE_F64BE H5T_NATIVE_DOUBLE H5T_IEEE_F64LE

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD40 Pre-Defined File Datatype Identifiers Examples: H5T_IEEE_F64LE Eight-byte, little-endian, IEEE floating-point H5T_VAX_F32 Four-byte VAX floating point H5T_STD_I32LE Four-byte, little-endian, signed two's complement integer H5T_STD_U16BE Two-byte, big-endian, unsigned integer NOTE: What you see in the file. Name is the same everywhere and explicitly defines a datatype. *STD= “An architecture with a semi-standard type like 2’s complement integer, unsigned integer…” Architecture* Programming Type

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD41 Pre-defined Native Datatype Identifiers Examples of predefined native types in C: H5T_NATIVE_INT (int) H5T_NATIVE_FLOAT (float ) H5T_NATIVE_UINT (unsigned int) H5T_NATIVE_LONG (long ) H5T_NATIVE_CHAR (char ) NOTE: Memory types. Different for each machine. Used for reading/writing.

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD42 Example Code - H5Dwrite status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); Memory Datatype Dataset Identifier from H5Dcreate or H5Dopen

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD43 Example Code – H5Dwrite status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); Memory Dataspace File Dataspace Data Transfer Property List H5S_ALL selects entire dataspace

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD44 Memory and File Dataspaces – Why? Partial I/O: Selected elements from source are mapped (read/written) to selected elements in destination -Selections in memory can differ from selection in file: -Number of selected elements must be the same in source and destination - Selection can be slabs, points, or result of set operations (union, difference..) on slabs or points

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD45 Example Code To: Create dataset in a group other than root Open file and dataset and read data Create an attribute for the dataset

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD46 Example HDF5 Application 1 #include "hdf5.h" 2 #define FILE "dset.h5" 3 int main () { 4 hid_t file_id, dataset_id, dataspace_id; 5 hsize_t dims[2]; 6 herr_t status; 7 int i, j, dset_data[4][6]; 8 for (i = 0; i < 4; i++) 9 for (j = 0; j < 6; j++) 10 dset_data[i][j] = i * 6 + j + 1; 11 file_id = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); 12 dims[0] = 4; 13 dims[1] = 6; 14 dataspace_id = H5Screate_simple (2, dims, NULL); 15 dataset_id = H5Dcreate (file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); 16 status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); 17 status = H5Sclose (dataspace_id); 18 status = H5Dclose (dataset_id); 19 status = H5Fclose (file_id); 20 }

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD47 How to put Dataset in a Group? hid_t group_id; … a group_id = H5Gcreate (file_id, "mygroup", 0); … b dataset_id = H5Dcreate (group_id, "dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); c status = H5Gclose (group_id); Steps: a. Create a group b. Insert the dataset into the group c. Close the group

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD48 h5dump Output w/Dataset in a Group $ h5dump dset.h5 HDF5 "dset.h5" { GROUP "/" { GROUP "mygroup" { DATASET "dset" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } DATA { (0,0): 1, 2, 3, 4, 5, 6, (1,0): 7, 8, 9, 10, 11, 12, (2,0): 13, 14, 15, 16, 17, 18, (3,0): 19, 20, 21, 22, 23, 24 } Note that dataset is in the group “mygroup” mygroup dset “/”

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD49 How to Read an Existing Dataset file_id = H5Fopen (FILE, H5F_ACC_RDWR, H5P_DEFAULT); dataset_id = H5Dopen (file_id, "/dset"); status = H5Dread (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_rdata); status = H5Dclose (dataset_id); status = H5Fclose (file_id); Steps: - Open Existing File - Open Existing Dataset - Read Data - Close dataset, file ids

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD50 How to Create an Attribute in the Dataset? hid_t aspace_id; hsize_t dimsa; int attr_data[2]= {100, 200}; hid_t attribute_id; … dimsa = 2; aspace_id = H5Screate_simple(1, &dimsa, NULL); a attribute_id = H5Acreate (dataset_id, "Units", H5T_STD_I32BE, aspace_id, H5P_DEFAULT); b status = H5Awrite (attribute_id, H5T_NATIVE_INT, attr_data); c status = H5Aclose (attribute_id); c status = H5Sclose (aspace_id); Steps: a Create an attribute attached to already open dataset b Write data to the attribute c Close attribute, dataspace Attach to open dataset

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD51 h5dump Output of Dataset with an Attribute HDF5 "dset.h5" { GROUP "/" { DATASET "dset" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) } DATA { (0,0): 1, 2, 3, 4, 5, 6, (1,0): 7, 8, 9, 10, 11, 12, (2,0): 13, 14, 15, 16, 17, 18, (3,0): 19, 20, 21, 22, 23, 24 } ATTRIBUTE "Units" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 100, 200 }

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD52 HDF5 High Level APIs

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD53 High Level APIs Make HDF5 easier to use Encourage standard ways to store objects Included with HDF5 library However: Still need HDF5 calls (H5Fopen/H5Fclose…)

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD54 High Level APIs HDF5 Lite (H5LT): Functions that simplify the steps needed to create/read datasets and attributes HDF5 Image (H5IM): Functions for creating images in HDF5. HDF5 Table (H5TB): Functions for creating tables (collections of records) in HDF5. Others … (Dimension Scales, Packet Table)

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD55 file_id = H5Fcreate ( "test.h5", ……. ); /* Call some High Level function */ H5LTsome_function ( file_id,...extra parameters ); status = H5Fclose ( file_id ); High Level Programming Model

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD56 HDF5 Hands-On Need Secure Shell or putty Everyone is logged in as: workshop Working directory for each user is specified at top right of Hands-On page Compile Examples with: h5fc, h5cc Display Dataset with: h5dump

11/6/07HDF and HDF-EOS Workshop XI, Landover, MD57 Thank you! This presentation is based upon work supported in part by a Cooperative Agreement with NASA under NASA NNX06AC83A. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Aeronautics and Space Administration.