Re: reading multiple HDF files [message #61381 is a reply to message #61338] |
Wed, 16 July 2008 08:27   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Here is the code I used to test this. I can run as many as
> I like with the HDF_SD_END in the code, but only 32 without
> it. :-)
Here is my theory. Suppose you open a file with
a command like this:
OPENR, lun, filename, /Get_LUN
If you close the file like this:
CLOSE, lun
You have closed the file, but you have not released the
logical unit number to be used over again. Since there
are only 32 of these "managed" logical unit numbers, if
you were opening files in a loop, you would run out after
32 iterations. You need to also free the logical unit
number to be used over again:
FREE_LUN, lun
(Fortunately, in this case FREE_LUN also closes the file, so you
don't need to use both of these commands. But I see a LOT of
people using CLOSE when they should be using FREE_LUN.)
That is what is happening here, I think.
HDF_SD_ENDACCESS is equivalent to CLOSE
HDF_SD_END is equivalent to FREE_LUN
So, when you are working with HDF files, you *must* use both.
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.")
|
|
|