Re: how to clear error message [message #73270 is a reply to message #73269] |
Wed, 03 November 2010 19:25   |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Nov 3, 8:58 pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 3, 7:59 pm, wlandsman <wlands...@gmail.com> wrote:
>
>
>
>
>
>> On Nov 3, 7:43 pm, ThanhThoan Nguyen <marct...@gmail.com> wrote:
>
>>>> > When I try to read a bad FITS file I obtain the following error
>
>>>> > % MRD_HREAD: Warning-Invalid characters in header
>
>>> I am trying to loop over several FITS files, and I want to be able to
>>> catch
>>> this error and move on to the next FITS file. With the silent keyword
>>> I don't
>>> think this will resolve my problem.
>
>> Note that MRD_HREAD is not printing an error message, but an
>> "informational" message.
>> Below is the relevant code within MRD_HREAD
>
>> ; Check that there aren't improper null characters in strings that are
>> causing
>> ; them to be truncated. Issue a warning but continue if problems are
>> found.
>
>> w = where(strlen(block) ne 80, Nbad)
>> if (Nbad GT 0) then begin
>> if ~keyword_set(SILENT) then message, /INF, $
>> 'Warning-Invalid characters in header'
>> block[w] = string(replicate(32b, 80))
>> endif
>
>> You might be able to catch the error if you change the /INFORMATIONAL
>> to /CONTINUE.
>
>> --Wayne
>
> I am sorry but are you suggesting that I modify the MRD_HREAD
> procedure?
Yes, I am suggesting that you modify the MRD_HREAD procedure.
I assume this is a one-time case where for some reason you have been
given some corrupted FITS files mixed with good ones. So I would
make the above change to MRD_HREAD and when you are done processing
these files, revert back to the original MRD_HREAD. (Better yet, I
would first flag the corrupted files -- and find out how they are
corrupted -- by using the fitsverify tool ( http://fits.gsfc.nasa.gov/fits_verify.html
).
If for some reason you expect this problem to keep occurring, then I
suggest you contact the author of MRD_HREAD ;-) and ask for a new
keyword -- maybe /STRICTERROR to tell MRD_HREAD to abort with an error
signal at any sign of a corrupted file, rather than trying to keep
reading the file, as it currently does. --Wayne
|
|
|