HDFView and HDF Java Products

497 views

Published on

This tutorial will introduce the three levels of the HDF-Java products: the HDF-Java wrapper (or Java Native Interfaces to the standard HDF libraries), the HDF-Java object package, and the HDFView. The Java wrapper provides standard Java APIs that allow applications to call the C HDF libraries from Java. The HDF-Java object package implements HDF data objects, e.g. Groups and Datasets, in an object-oriented form and makes it easy for applications to use the libraries. The HDFView is a visual tool for browsing and editing HDF4 and HDF5 files.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
497
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

HDFView and HDF Java Products

  1. 1. HDF-Java Products Peter Cao The HDF Group HDF and HDF-EOS Workshop XII October 15, 2008 October 15-17, 2008 HDF and HDF-EOS Workshop XII 1
  2. 2. What are the HDF-Java products? HDF-Java HDF Java Wrapper October 15-17, 2008 Object Package HDF and HDF-EOS Workshop XII Viewer Editor 2
  3. 3. Java Wrapper HDF October 15-17, 2008 HDF and HDF-EOS Workshop XII 3
  4. 4. Java Wrapper Pure Java Library HDF Java Native Interface a programming framework that allows Java code to call and be called by applications and libraries written in other languages HDF October 15-17, 2008 HDF and HDF-EOS Workshop XII 4
  5. 5. Pure Java Library • Pros: − True platform independence − Direct access to file (no data conversion between C and Java) Pure Java Library • Cons: HDF October 15-17, 2008 − Substantial amount of work to implement − Hard to maintain (new features or format changes) HDF and HDF-EOS Workshop XII 5
  6. 6. HDF JNI • Pros: HDF Java Native Interface HDF October 15-17, 2008 − Easy to implement − Easy to maintain • Cons: − Requires data conversion between C and Java − HDF JNI is platform dependent HDF and HDF-EOS Workshop XII 6
  7. 7. Java Wrapper Java Native Interface HDF October 15-17, 2008 libjhdf.so (or dll) libjhdf5.so (or dll) HDF4 library HDFLibrary.java H5.java HDF5 library HDF and HDF-EOS Workshop XII 7
  8. 8. Java Wrapper: C versus Java hid_t H5Fcreate ( const char *name, unsigned flags, hid_t create_id, hid_t access_id ); public static native int H5Fcreate ( String name, int flags, int create_id, int access_id); hid_t H5Fopen ( const char *name, unsigned flags, hid_t access_id ); public static native int H5Fopen ( String name, int flags, int access_id); herr_t H5Fclose ( hid_t file_id ); public static native int H5Fclose ( int file_id); C October 15-17, 2008 Java HDF and HDF-EOS Workshop XII 8
  9. 9. Object Package HDF-Java HDF Java Wrapper October 15-17, 2008 Object Package HDF and HDF-EOS Workshop XII Viewer Editor 9
  10. 10. Java Wrapper: simple dataset read int fid, did, sid, tid, rank; long dims[], maxDims[]; Object theData; fid = H5.H5Fopen( fname, HDF5Constants.H5F_ACC_RDWR, did = H5.H5Dopen(fid, dname); sid = H5.H5Dget_space(did); tid = H5.H5Dget_type(did); rank = H5.H5Sget_simple_extent_ndims(sid); HDF5Constants.H5P_DEFAULT ); dims = new long[rank]; maxDims = new long[rank]; H5.H5Sget_simple_extent_dims(sid, dims, maxDims); theData = allocateArray(tid, dims); H5.H5Dread( did, tid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, theData); H5.H5Sclose(sid); H5.H5Tclose(tid); H5.H5Dclose(did); H5.H5Fclose(fid); October 15-17, 2008 HDF and HDF-EOS Workshop XII 10
  11. 11. Object Package: the easy way theData = Dataset.read(); October 15-17, 2008 HDF and HDF-EOS Workshop XII 11
  12. 12. Object Package: main purposes • Simplifies access to HDF files • Separates applications from libraries − Modular design − Client server model • Makes testing and maintenance easy October 15-17, 2008 HDF and HDF-EOS Workshop XII 12
  13. 13. Object Package: levels of objects Abstract classes Implementation October 15-17, 2008 Common Objects ncsa.hdf.object jhdfobj.jar HDF4 ncsa.hdf.object.h4 jhdf4obj.jar HDF and HDF-EOS Workshop XII HDF5 ncsa.hdf.object.h5 jhdf5obj.jar 13
  14. 14. Object Package: abstract classes FileFormat HObject Dataset Group ScalarDS October 15-17, 2008 HDF and HDF-EOS Workshop XII CompoundDS 14
  15. 15. Object Package: HDF4 implementation Group H4Group ScalarDS H4SDS H4GRImage CompounDS H4Vdata H4File FileFormat October 15-17, 2008 HDF and HDF-EOS Workshop XII 15
  16. 16. Object Package: HDF5 implementation Group ScalarDS H5Group H5ScalarDS CompounDS H5CompoundDS H5File FileFormat October 15-17, 2008 HDF and HDF-EOS Workshop XII 16
  17. 17. Object Package: file create import ncsa.hdf.object.*; public class H5FileCreate { private static String fname = "H5FileCreate.h5"; public static void main( String args[] ) throws Exception { FileFormat fileFormat = FileFormat.getFileFormat(FileFormat.FILE_TYPE_HDF5); fileFormat.createFile(fname, FileFormat.FILE_CREATE); } } October 15-17, 2008 HDF and HDF-EOS Workshop XII 17
  18. 18. HDFView HDF-Java HDF Java Wrapper October 15-17, 2008 Object Package HDF and HDF-EOS Workshop XII Viewer Editor 18
  19. 19. HDFView: basic components October 15-17, 2008 HDF and HDF-EOS Workshop XII 19
  20. 20. HDFView: GUI components TreeView HDFView (GUI) MetaDataView UserImp UserImp TableView ImageView TextView UserImp UserImp UserImp October 15-17, 2008 HDF and HDF-EOS Workshop XII 20
  21. 21. HDFView: all together October 15-17, 2008 HDF and HDF-EOS Workshop XII 21
  22. 22. What are the HDF-Java products? HDF-Java HDF Java Wrapper October 15-17, 2008 Object Package HDF and HDF-EOS Workshop XII Viewer Editor 22
  23. 23. Thank You! This report is based upon work supported in part by a Cooperative Agreement with the National Aeronautics and Space Administration (NASA) under NASA Awards NNX06AC83A and NNX08AO77A. 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. October 15-17, 2008 HDF and HDF-EOS Workshop XII 23
  24. 24. Questions/comments? October 15-17, 2008 HDF and HDF-EOS Workshop XII 24

×