Dimension Scales in HDF-EOS2 & HDF-EOS5

Slides:



Advertisements
Similar presentations
Senem Kumova Metin Spring2009 STACKS AND QUEUES Chapter 10 in A Book on C.
Advertisements

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.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
ECE Application Programming Instructor: Dr. Michael Geiger Spring 2012 Lecture 31: PE5.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Characters and Strings.
LV2IDL, a software package for automatic data transfer between LabVIEW and IDL Gelu M. Nita New Jersey Institute of Technology.
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.
CS 241 Section Week #2 2/4/10. 2 Topics This Section MP1 overview Part1: Pointer manipulation Part2: Basic dictionary structure implementation Review.
11/6/07HDF and HDF-EOS Workshop XI, Landover, MD1 Introduction to HDF5 HDF and HDF-EOS Workshop XI November 6-8, 2007.
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.
1 of 14 Substituting HDF5 tools with Python/H5py scripts Daniel Kahn Science Systems and Applications Inc. HDF HDF-EOS Workshop XIV, 28 Sep
Introduction to C programming
HDF-EOS Workshop VII, An XML Approach to HDF-EOS5 Files Jingli Yang 1, Bob Bane 1, Muhammad Rabi 1, Zhangshi Yin 1, Richard Ullman 1, Robert McGrath.
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.
Important ESDIS 2009 tasks review Kent Yang, Mike Folk The HDF Group April 1st, /1/20151Annual briefing to ESDIS.
Page 1 HDF-EOS Tools Abe Taaheri, Raytheon IIS ESIP Meeting Chapel Hill, NC July 9, 2013.
NPP/ NPOESS Product Data Format Richard E. Ullman NASA/GSFC/NPP NOAA/NESDIS/IPOAlgorithm / System EngineeringData / Information Architecture
1 Introduction to HDF5 Data Model, Programming Model and Library APIs HDF and HDF-EOS Workshop VIII October 26, 2004.
December 1, 2005HDF & HDF-EOS Workshop IX P eter Cao, NCSA December 1, 2005 Sponsored by NLADR, NFS PACI Project in Support of NCSA-SDSC Collaboration.
Page 1 Status of HDF-EOS, Related Software, and Tools Abe Taaheri, Raytheon IIS HDF & HDF-EOS Workshp XIII Riverdale, MD November 4, 2009.
The HDF Group HDF5 Tools Updates Peter Cao, The HDF Group September 28-30, 20101HDF and HDF-EOS Workshop XIV.
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,
1 HDF-EOS Status, Related Tools and Issues. 2 Overview.
NDE XML Tailoring Service HDF and HDF-EOS Workshop XIII November 4, 2009 Tom Feroli, Peter MacHarrie.
The HDF Group HDF/HDF-EOS Workshop XV1 Tools to Improve the Usability of NASA HDF Data Kent Yang and Joe Lee The HDF Group April 17, 2012.
1 Introduction to HDF5 Data Model, Programming Model and Library APIs HDF and HDF-EOS Workshop IX November 30, 2005.
Page 1 TOOLKIT / HDF-EOS Status and Development Abe Taaheri, Raytheon IIS Aura DSWG meeting October 2007.
1 Error Handling Interface HDF-EOS Workshop IX Quincey Koziol and Ray Lu 30 Nov 2005.
EARTH SCIENCE MARKUP LANGUAGE Tutorial on how to write an ESML Description File (for ESML Schema v3.0) “Define Once Use Anywhere” INFORMATION TECHNOLOGY.
The HDF Group Data Interoperability The HDF Group Staff Sep , 2010HDF/HDF-EOS Workshop XIV1.
The HDF Group Introduction to netCDF-4 Elena Pourmal The HDF Group 110/17/2015.
1 Status of HDF-EOS, Related Software and Tools. 2 TOOLKIT / HDF-EOS Support.
HDF5 Q4 Demo. Architecture Friday, May 10, 2013 Friday Seminar2.
Lecture 13: Arrays, Pointers, Code examples B Burlingame 2 Dec 2015.
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.
CMSC 104, Version 8/061L25Strings.ppt Strings Topics String Libraries String Operations Sample Program Reading Sections
1 Pointers: Parameter Passing and Return. 2 Passing Pointers to a Function Pointers are often passed to a function as arguments  Allows data items within.
The HDF Group 10/17/151 Introduction to HDF5 ICALEPCS 2015.
The HDF Group The HDF Group Q5 Demo 5.6 HDF5 Transaction API 5.7 Full HDF5 Dynamic Data Structure 1Copyright © 2013 The HDF Group. All.
1 Introduction to HDF5 Programming and Tools Boeing September 19, 2006.
NetCDF Data Model Details Russ Rew, UCAR Unidata NetCDF 2009 Workshop
HDF/HDF-EOS Meeting Oct th 2008, Aurora CO Proposal for adding Named Dimensions to HDF5 Arrays Daniel Kahn Science Systems and Applications, Inc.
SCP1103 Basic C Programming SEM1 2010/2011 Arithmetic Expressions Week 5.
HDF Product Designer: Using Templates to Achieve Interoperability
Adding CF Attributes to an HDF5 File
Strings CSCI 112: Programming in C.
Transition from HDF4 to HDF5: Issues
INC 161 , CPE 100 Computer Programming
HDF-EOS to GeoTIFF Conversion Tool & HDF-EOS Plug-in for HDFView
Introduction to HDF5 Session Four Java Products
Objectives Identify the built-in data types in C++
Introduction to C Programming Language
Arrays in C.
Programming Languages and Paradigms
CSCI206 - Computer Organization & Programming
Introduction to HDF5 for HDF4 users
C Stuff CS 2308.
Engr 0012 (04-1) LecNotes
IPC144 Week 10 – Lesson 2 Working with Files
HDF-EOS to GeoTIFF Conversion Tool & HDF-EOS Plug-in for HDFView
Introduction to HDF5 Mike McGreevy The HDF Group
Moving applications to HDF
HDF5 Performance Enhancements with the Elimination of Unlimited Dimension Debbie Mao, Daniel Ziskin, Merritt Deeter, Sara Martinez-alonso MOPITT is an.
ECE 103 Engineering Programming Chapter 51 Random Numbers
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
Strings #include <stdio.h>
Programming Languages and Paradigms
Files Chapter 8.
Presentation transcript:

