[MITgcm-support] FORTRAN binary read help.
Michael Schaferkotter (Contractor)
Michael.Schaferkotter.ctr at nrlssc.navy.mil
Sun Nov 15 18:56:16 EST 2009
jody;
after writing out the data on a powerpc Mac using the MATLAB program
x=cos(1:100); ieee='l'; prec='real*8';
fid = fopen('HorStruct.bin','w',ieee); fwrite(fid,x,prec); fclose(fid);
the following fortran program on a Intel MacBookPro, successfully reads the data back in:
program testprog
integer, parameter :: real8 = selected_real_kind(10)
real(kind=real8), dimension(100) :: horStructWest
open(unit=111,file="HorStruct.bin", status="old", access="direct", recl=100*8 ,action="read")
read(unit=111,rec=1) horStructWest
CLOSE (unit=111)
print *, horStructWest
endprogram testprog
i/m sure it/s not the only way.
michael schaferkotter
ps.
[PowerBookG5:/] schaferk% g95 -v
Using built-in specs.
Target:
Configured with: ../configure --enable-languages=c
Thread model: posix
gcc version 4.0.3 (g95 0.92!) Apr 24 2009
More information about the MITgcm-support
mailing list