HDF_SD_START: Invalid HDF file or filename: problem related to network issues [message #86278] |
Tue, 22 October 2013 11:06  |
Robert Levy
Messages: 1 Registered: October 2013
|
Junior Member |
|
|
Hi all,
I am a group newbie, so i apologize if a solution exists but I didn't find.
Anyway, I am running a giant script to read thousands of MODIS HDF data files, which the files are located on a LVES mount (data are virtually mounted through a network).
So the problem seems to be that there are occasional network "blips" that happen. For example, I run these command:
1) determine that the file exists and is a proper HDF file
fileHandle = HDF_OPEN(Filename, /READ )
IF fileHandle LT 1 THEN BEGIN
errorLevel = 1
Return, errorLevel
ENDIF
HDF_CLOSE, fileHandle
2) Then I go and actually open the file:
hdfid = HDF_SD_START(Filename, /READ)
This is where the code bombs and gives me:
HDF_SD_START: Invalid HDF file or filename
and stops my whole code. This file exists and is a perfectly fine file.
Note that this may happen after the code is running for days (opening and closing files). If I try a second later, it works fine. Is there any way to have HDF_SD_START exit gracefully, and return an error code, rather than stop with error message? Then I could know it is a network problem and try again a few seconds later.
Thanks for any ideas.
-Rob
|
|
|
Re: HDF_SD_START: Invalid HDF file or filename: problem related to network issues [message #86280 is a reply to message #86278] |
Tue, 22 October 2013 11:37   |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
Hi Rob :)
This has happened to me a lot so I'm also interested if there's a solution... I normally manually copy-paste the line the code failed on, and then type .continue after to resume it. It works, but requires manual intervention.
Andy
On Tuesday, October 22, 2013 2:06:50 PM UTC-4, Robert Levy wrote:
> Hi all,
>
> I am a group newbie, so i apologize if a solution exists but I didn't find.
>
>
>
> Anyway, I am running a giant script to read thousands of MODIS HDF data files, which the files are located on a LVES mount (data are virtually mounted through a network).
>
>
>
> So the problem seems to be that there are occasional network "blips" that happen. For example, I run these command:
>
>
>
> 1) determine that the file exists and is a proper HDF file
>
> fileHandle = HDF_OPEN(Filename, /READ )
>
> IF fileHandle LT 1 THEN BEGIN
>
> errorLevel = 1
>
> Return, errorLevel
>
> ENDIF
>
> HDF_CLOSE, fileHandle
>
>
>
>
>
> 2) Then I go and actually open the file:
>
>
>
> hdfid = HDF_SD_START(Filename, /READ)
>
>
>
>
>
> This is where the code bombs and gives me:
>
> HDF_SD_START: Invalid HDF file or filename
>
>
>
> and stops my whole code. This file exists and is a perfectly fine file.
>
>
>
>
>
> Note that this may happen after the code is running for days (opening and closing files). If I try a second later, it works fine. Is there any way to have HDF_SD_START exit gracefully, and return an error code, rather than stop with error message? Then I could know it is a network problem and try again a few seconds later.
>
>
>
> Thanks for any ideas.
>
>
>
> -Rob
|
|
|
Re: HDF_SD_START: Invalid HDF file or filename: problem related to network issues [message #86281 is a reply to message #86278] |
Tue, 22 October 2013 11:44   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Robert Levy writes:
>
> Hi all,
> I am a group newbie, so i apologize if a solution exists but I didn't find.
>
> Anyway, I am running a giant script to read thousands of MODIS HDF data files, which the files are located on a LVES mount (data are virtually mounted through a network).
>
> So the problem seems to be that there are occasional network "blips" that happen. For example, I run these command:
>
> 1) determine that the file exists and is a proper HDF file
> fileHandle = HDF_OPEN(Filename, /READ )
> IF fileHandle LT 1 THEN BEGIN
> errorLevel = 1
> Return, errorLevel
> ENDIF
> HDF_CLOSE, fileHandle
>
>
> 2) Then I go and actually open the file:
>
> hdfid = HDF_SD_START(Filename, /READ)
>
>
> This is where the code bombs and gives me:
> HDF_SD_START: Invalid HDF file or filename
>
> and stops my whole code. This file exists and is a perfectly fine file.
>
>
> Note that this may happen after the code is running for days (opening and closing files). If I try a second later, it works fine. Is there any way to have HDF_SD_START exit gracefully, and return an error code, rather than stop with error message? Then I could know it is a network problem and try again a few seconds later.
>
> Thanks for any ideas.
Well, CATCH error handlers are always pretty useful. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
Re: HDF_SD_START: Invalid HDF file or filename: problem related to network issues [message #92603 is a reply to message #86278] |
Wed, 20 January 2016 13:33  |
xin.xi30
Messages: 1 Registered: January 2016
|
Junior Member |
|
|
On Tuesday, October 22, 2013 at 11:06:50 AM UTC-7, Robert Levy wrote:
> Hi all,
> I am a group newbie, so i apologize if a solution exists but I didn't find.
>
> Anyway, I am running a giant script to read thousands of MODIS HDF data files, which the files are located on a LVES mount (data are virtually mounted through a network).
>
> So the problem seems to be that there are occasional network "blips" that happen. For example, I run these command:
>
> 1) determine that the file exists and is a proper HDF file
> fileHandle = HDF_OPEN(Filename, /READ )
> IF fileHandle LT 1 THEN BEGIN
> errorLevel = 1
> Return, errorLevel
> ENDIF
> HDF_CLOSE, fileHandle
>
>
> 2) Then I go and actually open the file:
>
> hdfid = HDF_SD_START(Filename, /READ)
>
>
> This is where the code bombs and gives me:
> HDF_SD_START: Invalid HDF file or filename
>
> and stops my whole code. This file exists and is a perfectly fine file.
>
>
> Note that this may happen after the code is running for days (opening and closing files). If I try a second later, it works fine. Is there any way to have HDF_SD_START exit gracefully, and return an error code, rather than stop with error message? Then I could know it is a network problem and try again a few seconds later.
>
> Thanks for any ideas.
>
> -Rob
Hi Rob,
Have you found a solution to your problem? I am having the same issue. The MODIS collection 6 MYD04 file I want to read is valid, but hdf_open reports -1 fileHandle, and hdf_sd_start reports invalid HDF file or filename.
|
|
|