Use IDL6.0 to read Fortran 90 written data [message #55229] |
Tue, 07 August 2007 00:07 |
Nianming Zuo
Messages: 13 Registered: August 2007
|
Junior Member |
|
|
Dear all,
I have sufferred file read/write problems between Fortran 90/95 and
IDL 6.0.
My Fortran compiler:
Silverfrost ftn95, Compatable for Fortran 77/90/95
http://www.silverfrost.com/12/ftn95/ftn95_feature_details.as p
IDL 6.0 (Interactive Data Language, RSI)
Both are in MS Windows XP(sp2) OS system.
Write data to a file by use of Fortran:
dimension dat(m, n)
!........ Manipulations..., matrix dat(m, n) is float
open(unit=11, file="file.dat", form="unformatted")
write(11) dat
!..........
! The above are really f77 code, so I guess it is related to Compiler.
Read the data above by IDL6.0: (Way 1)
dat = fltarr(m,n)
openr, 1, 'file.dat'
readu, 1, b, dat, b
In "readu, 1, b, dat, b", the "b"s are used to skip the record area in
Fortran data format.
Unfortunately, it can not get the right result, and prompts "End of
the file"
I have also tried another way in IDL: (Way 2)
dat = fltarr(m,n)
openr, 1, 'file.dat' /f77_unformatted
readu, 1, dat
But, it prompts,
"% READU: Corrupted f77 unformatted file detected. "
For the above Fortran code, when it is compied by g77, IDL can read it
by Way 2.
So, I doubt that different compilers give different response to the
standard Fortran sentences ?
Since there is no f90_unformatted or f95_unformatted, f77/f90/f95 will
produce the same record for the "open-write" sentence.
Now, how can I read ftn95 compiled output data by IDL6.0 ? I have
searched this forum, but without any desirable results.
Thanks,
Tony
|
|
|