Dimension Scales in HDF-EOS2 & HDF-EOS5 Abe Taaheri, Raytheon IIS HDF & HDF-EOS Workshop XIV Champaign, IL Sep. 29, 2010 1 of #page

What is a Dimension Scale ? Dimension Scales & Metadata Dimension Scales APIs he2 he5 Code example Writing (he2, he5) Reading (he2, he5) Sample he2 and he5 files with Dimension Scales

What is a Dimension Scale? It is a sequence of numbers placed along a dimension to demarcate intervals along it HDF4 It is an array with size and name similar to its assigned dimension Stored using a structure similar to the SDS array One scale is assigned per dimension

* What is a Dimension Scale? HDF5 A HDF5 dataset. With additional metadata that identifies the dataset as a Dimension Scale Typically Dimension Scales are logically associated with the dimensions of HDF5 Datasets The meaning of the association is left to applications. * Pedro Vicente talk, HDF/ HDF-EOS Workshop IX 1 of #page

3 Dimension Scales Datasets Example: 3D dataset 3 Dimension Scales Datasets 5 Dataset: 3D Array with 5 x 7 x 10 dimensions 7 10 1 of #page

More on Dimension Scale in HDF5 A dimension scale is not required to be a 1-D array, or to have a specific datatype A dataset dimension can have more than 1 associated dimension scale A Dimension Scale can be shared by two or more Dataset dimensions 1 of #page

Example: 3D dataset in HDF5 Several Dimension Scales Datasets Dataset: 3D Array with 5 x 7 x 10 dimensions 1 of #page

