Re: reading multiple HDF files [message #61382 is a reply to message #61338] |
Wed, 16 July 2008 08:21   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
julia.walterspiel@gmail.com writes:
>
>> Did you try closing the file, as in my last suggestion?
>> This is pretty much what I expected without that close.
>>
>
>
> yes I did.
> I put the HDF_SD_END inside the loop and outside.
> Placing it outside gave me the 32-loops.
> Placing it inside gave me nothing but
> IDL> read_multiple_hdf
> Loaded DLM: HDF.
> Compiled module: HDF_SD_VARDIR.
>
> i'm sorry, this is my very first time I'm dealing with IDL, maybe I'm
> overlooking something completely obvious and simple?
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. :-)
;########################################################### ##
PRO read_multiple_hdf
hdf_file_path='G:\data\96108_08.hdf'
;*********************************************************** *****
;********** Begin the for loop to read all selected hdf files ***
for I=0,100 do begin
hdfid = HDF_SD_START(hdf_file_path)
varnames = HDF_SD_VARLIST (hdfid)
index = hdf_sd_nametoindex(hdfid,'ScanRate')
if (index eq -1) then message, string(varnames)
varid = hdf_sd_select(hdfid, index)
HDF_SD_GETDATA, varid, data
hdf_sd_endaccess, varid
HDF_SD_END, hdfid
Print, I
endfor
END
;########################################################### #######
--
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.")
|
|
|