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

Home » Public Forums » archive » Re: read a file written in fortran
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: read a file written in fortran [message #71181] Mon, 07 June 2010 13:20 Go to next message
Thibault Garel is currently offline  Thibault Garel
Messages: 55
Registered: October 2009
Member
>
> You are telling IDL to read just one 14-digit float, followed by one
> character. That will be the first number, followed by the "0" that
> happens to be the character at position 15. That in itself would not
> cause that error, though presumably is not what you want, since the
> logical variable is printed at the end of the line. Do you want to
> read all 9 numbers, plus the logical value, or just one, skip the
> middle columns, then the logical value?
>
> I am guessing you read statement is in some loop, so that it kept
> trying to read, and reached the end of the file. If you show it, it
> may become clear why this is failing.

What i do in fact is:
readf,11,format='(9e14.6,A1)', a,b,c,d,e,f,g,h,i,my_logical

where a,b,c.... are initialized to 0.0d0
Re: read a file written in fortran [message #71182 is a reply to message #71181] Mon, 07 June 2010 12:54 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 7, 4:42 pm, bing999 <thibaultga...@gmail.com> wrote:
> It contains rows all equivalent to the one below:
>
> 0.207720E-03  0.245036E+02  0.497323E+01  0.116080E+22  0.156774E+01
> 0.615295E-04  0.893258E-06  0.100000E+01  0.145065E-01T

You are telling IDL to read just one 14-digit float, followed by one
character. That will be the first number, followed by the "0" that
happens to be the character at position 15. That in itself would not
cause that error, though presumably is not what you want, since the
logical variable is printed at the end of the line. Do you want to
read all 9 numbers, plus the logical value, or just one, skip the
middle columns, then the logical value?

I am guessing you read statement is in some loop, so that it kept
trying to read, and reached the end of the file. If you show it, it
may become clear why this is failing.
Re: read a file written in fortran [message #71184 is a reply to message #71182] Mon, 07 June 2010 12:42 Go to previous messageGo to next message
Thibault Garel is currently offline  Thibault Garel
Messages: 55
Registered: October 2009
Member
It contains rows all equivalent to the one below:

0.207720E-03 0.245036E+02 0.497323E+01 0.116080E+22 0.156774E+01
0.615295E-04 0.893258E-06 0.100000E+01 0.145065E-01T

cheers
Re: read a file written in fortran [message #71185 is a reply to message #71184] Mon, 07 June 2010 12:34 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 7, 4:27 pm, bing999 <thibaultga...@gmail.com> wrote:
> Hi,
> I want to read with IDL an ascii file written in Fortran 90.
>
> The file contains two types of data: double floats and "logical". For
> the floats no problem but for the logical (which writes either T or F
> (for true or false) in the ascii file) i get " READF: End of file
> encountered" while doing:
>
> my_float = 0.0d0
> my_logical='a'
>
> readf,11,format='(1e14.6,A1)', my_float,my_logical
>
> Is there anything wrong in the format or in the initialization?
>
> Thanks in advance!

It depends on what is in the file you want to read. Can you show what
it looks like?
Re: read a file written in fortran [message #71316 is a reply to message #71181] Tue, 08 June 2010 02:31 Go to previous message
Thibault Garel is currently offline  Thibault Garel
Messages: 55
Registered: October 2009
Member
For information, here is how i wrote the file in fortran:

write(my_unit,'(9e14.6,L1)') a,b,c,d,e,f,g,h,i,my_logical

Then, how to read a L1 format in IDL?

thanks
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Map projection in ENVI
Next Topic: Fitting an implicit function with IDL

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

Current Time: Wed Oct 08 11:45:24 PDT 2025

Total time taken to generate the page: 0.00730 seconds