HDF5 Dimension Scale Metadata When the Dimension Scale is associated with a dimension of a Dataset, the association is represented by attributes of the two datasets. The following dataset attributes are used to describe dimension scale datasets: Attribute named “CLASS” with the value “DIMENSION_SCALE” Optional attribute named “NAME” Attribute references to any associated Dataset 1 of #page

SDsetdimstrs(): label, unit, format SDgetdimstrs() HDF5 Since Version 4.0 ? SDsetdimscale() SDgetdimscale() SDsetdimstrs(): label, unit, format SDgetdimstrs() HDF5 Since Version 1.8 H5DSset_scale() H5DSattach_scale(), H5DSdetach_scale() H5DSset_label(), H5DSget_label() A few more APIs 1 of #page

HDF Augmentation Tool Augmentation Tool adds HDF5 Dimension Scales inside the file so that netCDF-4 APIs can access the data

Added a few routines to HDF-EOS2 to create dimension scales like HDF4 Version 2.17 Added a few routines to HDF-EOS5 to create dimension scales like those added by the HDF Augmentation Tool Version 1.13

HDF-EOS2 APIs

Name: SWsetdimscale Signature: intn SWsetdimscale( int32 swathID, char *fieldname, char *dimname, int32 dimsize, int32 numbertype, VOIDP data) Purpose: Sets dimension scale for a given dimension

Name: SWgetdimscale Signature: intn SWgetdimscale( int32 swathID, char *fieldname, char *dimname, int32 *dimsize, int32 *numbertype, VOIDP data) Purpose: Gets dimension scale for a given dimension

Name: SWsetdimstrs Signature: intn SWsetdimstrs( int32 swathID, char *fieldname, char *dimname, char *label, char *unit, char *format) Purpose: Sets the label, unit, and format strings for a given dimension

Name: SWgetdimstrs Signature: intn SWgetdimstrs( int32 swathID, char *fieldname, char *dimname, char *label, char *unit, char *format, intn len) Purpose: Gets the label, unit, and format strings for a given dimension

Similar APIs for Dimension Scales in Grid Fields

HDF-EOS5 APIs

Name: HE5_SWsetdimscale Signature: herr_t HE5_SWsetdimscale( hid_t swathID, char *fieldname, char *dimname, const hsize_t dimsize, hid_t numbertype, void * data) Purpose: Sets dimension scale for a field dimension within the swath

Name: HE5_SWgetdimscale Signature: long HE5_SWgetdimscale( hid_t swathID, char *fieldname, char *dimname, hsize_t *dimsize, hid_t *numbertype, void * data) Purpose: Gets dimension scale for a field dimension within the swath

Name: HE5_SWwritedscaleattr Signature: herr_t HE5_SWwritedscaleattr( hid_t swathID, const char *dimname, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf) Purpose: Writes/Updates a dimension scale attribute in a specific swath

Name: HE5_SWreaddscaleattr Signature: herr_t HE5_SWreaddscaleattr( hid_t swathID, const char *dimname, const char *attrname, void *datbuf) Purpose: Reads a dimension scale attribute from a specific dimension

Name: HE5_SWinqdscaleattrs Signature: Long HE5_SWinqdscaleattrs( hid_t swathID, const char *dimname, char *attrnames, long *strbufsize) Purpose: Retrieve information about the attributes defined

Name: HE5_SWdscaleattrinfo Signature: herr_t HE5_SWdscaleattrinfo( hid_t swathID, const char *dimname, const char *attrname, hid_t *ntype, hsize_t *count) count : Number of attribute elements Purpose: Returns information about attribute(s) in a specific dimension scale

Similar APIs for Dimension Scales in Grid Zonal Average

Code Examples

Writing Code Example (HDF-EOS2) #include "hdf.h" #include "HdfEosDef.h" int main() { intn status, i; int32 swfid, SWid; int32 nbands, nGeoTrack; int32 bands[15]={3,6,9,12,15,18,23,26,29,32,33,34,36,37,39}; char label[16]; char unit[16]; char format[16]; float dataGeoTrack[20]; swfid = SWopen ( "SwathFile.hdf", DFACC_RDWR ); SWid = SWattach ( swfid, "Swath1“ );

