Re: [visad] netcdfFile Error

Hello Sir,
The output of ncFile is :

ncFilenetcdf
F:\Devanshi\Input\MT1SAPS_1.06_000_9_16_I_2014_01_26_01_04_37_2014_01_26_01_60_05_11823_11824_122_87_88_BL1_00_GP_1.00_L2A.h5
{

 Group ScienceData {
   variables:
     short Latitude(4230, 182);
       :IMAGE_MINMAXRANGE = 1183US, 6741US; // short
       :Long_Name = "Latitude";
       :Standard_Name = "Latitude";
       :Comments = "Latitude_Value";
       :Units = "degree";
       :Dimensional_Label = "Number_of_scans,Number_of_Samples";
       :Valid_Range = "[-40.0,40.0]";
       :Fill_Value = "65535";
       :Scale_Factor = "0.01";
       :Add_Offset = "-40.0";
       :CLASS = "IMAGE";
       :IMAGE_SUBCLASS = "IMAGE_GRAYSCALE";
       :_lastModified = "2014-01-26T03:31:29Z";
       :_Unsigned = "true";

     short Longitude(4230, 182);
       :IMAGE_MINMAXRANGE = 0US, -29536US; // short
       :Long_Name = "Longitude";
       :Standard_Name = "Longitude";
       :Comments = "Longitude_Value";
       :Units = "degree";
       :Dimensional_Label = "Number_of_scans,Number_of_Samples";
       :Valid_Range = "[0.0,360.0]";
       :Fill_Value = "65535";
       :Scale_Factor = "0.01";
       :Add_Offset = "0.0";
       :CLASS = "IMAGE";
       :IMAGE_SUBCLASS = "IMAGE_GRAYSCALE";
       :_lastModified = "2014-01-26T03:31:29Z";
       :_Unsigned = "true";

when I tru to read Latitude ,still null is coming.


On Thu, Mar 27, 2014 at 9:39 AM, <visad-request@xxxxxxxxxxxxxxxx> wrote:

> Send visad mailing list submissions to
>         visad@xxxxxxxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> or, via email, send a message with subject or body 'help' to
>         visad-request@xxxxxxxxxxxxxxxx
>
> You can reach the person managing the list at
>         visad-owner@xxxxxxxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of visad digest..."
>
>
> Today's Topics:
>
>    1. Re: help (Ghanshyam Sangar)
>    2. Re: help (Ghansham Sangar)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 27 Mar 2014 00:55:48 -0000
> From: "Ghanshyam Sangar" <ghansham@xxxxxxxxxxxxxxx>
> To: <visad@xxxxxxxxxxxxxxxx>
> Subject: Re: [visad] help
> Message-ID: <twig.1395881748.37147@xxxxxxxxxxxxxxxxxxx >
>
> Hi devanshi
>
> You are pretty close.
> Can you just send me the output of
> the statement:
> System.out.println(ncFile);
> ghansham
>
>
>
>
> On Thu, Mar 27, 2014, visad-request@xxxxxxxxxxxxxxxx said:
>
> > Send visad mailing list submissions to
> >       visad@xxxxxxxxxxxxxxxx
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >       http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> > or, via email, send a message with subject or body 'help' to
> >       visad-request@xxxxxxxxxxxxxxxx
> >
> > You can reach the person managing the list at
> >       visad-owner@xxxxxxxxxxxxxxxx
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of visad digest..."
> >
> >
> > Today's Topics:
> >
> >    1. Re: Error reading h5 file using NetcdfFile class
> >       (Devanshi Prajapati)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Thu, 27 Mar 2014 01:10:00 +0530
> > From: Devanshi Prajapati <prajapati.devanshi@xxxxxxxxx>
> > To: "visad@xxxxxxxxxxxxxxxx" <visad@xxxxxxxxxxxxxxxx>
> > Subject: Re: [visad] Error reading h5 file using NetcdfFile class
> > Message-ID:
> >       <
> CAH3DJ6L4KO84O_Rb5AkuMYHFhjnJ0gOs0Zwrq-pOpRYFatqunw@xxxxxxxxxxxxxx>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hello and thank you all for reply ,
> >
> > Ghansham Sir, Yes I am trying with Megha-Tropiques dataset.
> >
> > And reading the group, ScienceData, was my last attemp,as I have already
> > tried the same with "Latitude"(var2 in coding),"Longitude" and other
> > variables.
> > So, passing var2 while getting Dimension,I get the same error.
> >
> > And all that variable names with detailed information is displayed by
> > printing the ncFile vaiable(Line No:3 which is in comment),
> >  but when I pass it to the Variable class, or trying to getDimension
> gives
> > me a null value.
> >
> >
> > *And the code is,*
> >
> > import java.io.IOException;
> >
> > import ucar.ma2.Array;
> >
> > import ucar.nc2.Dimension;
> >
> > import ucar.nc2.NetcdfFile;
> >
> > import ucar.nc2.Variable;
> >
> >
> >
> > public class Netcdf_readh5
> >
> > {
> >
> >     String filePath;
> >
> >     int scans=0;
> >
> >
> >
> >     public Netcdf_readh5() throws IOException
> >
> >     {
> >
> >          filePath="F:\\img1.h5";
> >
> >                 NetcdfFile  ncFile = NetcdfFile.open(filePath);
> >
> >         System.out.println(ncFile);
> >
> >
> >
> >          Variable var2 = ncFile.findVariable("Latitude");
> >
> >
> >
> >         Dimension d=var1.getDimension(0);
> >
> >         System.out.println(d.getFullName());
> >
> >
> >
> >      }
> >
> >     public static void main(String args[]) throws IOException
> >
> >     {        new Netcdf_readh5();
> >
> >     }   }
> >
> >
> >
> > /*
> >
> > On Wed, Mar 26, 2014 at 11:30 PM, <visad-request@xxxxxxxxxxxxxxxx>
> wrote:
> >
> >> Send visad mailing list submissions to
> >>         visad@xxxxxxxxxxxxxxxx
> >>
> >> To subscribe or unsubscribe via the World Wide Web, visit
> >>         http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> >> or, via email, send a message with subject or body 'help' to
> >>         visad-request@xxxxxxxxxxxxxxxx
> >>
> >> You can reach the person managing the list at
> >>         visad-owner@xxxxxxxxxxxxxxxx
> >>
> >> When replying, please edit your Subject line so it is more specific
> >> than "Re: Contents of visad digest..."
> >>
> >>
> >> Today's Topics:
> >>
> >>    1. Re: help (Ghansham Sangar)
> >>    2. Re: help (Ghansham Sangar)
> >>
> >>
> >> ----------------------------------------------------------------------
> >>
> >> Message: 1
> >> Date: Wed, 26 Mar 2014 09:14:39 +0530
> >> From: Ghansham Sangar <ghansham@xxxxxxxxxxxxxxx>
> >> To: visad@xxxxxxxxxxxxxxxx
> >> Subject: Re: [visad] help
> >> Message-ID: <53324D27.2010809@xxxxxxxxxxxxxxx>
> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >>
> >> Hi all....
> >>
> >>
> >> Well McV and IDV have lots of code demonstrating that.
> >>
> >> IDV goes one step further to use ucar.n2.dataset.grid.GridDataset which
> >> uses NetcdfFile class to create grids
> >> which it further connects with visad using
> >> ucar.visad.data.GeoGridFlatField. That is pretty complicated in the
> sense,
> >>   you know how to extend the ucar.nc2.dataset.CoordSysBuilder to insert
> >> your dataset file in that.
> >> In McV, it is plain NetcdfFile class being used almost in the new
> >> development may be related to S-NPP datasources
> >> or even the Hydra stuff. The new incarnation of Hydra (Hydra 2), uses
> >> McV code based for creating Multispectral datasources
> >> for calipso, cloudsat, modis, etc.
> >>
> >> Coming back to what Devanshi is concerned about. Actually as far  as I
> >> know she is trying with Meghatropiques dataset.
> >> It is a very special satellite as it provides all the acquisitions in
> >> tropical region specifically dedicated to study the water cycle of
> >> tropical region. It is collaboration between ISRO and CNES.
> >>
> >>
> >> I would suggest Devanshi, you should just first try to see how you are
> >> reading variables. The code snippet that you sent,
> >> in that you are reading the "Science Data" as a variable but it is
> >> group. You should first try the following method:
> >>
> >> List<Variable> var_list = ncFile.getVariables();
> >>
> >> It gives the list of all the variables in the hdf-5 file.
> >> Then you can pick the variable of interest from that list and apply
> >> float samples[] = variable.read(float.class); //assuming data type is
> float
> >>
> >> I hope it helps.
> >>
> >> Ghansham
> >>
> >>
> >> On 03/25/2014 11:30 PM, visad-request@xxxxxxxxxxxxxxxx wrote:
> >> > Send visad mailing list submissions to
> >> >       visad@xxxxxxxxxxxxxxxx
> >> >
> >> > To subscribe or unsubscribe via the World Wide Web, visit
> >> >       http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> >> > or, via email, send a message with subject or body 'help' to
> >> >       visad-request@xxxxxxxxxxxxxxxx
> >> >
> >> > You can reach the person managing the list at
> >> >       visad-owner@xxxxxxxxxxxxxxxx
> >> >
> >> > 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
> >> > Message-ID:
> >> >       <CAA6nkJBHXNWD=
> >> YWJ2+TWbG865GQwVXQmC4+xTEZuj2X2YSDJrg@xxxxxxxxxxxxxx>
> >> > 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...
> >> >
> >> > tom
> >> >
> >> > 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 visad.data.hdf5.HDF5Form;
> >> >> import ncsa.hdf.hdf5lib.*;
> >> >>
> >> >> public final class hfAdapter2
> >> >> {  String filePath;
> >> >>      public hfAdapter2() throws VisADException, RemoteException
> >> >>      {
> >> >>          filePath="F:\\Devanshi\\Input\\xyz.h5";
> >> >>          System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf.dll");
> >> >>
>  System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf5.dll");
> >> >>          HDF5Form h=new HDF5Form();
> >> >>          DataImpl ncData=h.open(filePath);
> >> >>      }
> >> >>      public static void main(String[] args)
> >> >>      throws RemoteException, VisADException, IOException
> >> >>      {      new hfAdapter2();
> >> >>      }
> >> >> }
> >> >> And the Error I got is,
> >> >>
> >> >> run:
> >> >> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> >> >> ncsa.hdf.hdf5lib.H5.H5Fopen(Ljava/lang/String;II)I
> >> >> at ncsa.hdf.hdf5lib.H5.H5Fopen(Native Method)
> >> >> at visad.data.hdf5.hdf5objects.HDF5File.<init>(HDF5File.java:85)
> >> >> at visad.data.hdf5.HDF5FileAdapted.<init>(HDF5FileAdapted.java:70)
> >> >> at visad.data.hdf5.HDF5Form.open(HDF5Form.java:102)
> >> >> at myapp.hfAdapter2.<init>(hfAdapter2.java:46)
> >> >> at myapp.hfAdapter2.main(hfAdapter2.java:96)
> >> >> Java Result: 1
> >> >> BUILD SUCCESSFUL (total time: 0 seconds)
> >> >>
> >> >> --
> >> >> Devanshi U. Prajapati
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> visad mailing list
> >> >> visad@xxxxxxxxxxxxxxxx
> >> >> For list information, to unsubscribe, visit:
> >> >> http://www.unidata.ucar.edu/mailing_lists/
> >> >
> >> >
> >>
> >>
> >>
> >> ------------------------------
> >>
> >> Message: 2
> >> Date: Wed, 26 Mar 2014 10:41:41 +0530
> >> From: Ghansham Sangar <ghansham@xxxxxxxxxxxxxxx>
> >> To: visad@xxxxxxxxxxxxxxxx
> >> Subject: Re: [visad] help
> >> Message-ID: <5332618D.1010408@xxxxxxxxxxxxxxx>
> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >>
> >> 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 = h5File.open();
> >>          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;
> >>                  break;
> >>              }
> >>          }
> >>          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;
> >>                  break;
> >>              }
> >>          }
> >>          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;
> >>                  break;
> >>              }
> >>          }
> >>          short[] tir_data =(short[]) tir_ds.read();
> >>          long dims[] = tir_ds.getDims();
> >>          int scans = (int) dims[0];
> >>          int pixels = (int) dims[1];
> >>          h5File.close();
> >>
> >>
> >>      }
> >>
> >>
> >> 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.
> >>
> >>
> >> Ghansham
> >>
> >>
> >>
> >>
> >> On 03/25/2014 11:30 PM, visad-request@xxxxxxxxxxxxxxxx wrote:
> >> > Send visad mailing list submissions to
> >> >       visad@xxxxxxxxxxxxxxxx
> >> >
> >> > To subscribe or unsubscribe via the World Wide Web, visit
> >> >       http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> >> > or, via email, send a message with subject or body 'help' to
> >> >       visad-request@xxxxxxxxxxxxxxxx
> >> >
> >> > You can reach the person managing the list at
> >> >       visad-owner@xxxxxxxxxxxxxxxx
> >> >
> >> > 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
> >> > Message-ID:
> >> >       <CAA6nkJBHXNWD=
> >> YWJ2+TWbG865GQwVXQmC4+xTEZuj2X2YSDJrg@xxxxxxxxxxxxxx>
> >> > 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...
> >> >
> >> > tom
> >> >
> >> > 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 visad.data.hdf5.HDF5Form;
> >> >> import ncsa.hdf.hdf5lib.*;
> >> >>
> >> >> public final class hfAdapter2
> >> >> {  String filePath;
> >> >>      public hfAdapter2() throws VisADException, RemoteException
> >> >>      {
> >> >>          filePath="F:\\Devanshi\\Input\\xyz.h5";
> >> >>          System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf.dll");
> >> >>
>  System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf5.dll");
> >> >>          HDF5Form h=new HDF5Form();
> >> >>          DataImpl ncData=h.open(filePath);
> >> >>      }
> >> >>      public static void main(String[] args)
> >> >>      throws RemoteException, VisADException, IOException
> >> >>      {      new hfAdapter2();
> >> >>      }
> >> >> }
> >> >> And the Error I got is,
> >> >>
> >> >> run:
> >> >> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> >> >> ncsa.hdf.hdf5lib.H5.H5Fopen(Ljava/lang/String;II)I
> >> >> at ncsa.hdf.hdf5lib.H5.H5Fopen(Native Method)
> >> >> at visad.data.hdf5.hdf5objects.HDF5File.<init>(HDF5File.java:85)
> >> >> at visad.data.hdf5.HDF5FileAdapted.<init>(HDF5FileAdapted.java:70)
> >> >> at visad.data.hdf5.HDF5Form.open(HDF5Form.java:102)
> >> >> at myapp.hfAdapter2.<init>(hfAdapter2.java:46)
> >> >> at myapp.hfAdapter2.main(hfAdapter2.java:96)
> >> >> Java Result: 1
> >> >> BUILD SUCCESSFUL (total time: 0 seconds)
> >> >>
> >> >> --
> >> >> Devanshi U. Prajapati
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> visad mailing list
> >> >> visad@xxxxxxxxxxxxxxxx
> >> >> For list information, to unsubscribe, visit:
> >> >> http://www.unidata.ucar.edu/mailing_lists/
> >> >
> >> >
> >>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> visad mailing list
> >> visad@xxxxxxxxxxxxxxxx
> >> For list information, to unsubscribe, visit:
> >> http://www.unidata.ucar.edu/mailing_lists/
> >>
> >> End of visad Digest, Vol 50, Issue 8
> >> ************************************
> >>
> >
> >
> >
> > --
> > Devanshi U. Prajapati
> > LJIET(MCA)
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: <
> http://mailman.unidata.ucar.edu/mailing_lists/archives/visad/attachments/20140327/d5b99098/attachment.html
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > visad mailing list
> > visad@xxxxxxxxxxxxxxxx
> > For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
> >
> > End of visad Digest, Vol 50, Issue 9
> > ************************************
> >
>
> --
>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 27 Mar 2014 09:27:19 +0530
> From: Ghansham Sangar <ghansham@xxxxxxxxxxxxxxx>
> To: visad@xxxxxxxxxxxxxxxx
> Subject: Re: [visad] help
> Message-ID: <5333A19F.1090506@xxxxxxxxxxxxxxx>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello Devanshi
>
> You need to do:
>
> ncFile.findVariable("ScienceData/Latitude");
>
> This should solve the problem.
>
> Are you working with SAC/ISRO?
>
> Ghansham
>
> On 03/27/2014 01:10 AM, visad-request@xxxxxxxxxxxxxxxx wrote:
> > Send visad mailing list submissions to
> >       visad@xxxxxxxxxxxxxxxx
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >       http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> > or, via email, send a message with subject or body 'help' to
> >       visad-request@xxxxxxxxxxxxxxxx
> >
> > You can reach the person managing the list at
> >       visad-owner@xxxxxxxxxxxxxxxx
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of visad digest..."
> >
> >
> > Today's Topics:
> >
> >     1. Re: Error reading h5 file using NetcdfFile class
> >        (Devanshi Prajapati)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Thu, 27 Mar 2014 01:10:00 +0530
> > From: Devanshi Prajapati<prajapati.devanshi@xxxxxxxxx>
> > To: "visad@xxxxxxxxxxxxxxxx"<visad@xxxxxxxxxxxxxxxx>
> > Subject: Re: [visad] Error reading h5 file using NetcdfFile class
> > Message-ID:
> >       <
> CAH3DJ6L4KO84O_Rb5AkuMYHFhjnJ0gOs0Zwrq-pOpRYFatqunw@xxxxxxxxxxxxxx>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hello and thank you all for reply ,
> >
> > Ghansham Sir, Yes I am trying with Megha-Tropiques dataset.
> >
> > And reading the group, ScienceData, was my last attemp,as I have already
> > tried the same with "Latitude"(var2 in coding),"Longitude" and other
> > variables.
> > So, passing var2 while getting Dimension,I get the same error.
> >
> > And all that variable names with detailed information is displayed by
> > printing the ncFile vaiable(Line No:3 which is in comment),
> >   but when I pass it to the Variable class, or trying to getDimension
> gives
> > me a null value.
> >
> >
> > *And the code is,*
> >
> > import java.io.IOException;
> >
> > import ucar.ma2.Array;
> >
> > import ucar.nc2.Dimension;
> >
> > import ucar.nc2.NetcdfFile;
> >
> > import ucar.nc2.Variable;
> >
> >
> >
> > public class Netcdf_readh5
> >
> > {
> >
> >      String filePath;
> >
> >      int scans=0;
> >
> >
> >
> >      public Netcdf_readh5() throws IOException
> >
> >      {
> >
> >           filePath="F:\\img1.h5";
> >
> >                  NetcdfFile  ncFile = NetcdfFile.open(filePath);
> >
> >          System.out.println(ncFile);
> >
> >
> >
> >           Variable var2 = ncFile.findVariable("Latitude");
> >
> >
> >
> >          Dimension d=var1.getDimension(0);
> >
> >          System.out.println(d.getFullName());
> >
> >
> >
> >       }
> >
> >      public static void main(String args[]) throws IOException
> >
> >      {        new Netcdf_readh5();
> >
> >      }   }
> >
> >
> >
> > /*
> >
> > On Wed, Mar 26, 2014 at 11:30 PM,<visad-request@xxxxxxxxxxxxxxxx>
>  wrote:
> >
> >> Send visad mailing list submissions to
> >>          visad@xxxxxxxxxxxxxxxx
> >>
> >> To subscribe or unsubscribe via the World Wide Web, visit
> >>          http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> >> or, via email, send a message with subject or body 'help' to
> >>          visad-request@xxxxxxxxxxxxxxxx
> >>
> >> You can reach the person managing the list at
> >>          visad-owner@xxxxxxxxxxxxxxxx
> >>
> >> When replying, please edit your Subject line so it is more specific
> >> than "Re: Contents of visad digest..."
> >>
> >>
> >> Today's Topics:
> >>
> >>     1. Re: help (Ghansham Sangar)
> >>     2. Re: help (Ghansham Sangar)
> >>
> >>
> >> ----------------------------------------------------------------------
> >>
> >> Message: 1
> >> Date: Wed, 26 Mar 2014 09:14:39 +0530
> >> From: Ghansham Sangar<ghansham@xxxxxxxxxxxxxxx>
> >> To: visad@xxxxxxxxxxxxxxxx
> >> Subject: Re: [visad] help
> >> Message-ID:<53324D27.2010809@xxxxxxxxxxxxxxx>
> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >>
> >> Hi all....
> >>
> >>
> >> Well McV and IDV have lots of code demonstrating that.
> >>
> >> IDV goes one step further to use ucar.n2.dataset.grid.GridDataset which
> >> uses NetcdfFile class to create grids
> >> which it further connects with visad using
> >> ucar.visad.data.GeoGridFlatField. That is pretty complicated in the
> sense,
> >>    you know how to extend the ucar.nc2.dataset.CoordSysBuilder to insert
> >> your dataset file in that.
> >> In McV, it is plain NetcdfFile class being used almost in the new
> >> development may be related to S-NPP datasources
> >> or even the Hydra stuff. The new incarnation of Hydra (Hydra 2), uses
> >> McV code based for creating Multispectral datasources
> >> for calipso, cloudsat, modis, etc.
> >>
> >> Coming back to what Devanshi is concerned about. Actually as far  as I
> >> know she is trying with Meghatropiques dataset.
> >> It is a very special satellite as it provides all the acquisitions in
> >> tropical region specifically dedicated to study the water cycle of
> >> tropical region. It is collaboration between ISRO and CNES.
> >>
> >>
> >> I would suggest Devanshi, you should just first try to see how you are
> >> reading variables. The code snippet that you sent,
> >> in that you are reading the "Science Data" as a variable but it is
> >> group. You should first try the following method:
> >>
> >> List<Variable>  var_list = ncFile.getVariables();
> >>
> >> It gives the list of all the variables in the hdf-5 file.
> >> Then you can pick the variable of interest from that list and apply
> >> float samples[] = variable.read(float.class); //assuming data type is
> float
> >>
> >> I hope it helps.
> >>
> >> Ghansham
> >>
> >>
> >> On 03/25/2014 11:30 PM, visad-request@xxxxxxxxxxxxxxxx wrote:
> >>> Send visad mailing list submissions to
> >>>        visad@xxxxxxxxxxxxxxxx
> >>>
> >>> To subscribe or unsubscribe via the World Wide Web, visit
> >>>        http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> >>> or, via email, send a message with subject or body 'help' to
> >>>        visad-request@xxxxxxxxxxxxxxxx
> >>>
> >>> You can reach the person managing the list at
> >>>        visad-owner@xxxxxxxxxxxxxxxx
> >>>
> >>> 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
> >>> Message-ID:
> >>>        <CAA6nkJBHXNWD=
> >> YWJ2+TWbG865GQwVXQmC4+xTEZuj2X2YSDJrg@xxxxxxxxxxxxxx>
> >>> 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...
> >>>
> >>> tom
> >>>
> >>> 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 visad.data.hdf5.HDF5Form;
> >>>> import ncsa.hdf.hdf5lib.*;
> >>>>
> >>>> public final class hfAdapter2
> >>>> {  String filePath;
> >>>>       public hfAdapter2() throws VisADException, RemoteException
> >>>>       {
> >>>>           filePath="F:\\Devanshi\\Input\\xyz.h5";
> >>>>           System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf.dll");
> >>>>
> System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf5.dll");
> >>>>           HDF5Form h=new HDF5Form();
> >>>>           DataImpl ncData=h.open(filePath);
> >>>>       }
> >>>>       public static void main(String[] args)
> >>>>       throws RemoteException, VisADException, IOException
> >>>>       {      new hfAdapter2();
> >>>>       }
> >>>> }
> >>>> And the Error I got is,
> >>>>
> >>>> run:
> >>>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> >>>> ncsa.hdf.hdf5lib.H5.H5Fopen(Ljava/lang/String;II)I
> >>>> at ncsa.hdf.hdf5lib.H5.H5Fopen(Native Method)
> >>>> at visad.data.hdf5.hdf5objects.HDF5File.<init>(HDF5File.java:85)
> >>>> at visad.data.hdf5.HDF5FileAdapted.<init>(HDF5FileAdapted.java:70)
> >>>> at visad.data.hdf5.HDF5Form.open(HDF5Form.java:102)
> >>>> at myapp.hfAdapter2.<init>(hfAdapter2.java:46)
> >>>> at myapp.hfAdapter2.main(hfAdapter2.java:96)
> >>>> Java Result: 1
> >>>> BUILD SUCCESSFUL (total time: 0 seconds)
> >>>>
> >>>> --
> >>>> Devanshi U. Prajapati
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> visad mailing list
> >>>> visad@xxxxxxxxxxxxxxxx
> >>>> For list information, to unsubscribe, visit:
> >>>> http://www.unidata.ucar.edu/mailing_lists/
> >>>
> >>
> >>
> >> ------------------------------
> >>
> >> Message: 2
> >> Date: Wed, 26 Mar 2014 10:41:41 +0530
> >> From: Ghansham Sangar<ghansham@xxxxxxxxxxxxxxx>
> >> To: visad@xxxxxxxxxxxxxxxx
> >> Subject: Re: [visad] help
> >> Message-ID:<5332618D.1010408@xxxxxxxxxxxxxxx>
> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >>
> >> 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 = h5File.open();
> >>           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;
> >>                   break;
> >>               }
> >>           }
> >>           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;
> >>                   break;
> >>               }
> >>           }
> >>           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;
> >>                   break;
> >>               }
> >>           }
> >>           short[] tir_data =(short[]) tir_ds.read();
> >>           long dims[] = tir_ds.getDims();
> >>           int scans = (int) dims[0];
> >>           int pixels = (int) dims[1];
> >>           h5File.close();
> >>
> >>
> >>       }
> >>
> >>
> >> 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.
> >>
> >>
> >> Ghansham
> >>
> >>
> >>
> >>
> >> On 03/25/2014 11:30 PM, visad-request@xxxxxxxxxxxxxxxx wrote:
> >>> Send visad mailing list submissions to
> >>>        visad@xxxxxxxxxxxxxxxx
> >>>
> >>> To subscribe or unsubscribe via the World Wide Web, visit
> >>>        http://mailman.unidata.ucar.edu/mailman/listinfo/visad
> >>> or, via email, send a message with subject or body 'help' to
> >>>        visad-request@xxxxxxxxxxxxxxxx
> >>>
> >>> You can reach the person managing the list at
> >>>        visad-owner@xxxxxxxxxxxxxxxx
> >>>
> >>> 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
> >>> Message-ID:
> >>>        <CAA6nkJBHXNWD=
> >> YWJ2+TWbG865GQwVXQmC4+xTEZuj2X2YSDJrg@xxxxxxxxxxxxxx>
> >>> 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...
> >>>
> >>> tom
> >>>
> >>> 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 visad.data.hdf5.HDF5Form;
> >>>> import ncsa.hdf.hdf5lib.*;
> >>>>
> >>>> public final class hfAdapter2
> >>>> {  String filePath;
> >>>>       public hfAdapter2() throws VisADException, RemoteException
> >>>>       {
> >>>>           filePath="F:\\Devanshi\\Input\\xyz.h5";
> >>>>           System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf.dll");
> >>>>
> System.load("F:\\Devanshi\\Projects\\MyApp\\Lib\\jhdf5.dll");
> >>>>           HDF5Form h=new HDF5Form();
> >>>>           DataImpl ncData=h.open(filePath);
> >>>>       }
> >>>>       public static void main(String[] args)
> >>>>       throws RemoteException, VisADException, IOException
> >>>>       {      new hfAdapter2();
> >>>>       }
> >>>> }
> >>>> And the Error I got is,
> >>>>
> >>>> run:
> >>>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> >>>> ncsa.hdf.hdf5lib.H5.H5Fopen(Ljava/lang/String;II)I
> >>>> at ncsa.hdf.hdf5lib.H5.H5Fopen(Native Method)
> >>>> at visad.data.hdf5.hdf5objects.HDF5File.<init>(HDF5File.java:85)
> >>>> at visad.data.hdf5.HDF5FileAdapted.<init>(HDF5FileAdapted.java:70)
> >>>> at visad.data.hdf5.HDF5Form.open(HDF5Form.java:102)
> >>>> at myapp.hfAdapter2.<init>(hfAdapter2.java:46)
> >>>> at myapp.hfAdapter2.main(hfAdapter2.java:96)
> >>>> Java Result: 1
> >>>> BUILD SUCCESSFUL (total time: 0 seconds)
> >>>>
> >>>> --
> >>>> Devanshi U. Prajapati
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> visad mailing list
> >>>> visad@xxxxxxxxxxxxxxxx
> >>>> For list information, to unsubscribe, visit:
> >>>> http://www.unidata.ucar.edu/mailing_lists/
> >>>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> visad mailing list
> >> visad@xxxxxxxxxxxxxxxx
> >> For list information, to unsubscribe, visit:
> >> http://www.unidata.ucar.edu/mailing_lists/
> >>
> >> End of visad Digest, Vol 50, Issue 8
> >> ************************************
> >>
> >
> >
>
>
>
> ------------------------------
>
> _______________________________________________
> visad mailing list
> visad@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
> End of visad Digest, Vol 50, Issue 10
> *************************************
>



-- 
Devanshi U. Prajapati
LJIET(MCA)
  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: