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

Home » Public Forums » archive » Reading HDF files
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
Reading HDF files [message #913] Sat, 20 March 1993 15:05 Go to next message
dean is currently offline  dean
Messages: 55
Registered: March 1993
Member
I need some help reading and writing HDF files from IDL. I read
some place that IDL supports HDF, but I cannot find anything like READ_HDF
or WRITE_HDF as there are for GIF and TIFF. Can some give me a clue how
to read and write HDFs?

Kelly Dean
CSU/CIRA
Re: reading hdf files [message #63134 is a reply to message #913] Wed, 29 October 2008 07:27 Go to previous message
jameskuyper is currently offline  jameskuyper
Messages: 79
Registered: October 2007
Member
TimLS wrote:
> Has anyone else had problems reading hdf files? I'm using a program
> that uses a variety of the H5* routines in IDL version 6.2.. I read
> one of my data files and the program takes around 5 seconds. I read a
> couple more files and suddenly it takes an age to read. The solution I
> adopt is to shutdown IDL and re-start at the point that I'd got to.
> Programming purists may disapprove but it works for me as all I'm
> doing with the data is writing it out to another format. Presumably
> there is some kind of memory allocation problem going on, but what can
> I do about it?

You should change line 42. :-)

Since you have chosen not to give us any actual code to look at, we
can only guess at what the problem might be. With HDF functions, one
of the most important things to remember is that many of them come in
bookend pairs. For every _CREATE or _OPEN function, there's a
corresponding _CLOSE function that should be called when you're done
using whatever it was that you created or opened. Forgetting to close
things is the single most plausible reason I can imagine for a
slowdown such as you describe.
Re: reading hdf files [message #63143 is a reply to message #913] Wed, 29 October 2008 06:06 Go to previous message
loebasboy is currently offline  loebasboy
Messages: 26
Registered: August 2008
Junior Member
On 29 okt, 12:10, David Fanning <n...@dfanning.com> wrote:
> TimLS writes:
>> Has anyone else had problems reading hdf files? I'm using a program
>> that uses a variety of the  H5* routines in IDL version 6.2.. I read
>> one of my data files and the program takes around 5 seconds. I read a
>> couple more files and suddenly it takes an age to read. The solution I
>> adopt is to shutdown IDL and re-start at the point that I'd got to.
>> Programming purists may disapprove but it works for me as all I'm
>> doing with the data is writing it out to another format. Presumably
>> there is some kind of memory allocation problem going on, but what can
>> I do about it?
>
> I think your best bet might be to read this article:
>
>   http://www.catb.org/~esr/faqs/smart-questions.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

You should notice that it is important to close al file_id and
datasets_id you've used as such:

file_id = H5F_OPEN(file)
dataset_id = H5D_OPEN(file_id, nr_bands_str)
nr_bands = H5D_READ(dataset_id)
H5D_CLOSE, dataset_id
H5F_CLOSE, file_id

In this way there is no memory leakage. If this does not help I must
refer you to the link David provided.
Re: reading hdf files [message #63144 is a reply to message #913] Wed, 29 October 2008 04:10 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
TimLS writes:

> Has anyone else had problems reading hdf files? I'm using a program
> that uses a variety of the H5* routines in IDL version 6.2.. I read
> one of my data files and the program takes around 5 seconds. I read a
> couple more files and suddenly it takes an age to read. The solution I
> adopt is to shutdown IDL and re-start at the point that I'd got to.
> Programming purists may disapprove but it works for me as all I'm
> doing with the data is writing it out to another format. Presumably
> there is some kind of memory allocation problem going on, but what can
> I do about it?

I think your best bet might be to read this article:

http://www.catb.org/~esr/faqs/smart-questions.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: position plot in iplot
Next Topic: Ayuda para utilizar MCTK para imagenes LST :MOD11A2

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

Current Time: Wed Oct 08 14:32:53 PDT 2025

Total time taken to generate the page: 0.00576 seconds