for (i=0; i<20; i++) { dataGeoTrack[i] = (float) I; } nGeoTrack = 20; for (i=0; i<20; i++) { dataGeoTrack[i] = (float) I; } status = SWsetdimscale ( SWid, "Temperature", "GeoTrack", nGeoTrack, DFNT_FLOAT32, dataGeoTrack ); nbands = 15; status = SWsetdimscale ( SWid, "Spectra", "Bands", nbands, DFNT_INT32, bands ); strcpy (label, "Bands"); strcpy (unit, "none"); strcpy (format, "I2"); status = SWsetdimstrs ( SWid, "Spectra", "Bands", label, unit, format ); SWdetach ( SWid ); SWclose ( swfid ); return 0; }

Writing Code Example (HDF-EOS5) #include <HE5_HdfEosDef.h> int main() { herr_t status = FAIL; hid_t swfid = FAIL; hid_t SWid1 = FAIL; int data[15]={1,2,3,6,9,12,15,18,23,26,29,32, 33,34,35}; char label[16], unit[16], format[16]; int nbands; hsize_t count[3]; swfid = HE5_SWopen ( "Swath.h5", H5F_ACC_RDWR ); SWid1 = HE5_SWattach ( swfid, "Swath1“ );

nbands = 15; status = HE5_SWsetdimscale ( SWid1, "Spectra", "Bands", nbands, H5T_NATIVE_INT, (void *)data ); strcpy(label, "Bands Dim"); strcpy(unit, "None"); strcpy(format, "I2"); count[0]= 12; status = HE5_SWwritedscaleattr ( SWid1, "Bands", "label", H5T_NATIVE_CHAR, count, label ); count[0]= 6; status = HE5_SWwritedscaleattr ( SWid1, "Bands", "unit", H5T_NATIVE_CHAR, count, unit ); count[0]= 4; status = HE5_SWwritedscaleattr ( SWid1, "Bands", "format", H5T_NATIVE_CHAR, count, format );

int datbuf_i1[1] = {-999}; count[0]= 1; status = HE5_SWwritedscaleattr ( SWid1, "Bands", "MissingValue", H5T_NATIVE_INT, count, datbuf_i1 ); int datbuf_i2[3] = {-999, 0, 999}; count[0]= 3; status = HE5_SWwritedscaleattr(SWid1, "Bands", "IntValues", H5T_NATIVE_INT, count, datbuf_i2 ); HE5_SWdetach ( SWid1 ); HE5_SWclose ( swfid ); return 0; }

Reading Code Example (HDF-EOS2) #include "hdf.h" #include "HdfEosDef.h" Int main() { intn status, i; int32 swfid, SWid; int32 *datbuf_int32; int32 nbands, data_type, dimsize, dimsize1; intn len, buffsize; char label[16], unit[16], format[16]; swfid = SWopen ( "SwathFile.hdf", DFACC_RDWR ); SWid = SWattach ( swfid, "Swath1“ ); /* get Bands */ dimsize = SWdiminfo ( SWid, "Bands“ ); buffsize = SWgetdimscale ( SWid, "Spectra", "Bands", &dimsize1, &data_type, NULL );

datbuf_int32 = (int32 *) malloc(buffsize); buffsize = SWgetdimscale ( SWid, "Spectra", "Bands", &dimsize1, &data_type, (void *)datbuf_int32 ); for (i=0; i<dimsize; i++) { printf("i = %d datbuf_int32 = %d\n", i, datbuf_int32[i]); } /* get str attributes of Bands*/ len = 15; status = SWgetdimstrs ( SWid, "Spectra", "Bands", label, unit, format, len ); printf(" \t\tlabel = %s unit = %s format = %s \n\n", label, unit, format); free(datbuf_int32); datbuf_int32 = NULL; SWdetach ( SWid ); SWclose ( swfid ); return 0; }

