Re: Error in reading large Fortran unformatted files [message #75125 is a reply to message #75068] |
Thu, 17 February 2011 07:02   |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article
<45a7d29c-1223-4e0e-8390-5a549f91cd02@s11g2000yqh.googlegroups.com>,
OM <metukio@gmail.com> wrote:
> The output is now:
> nb1=2147483657
> nb2=995288272
>
> I still have no idea what this means.
nb1 is the largest possible positive 32-bit signed integer
IDL> print, 2L^31 - 1
2147483647
The fact that nb2 does not match nb1 indicates a problem.
The problem is probably that the version of Fortran that wrote your
file only allows 2 GB records. That is, the length word at the
beginning and end of each record is only 4 bytes.
A 64-bit fortran may or may not use 8-byte length words. You may be
able to set this as a Fortran option.
You should be able to find out in your Fortran documentation,
or you can find it experimentally by running a Fortran program
that writes a 2 GB record. I suggest that you write 4-byte
integer zeroes. Then try reading the file in IDL.
You can try this, which will read the first 4 bytes as the length word
nb1=0ul
nb2=0ul
OPENR, 1, f
READU, 1, nb1, d, nb2
or this, which will read the first 8 bytes as the length word
nb1 = 0ULL
nb2 = 0ULL
OPENR, 1, f
READU, 1, nb1, d, nb2
Then repeat the experiment with a 4GB record.
Ken Bowman
|
|
|