comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Reading HDF5 Variable
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Reading HDF5 Variable [message #42499] Mon, 14 February 2005 13:35 Go to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Michael Wallace wrote:
>> At the risk of starting a flame war, the netCDF interface (about 25
>> functions) seems to have been written by scientists for scientists,
>> while the HDF interface appears to have been written by programmers
>> for programmers (hundreds(?) of functions).
>
>
> The various problems with HDF are what led me to use netCDF. Not only
> are they written "by scientists for scientists" but much of the
> underpinnings of the format appear to have been written by "computer
> scientists rather than scientists." Issues with the format aside, I
> just like the fact that there are *stable, working* netCDF access
> routines in IDL, Java, C, Perl, Python, etc. In fact, whenever I have
> to work with HDF, the first thing I usually do is write a small
> conversion program that converts the file to netCDF and then I work with
> it from there. :-)

Hey - me too! Except rather than write a conversion program each time, I just pipe the
hdfdump[*] utility output into the ncgen utility to convert files I use. E.g.

hdfdump <hdfile> | ncgen -b <ncfile>

and I end up with a nice simple, useful netCDF file. :o)


paulv

[*] Earlier HDF libraries called this "ncdump" which was very annoying.

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Re: Reading HDF5 Variable [message #42501 is a reply to message #42499] Mon, 14 February 2005 13:19 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> At the risk of starting a flame war, the netCDF interface (about 25
> functions) seems to have been written by scientists for scientists,
> while the HDF interface appears to have been written by programmers for
> programmers (hundreds(?) of functions).

The various problems with HDF are what led me to use netCDF. Not only
are they written "by scientists for scientists" but much of the
underpinnings of the format appear to have been written by "computer
scientists rather than scientists." Issues with the format aside, I
just like the fact that there are *stable, working* netCDF access
routines in IDL, Java, C, Perl, Python, etc. In fact, whenever I have
to work with HDF, the first thing I usually do is write a small
conversion program that converts the file to netCDF and then I work with
it from there. :-)

-Mike
Re: Reading HDF5 Variable [message #42503 is a reply to message #42501] Mon, 14 February 2005 13:13 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Does anyone know if it is even *possible* to learn how
> to access a variable from an HDF5 file from the IDL
> documentation!?

No. Do not pass Go. Do not collect $200.

I always use HDF_BROWSER to create a template of the HDF file and use
that template with HDF_READ. I'm not familiar with H5_QUERY, but I'd
just go into HDF_BROWSER, select and name everything I need and let
HDF_READ do the magic of pulling the data. At least that should rule
out errors made when trying to do the extraction by hand.

-Mike
Re: Reading HDF5 Variable [message #42504 is a reply to message #42503] Mon, 14 February 2005 13:18 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Kenneth Bowman writes:

> I think the short answer is "no".
>
> At the risk of starting a flame war, the netCDF interface (about 25
> functions) seems to have been written by scientists for scientists,
> while the HDF interface appears to have been written by programmers for
> programmers (hundreds(?) of functions).
>
> Admittedly, HDF files are more flexible than netCDF files, but the user
> interface is much more complex. The HDF files that I have seen don't
> appear to use any of the features that are not in the netCDF interface.
>
> Your best bet is to find some sample code that reads your HDF files.

After I stopped panicking, I realized that the h5_browser
was written in the IDL language. 15 minutes of fooling
around with that got me what I was looking for, although
I am no further ahead with understanding the format. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Reading HDF5 Variable [message #42506 is a reply to message #42503] Mon, 14 February 2005 12:41 Go to previous messageGo to next message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <MPG.1c7a6e292d3e283e989910@news.frii.com>,
David Fanning <davidf@dfanning.com> wrote:

> Folks,
>
> Does anyone know if it is even *possible* to learn how
> to access a variable from an HDF5 file from the IDL
> documentation!?

I think the short answer is "no".

At the risk of starting a flame war, the netCDF interface (about 25
functions) seems to have been written by scientists for scientists,
while the HDF interface appears to have been written by programmers for
programmers (hundreds(?) of functions).

Admittedly, HDF files are more flexible than netCDF files, but the user
interface is much more complex. The HDF files that I have seen don't
appear to use any of the features that are not in the netCDF interface.

Your best bet is to find some sample code that reads your HDF files.

:-(

Ken


>
> I really don't have a week to figure this out. Does
> anyone have a simple example. I can see and access
> the data with H5_QUERY. But I can't make any sense
> of the palette that is suppose to be attached to the
> data. It is 976 elements long. That doesn't even
> begin to divide by 256. :-(
>
> What I am trying to do is extract a 2D image and its
> accompanying palette in order to build and save a JPEG
> file. (Typically I don't mind spending hours and hours
> researching a topic, but the FAFSA Student Aid forms
> are due today and I'm working on income taxes. :-(
>
> Thanks,
>
> David
Re: Reading HDF5 Variable [message #42598 is a reply to message #42499] Mon, 14 February 2005 13:40 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Hey - me too! Except rather than write a conversion program each time, I
> just pipe the hdfdump[*] utility output into the ncgen utility to
> convert files I use. E.g.
>
> hdfdump <hdfile> | ncgen -b <ncfile>
>
> and I end up with a nice simple, useful netCDF file. :o)
>

Cool. I tried doing this a while back but I was never successful.
Which versions of hdfdump and ncgen are you using? If I can simply do
that from the command line now, that'd be so much easier.

-Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: A simple IF statement question
Next Topic: Re: file selection widget and returning filters

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 14:06:55 PDT 2025

Total time taken to generate the page: 0.65404 seconds