Reading Code Example (HDF-EOS5) #include <HE5_HdfEosDef.h> int main() { herr_t status = FAIL; hid_t swfid = FAIL, SWid = FAIL, numtype; int i,j, bufsize; int *databuff; long nattr, strbufsize; char *attrlist, *attrname = (char *)NULL; size_t fldnmlen[HE5_HDFE_NAMBUFSIZE]; char *fldnm[HE5_HDFE_NAMBUFSIZE]; hid_t *ntype; hsize_t count = 0; void *attr; int *attr_int; float *attr_flt; char *attr_char; hsize_t dimsize; swfid = HE5_SWopen ( "Swath.h5", H5F_ACC_RDWR ); SWid = HE5_SWattach ( swfid, "Swath1“ );

bufsize = HE5_SWgetdimscale ( SWid, "Spectra", "Bands", &dimsize, bufsize = HE5_SWgetdimscale ( SWid, "Spectra", "Bands", &dimsize, &numtype, NULL ); databuff = (int *) malloc(bufsize ); bufsize = HE5_SWgetdimscale ( SWid, "Spectra", "Bands", &dimsize, &numtype, (void *)databuff ); for( i = 0; i < dimsize; i++) { printf ("DscaleVal[%d] = %d\n",i,databuff[i] ); } nattr = HE5_SWinqdscaleattrs ( SWid, "Bands", NULL, &strbufsize ); attrlist = (char *) calloc(strbufsize + 1, sizeof(char)); nattr = HE5_SWinqdscaleattrs ( SWid, "Bands", attrlist, &strbufsize ); nattr = HE5_EHparsestr(attrlist, ',', fldnm, fldnmlen);

for( i = 0; i < nattr; i++) { attrname = (char *) calloc(fldnmlen[i] + 1, sizeof(char) ); memmove ( attrname,fldnm[i],fldnmlen[i] ); ntype = (hid_t *) calloc(1, sizeof(hid_t)); if ( strcmp ( attrname, "REFERENCE_LIST") == 0 ) continue; status = HE5_SWdscaleattrinfo ( SWid,"Bands", attrname, ntype, &count ); if( (int)*ntype == 0) { attr_int = (int *) malloc(count*sizeof(int)); attr = (void *) attr_int; } if( (int)*ntype == 10) { attr_flt = (float *) malloc(count*sizeof(float)); attr = (void *) attr_flt; } if( (int)*ntype == 57) { attr_char = (char *) malloc((count+1)*sizeof(char)); attr = (void *) attr_char; } status = HE5_SWreaddscaleattr ( SWid,"Bands", attrname, attr ); printf("\tAttribute Name: %s \n",attrname); printf("\tNumber of attr elem: %lu \n", (unsigned long)count); printf("\tData type of attribute: %d \n", (int)*ntype);

if( (int)*ntype == 0) { attr_int = (int *) attr; for (j = 0; j < count; j++) { printf("\tAttrvalue[%d]: %d \n", j,attr_int[j]); } } if( (int)*ntype == 10) { attr_flt = (float *) attr; for (j = 0; j < count; j++) { printf("\tAttrvalue[%d]: %f \n", j,attr_flt[j]); } if( (int)*ntype == 57) { attr_char = (char *) attr; attr_char[count]='\0'; printf("\tAttrvalue: %s \n", attr_char); free ( attr_char ); HE5_SWdetach ( SWid ); HE5_SWclose ( swfid ); return 0;

Test File content (he2) HDFView 2.4: uses plug-in with hdf-eos5-1.11, Hdfeos2.15, HDF4.2r3, HDF5-1.6.7

Test File content (he5) HDFView 2.4: uses plug-in with hdf-eos5-1.11, Hdfeos2.15, HDF4.2r3, HDF5-1.6.7

Test File content (he5) HDFView 2.6: Without plug-in HDF4.2r4, HDF5-1.8.3

Test File content (he5) HDFView 2.6: uses plug-in with hdf-eos5-1.12, Hdfeos2.16, HDF4.2r4, HDF5-1.8.3

File content (HIRDLS he5) HIRDLS he5 Modified with HDF Augmentation Tool

Suggestions? Do we need new APIs ? Improvements for existing APIs ? What else?

Thank You!