Re: [visad] help

Some sample snippet to read kalpana-1 hdf5 dataset using NCSA hdf5 library:

public Test(String filename) throws HDF5Exception, Exception {

        H5File h5File = new H5File(filename, FileFormat.READ);
        int id =;
H5Group rootGroup = (H5Group) ((DefaultMutableTreeNode) h5File.getRootNode()).getUserObject();
        List<HObject> member_list = rootGroup.getMemberList();
        H5Group vhrr_group = null;
        for (int i = 0; i < member_list.size(); i++) {
            HObject member = member_list.get(i);
            if (member.getName().equals("VHRR")) {
                vhrr_group = (H5Group) member;
        List<HObject> vhrr_members = vhrr_group.getMemberList();
        H5Group image_data_group = null;
        for (int i = 0; i < vhrr_members.size(); i++) {
            HObject vhrr_member = vhrr_members.get(i);
            if (vhrr_member.getName().equals("Image Data")) {
                image_data_group = (H5Group) vhrr_member;
List<HObject> image_data_members = image_data_group.getMemberList();
        H5ScalarDS tir_ds = null;
        for (int i = 0; i < image_data_members.size(); i++) {
            HObject image_data_member = image_data_members.get(i);
            if (image_data_member.getName().equals("VHRR_TIR")) {
                tir_ds = (H5ScalarDS) image_data_member;
        short[] tir_data =(short[]);
        long dims[] = tir_ds.getDims();
        int scans = (int) dims[0];
        int pixels = (int) dims[1];


Now you have got the samples and dimensions of dataset, now you can create a visad data object using
that. You can check any of the examples bundled with visad library.

I think you can start from here...
As far as library settings are concerned.
You should have all java-hdf jars in your project.

and dll(for windows) and .so (for linux) in LD_LIBRARY_PATH.

I hope it helps

One more point, being a JNI library this should be relatively performance wise faster as compared to netcdf-java which is pure java library.


On 03/25/2014 11:30 PM, visad-request@xxxxxxxxxxxxxxxx wrote:
Send visad mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of visad digest..."

Today's Topics:

    1. Re: help (Tom Whittaker)
    2. Re: help (Curtis Rueden)
    3. Re: help (Tom Whittaker)


Message: 1
Date: Tue, 25 Mar 2014 09:12:12 -0500
From: Tom Whittaker<whittaker@xxxxxxxx>
To: Devanshi Prajapati<prajapati.devanshi@xxxxxxxxx>
Cc: "visad@xxxxxxxxxxxxxxxx"<visad@xxxxxxxxxxxxxxxx>
Subject: Re: [visad] help
Content-Type: text/plain; CHARSET=US-ASCII

I believe the main issue here is that the code in the VisAD library
for HDF files has not been maintained by the original authors.  This
also is true of the netCDF adapter ("Plain").  Unfortunately, this
means that for files that use newer features in these formats, the
code no longer works.

I do not have any solutions, other than as Ghansham suggests, using
the "official" releases of the respective libraries and then building
your own VisAD Data objects...


On Fri, Mar 21, 2014 at 3:14 AM, Devanshi Prajapati
<prajapati.devanshi@xxxxxxxxx>  wrote:
Hi.......This is my program,

package myapp;

import java.rmi.RemoteException;
import visad.DataImpl;
import visad.VisADException;
import ncsa.hdf.hdf5lib.*;

public final class hfAdapter2
{  String filePath;
     public hfAdapter2() throws VisADException, RemoteException
         HDF5Form h=new HDF5Form();
     public static void main(String[] args)
     throws RemoteException, VisADException, IOException
     {      new hfAdapter2();
And the Error I got is,

Exception in thread "main" java.lang.UnsatisfiedLinkError:
at ncsa.hdf.hdf5lib.H5.H5Fopen(Native Method)
at myapp.hfAdapter2.<init>(
at myapp.hfAdapter2.main(
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Devanshi U. Prajapati

visad mailing list
For list information, to unsubscribe, visit:

  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: