Re: handling zero size file [message #52559] |
Mon, 12 February 2007 14:27  |
Kenneth Bowman
Messages: 86 Registered: November 2006
|
Member |
|
|
In article <eqqo6t$7u0$1@news.nems.noaa.gov>,
Spam Bob <spambob@bikinibottom.net> wrote:
> I have an idl program that I call from perl. I send the idl program two
> files (file1 and file2).
>
> PRO mentor_nf, file1, file2, loc
>
> If both files are nonzero size it runs fine plotting both (this is a two
> panel plotting program). If I'm missing some data and either file1 or
> file2 is zero size, the program bombs. I would like it to go ahead and
> plot the nonzero sized file and just leave the other panel blank.
>
> Here is where the program fails:
> DATA1 = READ_ASCII(file1, TEMPLATE=PLOTTEMPLATE)
>
> and this is the error:
> % READ_ASCII: File "/data/file1_20060322.dat" is not a valid ASCII file.
>
> I tried the MISSING_VALUE keyword but that didn't change anything.
Use FILE_INFO to check the file size before opening it.
Ken Bowman
|
|
|
Re: handling zero size file [message #52560 is a reply to message #52559] |
Mon, 12 February 2007 15:09  |
Spam Bob
Messages: 2 Registered: February 2007
|
Junior Member |
|
|
hradilv wrote:
> On Feb 12, 4:03 pm, Spam Bob <spam...@bikinibottom.net> wrote:
>> I have an idl program that I call from perl. I send the idl program two
>> files (file1 and file2).
>>
>> PRO mentor_nf, file1, file2, loc
>>
>> If both files are nonzero size it runs fine plotting both (this is a two
>> panel plotting program). If I'm missing some data and either file1 or
>> file2 is zero size, the program bombs. I would like it to go ahead and
>> plot the nonzero sized file and just leave the other panel blank.
>>
>> Here is where the program fails:
>> DATA1 = READ_ASCII(file1, TEMPLATE=PLOTTEMPLATE)
>>
>> and this is the error:
>> % READ_ASCII: File "/data/file1_20060322.dat" is not a valid ASCII file.
>>
>> I tried the MISSING_VALUE keyword but that didn't change anything.
>
> Try FILE_INFO()
Thanks for the reply. I looked up FILE_INFO but I think you meant
FILE_TEST. I actually came up with a workaround after I posted my
question (put some dummy data in "file" if it is empty), but I can come
up with a better solution with FILE_TEST. I'd like the empty panel to
display something like "No data for this day" if the file is zero size.
|
|
|
Re: handling zero size file [message #52562 is a reply to message #52559] |
Mon, 12 February 2007 14:33  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Feb 12, 4:03 pm, Spam Bob <spam...@bikinibottom.net> wrote:
> I have an idl program that I call from perl. I send the idl program two
> files (file1 and file2).
>
> PRO mentor_nf, file1, file2, loc
>
> If both files are nonzero size it runs fine plotting both (this is a two
> panel plotting program). If I'm missing some data and either file1 or
> file2 is zero size, the program bombs. I would like it to go ahead and
> plot the nonzero sized file and just leave the other panel blank.
>
> Here is where the program fails:
> DATA1 = READ_ASCII(file1, TEMPLATE=PLOTTEMPLATE)
>
> and this is the error:
> % READ_ASCII: File "/data/file1_20060322.dat" is not a valid ASCII file.
>
> I tried the MISSING_VALUE keyword but that didn't change anything.
Try FILE_INFO()
|
|
|