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

Home » Public Forums » archive » Re: readu sees unexpected records
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: readu sees unexpected records [message #43895 is a reply to message #43894] Wed, 04 May 2005 06:49 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hjalti Sig wrote:
> Hello group
> I found out that when reading unformatted data, written with a fortran
> 90 program, the readu command detects a couple of extra records before
> and after each line written with the fortran program. For example, I
> wrote a 10x10 array, containing the numbers from 1-100 in a file.
> Reading the file using readu, the content of the file appears as a
> 14x10 array, with very small numbers in columns 1, 2, 13 and 14,
> (producing floating underflow), and the correct numbers in the columns
> 3-12.
> In the data file I actually had to read there are three extra records
> before and two after each line.
> These extra records do certainly not appear when reading the files
> with a fortran program.

Fortran (currently) only really supports record-based I/O. For *sequential* access output
in Fortran, each variable length output record is preceded and followed with a a record
marker indicating the length of the record (the prefix marker is for checking the length,
the suffix marker for facilitating BACKSPACE-ing). To get IDL to emulate this type of I/O,
do as DFanning suggested and use the /F77_UNFORMATTED keyword in your OPENR statement. If
your output records are all the same length, you can modify your Fortran code to output in
*direct* access and you will no longer have the record marker problem.

FWIW, the Fortran2003 standard has a new type of I/O access called "STREAM" (along with
the venerable SEQUENTIAL and DIRECT) which produces the output that just about every
non-Fortran programming type expects. A few Fortran compilers already support this feature
(some fully standard, others only sorta.)

paulv


--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Auto change window focus (OS X) [BUG]
Next Topic: readu sees unexpected records

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

Current Time: Sat Oct 11 13:34:57 PDT 2025

Total time taken to generate the page: 0.76563 seconds