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

Home » Public Forums » archive » Reading sequence of HDF files fails after some number of successes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Reading sequence of HDF files fails after some number of successes [message #82103] Tue, 20 November 2012 13:49 Go to previous message
BLesht is currently offline  BLesht
Messages: 89
Registered: March 2007
Member
I'm using IDL8.1 running on MacOS10.6.8 to process a number of HDF files (NASA MODIS L2). My code (too involved to reproduce in entirety here) includes a loop in which I open each file, check it to see if it is useful for my analysis, and then, if it passes, does some processing. The code seems to run fine through a number of files and then stops with an "HDF_SD_START: Invalid HDF file or filename (filename is here)" error. I have checked the file using ncdump_hdf and it is fine. While debugging I inserted a test:

PRINT, 'About to test HDF file', inFile & $
testHDF = HDF_OPEN(inFile, /READ) & $ ; Open the HDF file
PRINT, 'testHDF = ', testHDF & $
IF (testHDF NE -1L) THEN PRINT, inFile, ' passes HDF_OPEN test ' & $
HDF_CLOSE, testHDF & $

That results in:

About to test HDF file <filename is here>
testHDF = 536872618
<filename is here> passes HDF_OPEN test

but then goes on to issue the:

% HDF_SD_START: Invalid HDF file or filename (<filename is here>).
% Execution halted at: $MAIN$

Continuing the debugging, I removed the apparently offending file from the input list and the code stopped at exactly the same point but now the next file in the original list was the one that apparently caused the failure. This leads me to think the problem has something to do with the number of HDF files I've been trying to open (and possibly not closing properly?). The portion of the code that fails is:

fid = HDF_SD_START(inFile, /READ) & $
sdsNoLat = HDF_SD_NAMETOINDEX(fid, 'latitude') & $
varid = HDF_SD_SELECT(fid,sdsNoLat) & $
HDF_SD_GETDATA, varid, latitude & $
HDF_SD_ENDACCESS, varid & $
sdsNoLon = HDF_SD_NAMETOINDEX(fid, 'longitude') & $
varid = HDF_SD_SELECT(fid,sdsNoLon) & $
HDF_SD_GETDATA, varid, longitude & $
HDF_SD_ENDACCESS, varid & $
HDF_SD_END, fid & $ ; End the HDF_SD

This seems like it should be obvious, but I'm not seeing the problem. Any help would be sincerely appreciated.

Barry
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with vert_colors and rgb_table
Next Topic: Help with SVDC procedure

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

Current Time: Thu Oct 09 20:39:23 PDT 2025

Total time taken to generate the page: 2.63884 seconds